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

Key_NonUSPound doesn't print anything #273

Closed
mattvenn opened this issue Dec 20, 2017 · 15 comments
Closed

Key_NonUSPound doesn't print anything #273

mattvenn opened this issue Dec 20, 2017 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@mattvenn
Copy link
Contributor

I want to print the # and ~ characters. xev shows nothing when the key is pressed.

@gedankenexperimenter
Copy link
Collaborator

Just in case: that should be Key_NonUsPound – the s is not a capital.

@gedankenexperimenter
Copy link
Collaborator

I can confirm that Key_NonUsPound is also non-functional on macOS.

@algernon algernon added the bug Something isn't working label Dec 20, 2017
@algernon algernon self-assigned this Dec 20, 2017
@gedankenexperimenter
Copy link
Collaborator

Could this be an OS keymap issue? The key in question is between Z & shift on some keyboards, isn't it?

@algernon
Copy link
Contributor

@mattvenn said it works on another keyboard of his. I'm now verifying if it is in the report, then will check OS keymap. That was my first suspicion too, but if it works on another board...?

@algernon
Copy link
Contributor

I can verify that the key correctly ends up in the report, so this is likely an OS-side issue.

@algernon
Copy link
Contributor

Ooon the other hand, the same code on the ErgoDox EZ works, with the same OS keymap. So perhaps there IS something on the firmware side that we can do.

I suspect HID Descriptors.

@algernon
Copy link
Contributor

Mind you, using an US QWERTY OS layout, it comes across as \. Using US International, it becomes #. However, \ becomes # on US International too.

@obra
Copy link
Member

obra commented Dec 20, 2017 via email

@algernon
Copy link
Contributor

  // Padding 3 bits
  // To skip HID_KEYBOARD_NON_US_POUND_AND_TILDE, which causes
  // Linux to choke on our driver.

From KeyboardioHID.

I'll have a go at removing this, and merging the usages. That should fix this issue, and make our descriptor a few bytes smaller too.

@obra
Copy link
Member

obra commented Dec 20, 2017 via email

@algernon
Copy link
Contributor

I tested Linux 2.6.32, 3.something, 4.9, and they all work the same way: they detect the keyboard, everything works. NON_US_POUND will be translated to BACKSLASH though, by the kernel (as far as I see - skipping the kernel drivers shows them as separate bits in the report, but evemu-record shows both as the same code, and evemu-describe only shows BACKSLASH).

So I couldn't make the kernel choke on it, nor was I able to trigger double presses or anything like it.

These issues would only occur if the keys in question were on the keymap. The Model01 factory firmware has neither. So I think not skipping NONUS_POUND and CLEAR are safe.

But to be sure, I'll look into the linux kernel too.

@mattvenn
Copy link
Contributor Author

mattvenn commented Dec 21, 2017 via email

@algernon
Copy link
Contributor

keyboardio/KeyboardioHID#23 should have a "fix" then. Mind you, Linux will treat NonUS_Pound as Backslash, so you won't have an additional #/~ key :( You'll just have two backslashes.

This is something deeply rooted in the kernel, something that has been there for at least 13 years. Changing it to treat the two separately would require change to the kernel, and everything above it to support it. The chances of that happening in my lifetime are slim to none, I believe.

@mattvenn
Copy link
Contributor Author

My \ key now is printing #. Maybe that happened as a result of keyboardio/KeyboardioHID#23. So then I used a key with no assigned keycode and used xmodmap to map it to . So now I have both!

@algernon
Copy link
Contributor

I think we can safely close this now.

@algernon algernon removed the pending label Jan 30, 2018
obra pushed a commit that referenced this issue Dec 14, 2023
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 #273.

Signed-off-by: Gergely Nagy <[email protected]>
obra pushed a commit that referenced this issue Dec 14, 2023
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 #273.

Signed-off-by: Gergely Nagy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants