reswitched/libtransistor

hid_init() often returns error code : 0xdc01

ericde45 opened this issue · 1 comments

more than half of the times, calling hid_init() returns error 0xdc01
test_hid.c suffers of this for example
to continue brings a crash of the switch

( being able to test if a button is pushed is really usfeul during tests )

0xDC01: Invalid memory range.

Quick investigation: I suspect this region is to blame. There, we look for a memory space where we can fit sizeof(hid_shared_memory_t). And then, we map 0x40000 bytes in that address. (I checked in a calculator very fast, and sizeof(hid_shared_memory_t) == 0x40000, so no problem there. We should probably have a static_assert for that).

So I guess find_empty_memory_block is somehow returning an invalid range. 🤔