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

Bug: Some keyboards may not be recognized #261

Closed
DocSunset opened this issue Jul 19, 2022 · 10 comments
Closed

Bug: Some keyboards may not be recognized #261

DocSunset opened this issue Jul 19, 2022 · 10 comments
Labels

Comments

@DocSunset
Copy link

I have a pinephone with the keyboard case accessory (I do not recommend either) which I wished to use with keyd. evtest identifies the devices as follows:

Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "PinePhone Keyboard"

/etc/keyd/default.conf:

[ids]

0:0

[main]

/ = overload(shift, /)

However, when keyd is launched as sudo keyd -m, it does not report adding the pinephone keyboard.

Having examined the source code, my hypothesis is that the issue lies in the way keyboards are detected. I don't fully understand the code in question, but looking at resolve_device_type, I suspect that the absence of many common keys (e.g. hyphen, equals, backslash) may be causing the keyboard not to be recognized? If my hypothesis is correct, this could conceivably affect other keyboards. Or perhaps I'm barking up the wrong tree... What exactly is the interpretation of the variable mask? If I understand correctly, it is a bit-mask related to the key event codes that the device may produce?

Thanks for this splendid project!

@rvaiya
Copy link
Owner

rvaiya commented Jul 19, 2022

Can you please post the full output of sudo keyd -m?

@DocSunset
Copy link
Author

device added: 0fac:1ade (keyd virtual pointer)
device added: 0fac:0ade (keyd virtual device)
device added: 0fac:0ade (keyd virtual device)

Or if I systemctl stop keyd first:

device added: 0fac:1ade (keyd virtual pointer)
device added: 0fac:0ade (keyd virtual device)

@rvaiya
Copy link
Owner

rvaiya commented Jul 20, 2022

Thanks.

Having examined the source code, my hypothesis is that the issue lies in the way keyboards are detected.

Your hypothesis is likely correct.

What exactly is the interpretation of the variable mask? If I understand correctly, it is a bit-mask related to the key event codes that the device may produce?

Indeed. There are some non keyboard things which can produce key events (e.g programmable mice). The point of the check was originally to try and segregate 'real keyboards' from such devices, but it invariably produces some false negatives and may not be strictly necessary anymore as a result of changes to the input logic.

Can you pull the latest version and post the output of sudo KEYD_DEBUG=2 keyd -m?

@DocSunset
Copy link
Author

Here you go!

$ sudo KEYD_DEBUG=2 ./keyd -m
DEBUG: src/keyd.c:553: Debug mode activated
DEBUG: src/device.c:91: device type of /dev/input/event7 (PinePhone Headset Jack): 0
DEBUG: src/device.c:91: device type of /dev/input/event5 (gpio-vibrator): 0
DEBUG: src/device.c:91: device type of /dev/input/event4 (1c21800.lradc): 0
DEBUG: src/device.c:91: device type of /dev/input/event3 (gpio-keys): 0
DEBUG: src/device.c:91: device type of /dev/input/event2 (PinePhone Keyboard): 0
DEBUG: src/device.c:91: device type of /dev/input/event0 (axp20x-pek): 0
DEBUG: src/device.c:91: device type of /dev/input/event1 (Goodix Capacitive TouchScreen): 0

@rvaiya
Copy link
Owner

rvaiya commented Jul 24, 2022

Can you post the full output of evtest /dev/input/event2 (you may need to install evtest)?

@DocSunset
Copy link
Author

👍

Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "PinePhone Keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
    Event code 8 (KEY_7)
    Event code 9 (KEY_8)
    Event code 10 (KEY_9)
    Event code 11 (KEY_0)
    Event code 14 (KEY_BACKSPACE)
    Event code 15 (KEY_TAB)
    Event code 16 (KEY_Q)
    Event code 17 (KEY_W)
    Event code 18 (KEY_E)
    Event code 19 (KEY_R)
    Event code 20 (KEY_T)
    Event code 21 (KEY_Y)
    Event code 22 (KEY_U)
    Event code 23 (KEY_I)
    Event code 24 (KEY_O)
    Event code 25 (KEY_P)
    Event code 26 (KEY_LEFTBRACE)
    Event code 27 (KEY_RIGHTBRACE)
    Event code 28 (KEY_ENTER)
    Event code 29 (KEY_LEFTCTRL)
    Event code 30 (KEY_A)
    Event code 31 (KEY_S)
    Event code 32 (KEY_D)
    Event code 33 (KEY_F)
    Event code 34 (KEY_G)
    Event code 35 (KEY_H)
    Event code 36 (KEY_J)
    Event code 37 (KEY_K)
    Event code 38 (KEY_L)
    Event code 39 (KEY_SEMICOLON)
    Event code 40 (KEY_APOSTROPHE)
    Event code 42 (KEY_LEFTSHIFT)
    Event code 44 (KEY_Z)
    Event code 45 (KEY_X)
    Event code 46 (KEY_C)
    Event code 47 (KEY_V)
    Event code 48 (KEY_B)
    Event code 49 (KEY_N)
    Event code 50 (KEY_M)
    Event code 51 (KEY_COMMA)
    Event code 52 (KEY_DOT)
    Event code 53 (KEY_SLASH)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 59 (KEY_F1)
    Event code 60 (KEY_F2)
    Event code 61 (KEY_F3)
    Event code 62 (KEY_F4)
    Event code 63 (KEY_F5)
    Event code 64 (KEY_F6)
    Event code 65 (KEY_F7)
    Event code 66 (KEY_F8)
    Event code 67 (KEY_F9)
    Event code 68 (KEY_F10)
    Event code 99 (KEY_SYSRQ)
    Event code 100 (KEY_RIGHTALT)
    Event code 102 (KEY_HOME)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 107 (KEY_END)
    Event code 108 (KEY_DOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 125 (KEY_LEFTMETA)
    Event code 464 (KEY_FN)
    Event code 465 (KEY_FN_ESC)
  Event type 4 (EV_MSC)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)
^C

rvaiya added a commit that referenced this issue Aug 3, 2022
Some devices don't have exotic keys like minus :/, so we simply
check for the presence of alphanumeric keys.
@rvaiya
Copy link
Owner

rvaiya commented Aug 3, 2022

Sorry, I had earmarked this and then promptly forgot about it :P. It looks like your keyboard is missing some keys (notably a minus key). I've simplified the check so it should work now. Can you give the latest commit a try?

@rvaiya rvaiya added bug Something isn't working hardware detection labels Aug 3, 2022
@DocSunset
Copy link
Author

Awesome! I will give this a try ASAP and get back to you.

@rvaiya
Copy link
Owner

rvaiya commented Aug 22, 2022

Any update?

@rvaiya
Copy link
Owner

rvaiya commented Sep 5, 2022

Closing due to inactivity.

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

No branches or pull requests

2 participants