Skip to content
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 for multimedia keys #2

Open
biemster opened this issue Mar 31, 2023 · 15 comments
Open

Support for multimedia keys #2

biemster opened this issue Mar 31, 2023 · 15 comments

Comments

@biemster
Copy link
Owner

The current implementation only supports alphanumeric and KBD keys as defined from here on further:

// Special keys

There are a few consumer keys that would be very handly (for example volume up/down) defined from here on:

// Consumer Keyboard Keycodes

Support for those would be much appreciated, but would require some rework of the internals. Especially the storage in and reading from EEPROM.

@eworm-de
Copy link

Indeed, that would be nice to have...

@eworm-de
Copy link

eworm-de commented May 25, 2023

I had a brainstorm and hacking session with @mgisbers...

This is the official documentation: USB HID Usage Tables - Keyboard/Keypad Page
... which gives a nice table with ids to be written into KBD_report.

The idea on this: We ditch the ASCII to keycode mapping, as it interferes with some generic codes we want to send. After all one should be able to look up an id in a table if the same person is expected to write that id to a file with a hex editor. 😜

The eeprom layout is changed to two bytes for every key:

  • first byte is a bitmap of modifiers (control, shift, alt, ...)
  • second byte is the usage id found in table

Let's have some examples:

  • a0x0004
  • A (capital a) → 0x0204
  • Ctrl+Alt+Del0x054c
  • Volume up → 0x0080
  • Volume down → 0x0081

Any thoughts on this?

@eworm-de
Copy link

eworm-de commented May 25, 2023

I've come up with a prove of concept...
https://github.com/eworm-de/3keys_1knob/tree/modifier-and-code

@biemster
Copy link
Owner Author

Yeah that looks nice! I was also thinking about a 2 byte layout indeed, and even a bit more elaborate since I was considering having the pad send whole sequences. So maybe the first byte can also indicate how many ids are coming?
I have to be honest though that my free time is very limited at the moment, and this project is not really high on my list, sorry.

@eworm-de
Copy link

Yes, sequences of keys (macros) would be nice... Already thinking about it.

@MrGeorgeK55
Copy link

i'm having problems with the Consumer Keyboard Keycodes, do you need a modifier in the first byte? or i'm missing something?

@biemster
Copy link
Owner Author

biemster commented Aug 3, 2023

@MrGeorgeK55 instead of KBD_{press,releaseAll} here

KBD_press(currentKnobKey); // press corresponding key ...

and here
KBD_releaseAll(); // ... or release last key

you need CON_{press,releaseAll}.

@hugokernel
Copy link

Thank you @eworm-de: Your branch works perfectly well, however, I had to make a horrible hack to be able to send the Mute keycode via the consumer functions.

I can't wait for this project to evolve a bit.

@biemster
Copy link
Owner Author

biemster commented Oct 3, 2023

I can't wait for this project to evolve a bit.

Winter is coming, and with that more indoors time so this ticket will be picked up at some point.

@hugokernel
Copy link

hugokernel commented Oct 3, 2023

  • Ctrl+Alt+Del0x054c

Could you explains how you get 0x054c ?

I want to send this: Ctrl + Win + l but I don't really understand how I can do that.

Edit: Bitmap is ?|?|?|?|WIN|CTRL|SHIFT|ALT

@MisterRager
Copy link

I wanted to also add support for the consumer page keys, so I added a third configuration byte in eeprom per-key:
eworm-de#1

@MrGeorgeK55
Copy link

  • Ctrl+Alt+Del0x054c

Could you explains how you get 0x054c ?

I want to send this: Ctrl + Win + l but I don't really understand how I can do that.

Edit: Bitmap is ?|?|?|?|WIN|CTRL|SHIFT|ALT

So far with the results of my tests, this is the table of modifier keys:

00 None
01 Ctrl
02 Shift
03 Ctrl + Shift
04 Alt
05 Ctrl + Alt
06 Shift + Alt
07 Ctrl + Shift + Alt

@MrGeorgeK55
Copy link

Also i Modified the code for a different project: Macropad 8 Keys based on CH552g, working with Keyboard keys. Consumer keys and macros up to 10 keys. im working to adapt it to this keyboard

@MrGeorgeK55
Copy link

Came with a proof of concept of macros up to 19 consecutive keys (without any modifier by now), also with more documentation.
Macropad-3-Keys-1-Knob

@biemster
Copy link
Owner Author

biemster commented May 6, 2024

nice work @MrGeorgeK55! I'll gave a closer look soon when time allows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants