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

Passthrough unknown key codes #898

Closed
wants to merge 3 commits into from

Conversation

jyn514
Copy link

@jyn514 jyn514 commented Dec 26, 2024

Currently, except for a few select mouse buttons, keyd does not support remapping keys with an event code higher than 256. This is reasonable and I don't propose changing it. However, right now it discards all keys that it doesn't know how to remap. That's not ideal and it prevents using keyd with arbitrary USB devices.

This does two things:

  • Passes through unknown event codes without modifying them.
  • Changes the internal representation of keycodes from uint8_t to uint16_t. Otherwise, we simply can't store the keycodes, they wrap around.

I tested this with a Forty4 GC201 game controller and Celeste through Steam; before this change it did not register any inputs, and afterwards it works fine.

cc #842 (comment), hopefully this addresses some of your concerns there.

src/unicode.c Outdated Show resolved Hide resolved
@jyn514 jyn514 force-pushed the unknown-key-fallback branch from 3ae45ea to c5cf045 Compare December 26, 2024 20:27
@jyn514 jyn514 force-pushed the unknown-key-fallback branch from c5cf045 to 88a468e Compare December 26, 2024 20:30
@Nekotekina
Copy link

I think you don't need to increase internal management arrays for simply passing them events through though.

@rvaiya
Copy link
Owner

rvaiya commented Dec 27, 2024

I am aware of this limitation and chose to make keyd codes a single byte. A large number of evdev codes are not actually used in practice and only exist for obscure or obsolete devices. This blows up the memory requirements for little gain.

If there is a specific problem you have related to this, please create a dedicated issue. The other PR you linked appears to be unrelated.

@rvaiya rvaiya closed this Dec 27, 2024
@workingjubilee
Copy link

...huh. Are gamepads and art tablets "obscure", or "just something rvaiya doesn't use"? Everyone I know who does even small amounts of digital drawn art has a tablet and stylus combo of some kind...

@Nekotekina
Copy link

I couldn't resist it and implemented it in my fork, see latest commit.
https://github.com/Nekotekina/keyd/tree/master
@jyn514 @workingjubilee Please test if you're interested. Remapping support needs some more work (filling constants).

@Nekotekina
Copy link

By the way, memory usage:
image
It's literally nothing, I also used some bitfields to pack structs better.

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

Successfully merging this pull request may close these issues.

4 participants