-
Notifications
You must be signed in to change notification settings - Fork 1.3k
HID gamepad support #776
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
HID gamepad support #776
Conversation
|
||
from adafruit_usb_descriptor import hid | ||
|
||
class HIDReportDescriptors: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a wrapper class? I'd expect the module to be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally it had a helper function which ended up not being needed. I'll make it just a module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Folks will be excited for this.
I just want to say that the HTTP version @dhalbert dhalbert refer to https://html5gamepad.com/ say "Connection Refused" where the HTTP version http://html5gamepad.com/ works for me. |
@dglaude URL's fixed. Thanks! |
Adds a simple gamepad HID device to the devices that share a common endpoint: mouse, keyboard, consumer controls, and now gamepad.
The gamepad shows up to varying degrees in various operating systems:
/dev/input/js*
device and a/dev/input/event*
device. Events can be seen viaevtest
andjstest
. Firefox and Chrome do not see the gamepad via https://html5gamepad.com, but that appears to be due to limited gamepad support/compatibility between the browsers and LinuxFirefox and Chrome can see the gamepad via http://html5gamepad.com. You may need to send some events before it shows up.
This PR also includes latent support for a stylus-based digitizer as well, but it conflicts with other devices, so it's turned off until we have dynamic USB HID devices. I had hoped to add a little dynamic
boot.py
support to allow turning the HID devices on and off before USB comes up, but this requires dynamic construction of both the report descriptors and the HID descriptor, so deferred for now.Needs adafruit/Adafruit_CircuitPython_HID#19 to have a Python library for the gamepad support.