PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
171 stars 87 forks source link

USB Keyboard -- "error allocating data transfer" #132

Closed RetroHQ closed 10 months ago

RetroHQ commented 10 months ago

I'm trying to get a keyboard to be recognised with a teensy 4.1 but I'm getting an error allocating the device (I've tried 3 with the same result) --

port change: 10001803 connect begin reset port change: 10001005 port enabled end recovery new_Device: 12 Mbit/sec new_Pipe enumeration: enumeration: error allocating data transfer

Looking at where "error allocating data transfer" is likely to come from points to allocate_Transfer() failing. The allocate_Transfer() function in memory.cpp uses free_Transfer_list, which never seems to be initialised?

I'm really confused as to what's going on. I can only assume I've done something stupid, but I've not figured out what.

RetroHQ commented 10 months ago

Ok, I've spotted free_Transfer is used to initialise the buffer from init_Device_Pipe_Transfer_memory. Increasing memory_Transfer to 16 allows it to seemingly setup correctly. However attachRawPress and attachRawRelease do not fire, so it would seem (no tty out).

RetroHQ commented 10 months ago

Yes, it would appear I'm just an idiot, I expected as much. You need to have some USBHIDParser's allocated which provide the extra pipe memory and makes stuff work. That'll teach me not to work from the example code fully first.