-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Low Speed device? like many boot level keyboards? #43
Comments
Without a hub this code is used:
the hub code has this:
getPortStatus():
|
It looks like it isn't straightforward to get the speed of the direct connection:
I don't know what the timing for that being true is but I'm guessing not when |
It looks like the other library (USBHostGiga) uses the lower level function:
The low level code then reads in the register OTG_HPRT
|
Making some progress... I am pretty sure a real solution might need to abstract some stuff...
And I pugged in a LS device (the keyboard) and likewise a Serial device, that is FS... And they were detect. So then running the Keyboard test program mentioned in the original post here. And getting lots of Warnings output, and still now callbacks with the characters.
Now to see if that can be resolved... |
That isn't a reassuring warning! |
Still working on it,
The calls to HAL_HCD_HC_init, are where the end points get setup and the speed is passed in.... But still no keystrokes |
@AndrewCapon @mjs513 - Making some progress on this... Still needs a lot of cleaning up.
Now getting data:
Some interesting things to check: The USBHostKeyboard class is pretty limited and fragile. I did hack up their handler code to reasonably handle a keyboard BOOT format setup. First byte is modifiers, 2nd is ignored, and 3-8 are keycodes of keys currently pressed. I also added in callback for when released. But their conversion from keycod to code is really limited and can go BOOM. That is it is a two dimension array With the first dimension is modifier, which is 8 bits:
Also does not handle at all anything like Multimedia keys nor system keys. Not sure how far to take it, may extract out into my secondary library, like the USBSerial adapter class and the like. ` |
Nice one. rxhandler being called with 0 bytes, is that every 1 ms? |
The keyboard is using USB interrupts:
So 1ms call to rxhandler, no data = 0 bytes. |
Sorry for the late response but been a busy day today. Just retested with Kurt's updated branch with my the xbox, switch pro, and ps3 and they are all still working. |
There are several devices like keyboards, which run in USB Low Speed (1.5MBps) and are not properly being handled.
For example, I have a Dell keyboard plugged in. I believe this one came with my newer computer I purchased in the last couple of years.
If I run the KeyboardGiga example sketch from the USBHostGiga library it receives, the keystrokes and prints them out in the Serial monitor.
If I instead run a similar test using this library it does not.
I added debug output to the keyboard class... So I know it is being called. Debug shows:
The input code for the Serial class is not receiving any data.
I have a Logic Analyzer attached and it is showing the device is sending data:
And using my USB Analyzers for the Saleae, we see the following messages:
xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"> <style> </style>
Note: I tried to print out the speed of the device, but the method appears to always return false... From quick guessing I think should be HIGH for low speed? Would have hoped there were at least three values (LS, FS, HS), but it also appears like this library does not support High speed...
The text was updated successfully, but these errors were encountered: