Navigation Menu

Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Keyboard: Don't skip NONUS_POUND and CLEAR #23

Merged
merged 1 commit into from Mar 9, 2018
Merged

Keyboard: Don't skip NONUS_POUND and CLEAR #23

merged 1 commit into from Mar 9, 2018

Conversation

algernon
Copy link

To be able to send NONUS_POUND and CLEAR keycodes, we need our report bitmap to support them, and not mask them over with constants. These were originally masked due to bugs in the Linux kernel, which allegedly resulted in double presses when these codes were in the report. If they are not in the report, they should not cause issues, and one may want to use the codes anyway.

Therefore, this patch removes this mask, and only the first four bits remain masked.

Fixes keyboardio/Kaleidoscope#273.

@algernon
Copy link
Author

Note to self: push my findings from my worklog into the commit message.

To be able to send NONUS_POUND and CLEAR keycodes, we need our report bitmap to
support them, and not mask them over with constants. These were originally
masked due to bugs in the Linux kernel: it treats NONUS_POUND the same as
BACKSLASH, and CLEAR the same as DELETE. There is no way for userland to
distinguish the two under Linux. But this is a linux-specific issue, one that is
not relevant when neither NONUS_POUND or CLEAR appear on the keymap. Linux will
happily accept a descriptor that does not mask this out (even ancient versions,
going back 13 years). It will not double-press if these appear in the report. At
worst, repeat will kick in faster if both BACKSLASH and NONUS_POUND are held at
the same time. However, other OSes may - and do - work differently, and some of
them handle NONUS_POUND separately from BACKSLASH.

Because not masking out these keys in the report causes no issues under
Linux (the only reason for the mask) unless the keys are in the report, and even
then, the issue is not critical, we should not punish other operating systems.
Linux has had this issue for at least 13 years (7 for CLEAR/DELETE). Changing it
would require changes to the kernel and a whole lot of userland too. I do not
see that happening in my lifetime, and that's even more reason for not waiting
for Linux to get rid of the bug before changing the descriptors.

Therefore, this patch removes the mask, and only the first four bits remain
masked. Therefore, operating systems that can treat NONUS_POUND and CLEAR
separately from BACKSLASH and DELETE will be able to do that, and Linux will not
be severely impacted either. And we also save a few bytes.

Fixes keyboardio/Kaleidoscope#273.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
@algernon
Copy link
Author

Pushed an updated commit, with much more reasoning within it.

@algernon
Copy link
Author

algernon commented Mar 9, 2018

@obra Do you have any concerns? This fixes a legitimate issue for non-Linux users (especially international users, where NonUSPound is often used for localized keymaps), and as far as I was able to check, causes no issues under Linux either.

Would be great to have this in, so people trying their hands on localized layouts will be able to use NonUSPound.

@obra
Copy link
Member

obra commented Mar 9, 2018

Sure, I'm willing to try it.

@obra obra merged commit da81cba into keyboardio:master Mar 9, 2018
@algernon algernon deleted the f/dont-skip-nonus-pound branch March 9, 2018 19:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants