-
Notifications
You must be signed in to change notification settings - Fork 162
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
No volume media key #17
Comments
@Zeskye in which you want to add this library? |
Hi, Maybe inside the keyboard.h ? I try to find the hex code, but unlucky for the moment |
There is some valuable discussion on this subject at #26 |
Coming back to this issue. Here is a summary of the information I could gather about the volume media keys, and a proposal for moving forward. The Keyboard library does not support the keys Mute, Volume up, and Volume down. Adding this support does not seem to be completely trivial. Scan codesAccording to the Android documentation, each of these keys can be represented by multiple scan codes (technically called “USB usage codes”). These codes belong to two different sets called “pages”. If I understand correctly, each page represents a specific type of HID device. HID keyboard and keypad page (0x07):
HID consumer page (0x0c):
My keyboard uses the “HID consumer page”. It presents itself to the host as two different USB sources: a keyboard (page 0x07) and a consumer device (page 0x0c). Normal key notifications are sent from the keyboard source, but volume media key notifications are sent from the consumer device source. Using this approach in the Keyboard library would incur a significant cost in terms of complexity and code size, as the Arduino would need to impersonate two USB devices instead of one. Using any of the scan codes available in the keyboard page should be easier, but it remains to be seen how well these codes are supported by common operating systems. Library-specific encodingWhen one issues
The ASCII mode is used for typing ASCII text (e.g., with #define KEY_RETURN 0xB0 which is interpreted as the scan code It would seem natural to use this mode for the volume media keys, with something like #define KEY_MUTE (0x7f + 0x88) This, however, cannot work, as the result ( ProposalHere is an idea: we could change the interpretation of the raw mode this way:
The range of scan codes encodable by this scheme would then be shifted from 0x00 – 0x77 to to 0x10 – 0x87:
I can implement this change in a pull request, but this would need some testing. According to the Deskthority Wiki, these scan codes come from the volume media keys on the quite exotic Sun Type 6 and Sun Type 7 keyboards, and should be supported by Unix and Linux. Support by other OSes is uncertain. Personally, I would only be able to test this on an Ubuntu host, and I don't think the change would be worth implementing unless someone can test it under Windows and macOS. Any volunteers? |
Hello it's possible to add these fallowing keys ?
KEY_VOLUME_DOWN
KEY_VOLUME_UP
KEY_MUTE
thanks
The text was updated successfully, but these errors were encountered: