-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
USB: Update USB probe code, rewrite/reorganize the HID driver and implement hid keyboard driver #184
base: master
Are you sure you want to change the base?
Conversation
Add a mouse event interface for use by HIDs that give coordinates in absolute terms. The HID values are normalized to be between 0 and 1 by dividing the reported values by the maximum values. These normalized values are then translated in the GUI code into display values by multiplying by the display dimensions as appropriate.
The previous code quit searching for a driver when a probe failure used the throw mechanism to exit. This update to the USB probe code allows the search for a driver to continue after the throw mechanism is used. This change also required changing all of the calls of (throw :probe-failed NIL) to (throw :probe-failed :failed) so that the throw path can be distinguished from the normal failure exit of returning NIL. The HID driver was restructured to move the HID mouse driver to hid-mouse.lisp and the HID keyboard driver stub to hid-keyboard.lisp. (hid-keyboard.lisp contains a stub driver which contains no real functionality.) In addition, the HID report parser was re-written to more completely and correctly parse the HID report and the HID mouse driver was re-written to use this new parser output. These are major re-writes and comparison with the previous code is probably not useful.
Merge the single report and multiple report code.
hid.lisp: Update comments to reflect data table in hid-keyboard.lisp. hid-mouse.lisp: Change the way array report items are handled, instead of treating an array as a sequence of buttons, treat it as an array. This fits in better with keyboard reports where an array of characters is defined. hid-keyboard.lisp: Implement the hid keyboard driver.
:left-control :left-shift :left-alt :left-gui | ||
:right-control :right-shift :right-alt :right-gui)) | ||
|
||
(defvar *modifier->char* |
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.
How does this work with layouts that have more modifiers? I am using neo2 layout, which has Shift, Mod3, Mod4, and I use Control, Meta, Super, Hyper as command modifiers. xkb in X can support this. This is also relevant if you want to get a complete Space Cadet keyboard as in the Lisp Machines.
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.
Sorry, it doesn't handle more modifiers. I'm not sure the HID class driver can support more modifiers - there doesn't seem to be button codes defined for additional modifiers (USB HID Usage Tables doc). I would like the driver to be as general as possible, but your keyboard may need a device specific driver. (The mezzano USB driver does support device specific drivers, but we don't have any yet.)
To update the code, I need to see the report descriptor(s) that your keyboard provides. You can get that on mezzano, but it requires you to have a USB-2 controller (I'm still working on the USB-3 controller driver) and merge in the PR, turn on debug tracing that I've included in the code and then connect your keyboard.
I can give you more details on how to turn on logging if you want to pursue this.
This PR makes the HID driver code more general and the HID mouse driver now supports the qemu usb-tablet device as well as additional USB mice.