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: Doesn't seem to work on all connected keyboards #1268

Open
1 task done
Thulium-Drake opened this issue Oct 1, 2024 · 12 comments
Open
1 task done

Bug: Doesn't seem to work on all connected keyboards #1268

Thulium-Drake opened this issue Oct 1, 2024 · 12 comments
Assignees
Labels
linux Issue pertains to Linux only question Further information is requested

Comments

@Thulium-Drake
Copy link

Thulium-Drake commented Oct 1, 2024

Requirements

Describe the bug

Hi there,

I've been using kanata for a while now and I seem to be hitting a snag using it with multiple keyboard. When I run it and use the laptop's keyboard, it works just fine, but the same config does not seem to apply to any USB connected external keyboards.

I tried validating my config in the simulator and it agrees with me that it should work..

Also, the keyboard itself works just fine, kanata detects it during startup, but there's no logging at all for this device (whereas my bluetooth mouse and laptop keyboard do generate output)

Relevant kanata config

(defsrc
  caps
)

(defalias
  esccaps (tap-hold 100 100 esc caps)
)

(deflayer base
  @esccaps
)

To Reproduce

  1. Stick the above config in the sim, tap caps on both keyboards, it should show you that you pressed escape
  2. Load the config in your system
  3. Repeat the test, this time only the laptop keyboard is properly remapped
  4. Also note that the second keyboard does not generate logging information, while the laptop keyboard does.

Expected behavior

I want caps to be remapped regardless of the keyboard that provides the keypress.

Kanata version

kanata 1.6.1

Debug logs

2024-10-01T11:05:06.502304066+02:00 [INFO] kanata v1.6.1 starting
2024-10-01T11:05:06.502536814+02:00 [INFO] process unmapped keys: true
2024-10-01T11:05:06.50260907+02:00 [INFO] NOTE: kanata was compiled to never allow cmd
2024-10-01T11:05:06.502621995+02:00 [DEBUG] (1) kanata_parser::cfg::alloc: freeing allocations of length 0
2024-10-01T11:05:06.50278398+02:00 [INFO] config file is valid
2024-10-01T11:05:06.504159699+02:00 [INFO] Created device "/dev/input/event16"
2024-10-01T11:05:06.504295495+02:00 [INFO] Sleeping for 2s. Please release all keys and don't press additional ones. Run kanata with --help to see how understand more and how to disable this sleep.
2024-10-01T11:05:08.504422908+02:00 [INFO] entering the processing loop
2024-10-01T11:05:08.504672227+02:00 [INFO] entering the event loop
2024-10-01T11:05:08.504711792+02:00 [INFO] looking for devices in /dev/input
2024-10-01T11:05:08.505109821+02:00 [INFO] Init: catching only releases and sending immediately
2024-10-01T11:05:08.534100669+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Keyboard: name=AT Translated Set 2 keyboard physical_path=Some("isa0060/serio0/input0")
2024-10-01T11:05:08.534140765+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Keyboard: name=Keyed Up Labs ES-87 physical_path=Some("usb-0000:c1:00.3-2/input0") <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Non functioning keyboard
2024-10-01T11:05:08.561094278+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Keyboard: name=FRMW0004:00 32AC:0006 Consumer Control physical_path=Some("i2c-FRMW0004:00")
2024-10-01T11:05:08.581177549+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Mouse: name=PIXA3854:00 093A:0274 Mouse physical_path=Some("i2c-PIXA3854:00")
2024-10-01T11:05:08.58916324+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Keyboard/Mouse: name=DP-2 physical_path=Some("DP-2/input0")
2024-10-01T11:05:08.691099049+02:00 [DEBUG] (1) kanata_state_machine::oskbd::linux: Detected Mouse: name=Logitech MX Master 3S physical_path=Some("14:ac:60:29:8d:e4")
2024-10-01T11:05:08.701113438+02:00 [INFO] registering /dev/input/event2: "AT Translated Set 2 keyboard"
2024-10-01T11:05:08.723086647+02:00 [INFO] registering /dev/input/event3: "Keyed Up Labs ES-87"  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Non functioning keyboard
2024-10-01T11:05:08.750074535+02:00 [INFO] registering /dev/input/event6: "FRMW0004:00 32AC:0006 Consumer Control"
2024-10-01T11:05:08.765071493+02:00 [INFO] registering /dev/input/event8: "PIXA3854:00 093A:0274 Mouse"
2024-10-01T11:05:08.792102572+02:00 [INFO] registering /dev/input/event10: "DP-2"
2024-10-01T11:05:08.806128773+02:00 [INFO] registering /dev/input/event15: "Logitech MX Master 3S"
2024-10-01T11:05:09.03380184+02:00 [INFO] Starting kanata proper
2024-10-01T11:05:09.033818852+02:00 [INFO] You may forcefully exit kanata by pressing lctl+spc+esc at any time. These keys refer to defsrc input, meaning BEFORE kanata remaps keys.
######################################################## These presses were made on the laptop keyboard, the other keyboard does not generate logging at all.
2024-10-01T11:05:13.688186059+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Press }
2024-10-01T11:05:13.760744862+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Release }
2024-10-01T11:05:13.760768036+02:00 [DEBUG] (3) kanata_state_machine::kanata: key press     Escape
2024-10-01T11:05:13.760773276+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_ESC), value: 1 }
^[2024-10-01T11:05:13.766164453+02:00 [DEBUG] (3) kanata_state_machine::kanata: key release   Escape
2024-10-01T11:05:13.766187156+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_ESC), value: 0 }
2024-10-01T11:05:14.794191704+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Press }
2024-10-01T11:05:14.894659229+02:00 [DEBUG] (3) kanata_state_machine::kanata: key press     CapsLock
2024-10-01T11:05:14.894694695+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 1 }
2024-10-01T11:05:15.053171087+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Repeat }
2024-10-01T11:05:15.05320977+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_ESC, KEY_CAPSLOCK];
2024-10-01T11:05:15.053218626+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: repeat    CapsLock
2024-10-01T11:05:15.053224467+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 2 }
2024-10-01T11:05:15.088981692+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Repeat }
2024-10-01T11:05:15.08902841+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_ESC, KEY_CAPSLOCK];
2024-10-01T11:05:15.089037457+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: repeat    CapsLock
2024-10-01T11:05:15.089043408+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 2 }
2024-10-01T11:05:15.125293529+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Repeat }
2024-10-01T11:05:15.125337462+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_ESC, KEY_CAPSLOCK];
2024-10-01T11:05:15.125346268+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: repeat    CapsLock
2024-10-01T11:05:15.12535228+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 2 }
2024-10-01T11:05:15.159994264+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Repeat }
2024-10-01T11:05:15.160049959+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_ESC, KEY_CAPSLOCK];
2024-10-01T11:05:15.160085837+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: repeat    CapsLock
2024-10-01T11:05:15.160091938+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 2 }
2024-10-01T11:05:15.19487051+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Repeat }
2024-10-01T11:05:15.194926476+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_ESC, KEY_CAPSLOCK];
2024-10-01T11:05:15.194936244+02:00 [DEBUG] (3) kanata_state_machine::kanata::key_repeat: repeat    CapsLock
2024-10-01T11:05:15.194942836+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 2 }
2024-10-01T11:05:15.207880368+02:00 [DEBUG] (3) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_CAPSLOCK, value: Release }
2024-10-01T11:05:15.207925934+02:00 [DEBUG] (3) kanata_state_machine::kanata: key release   CapsLock
2024-10-01T11:05:15.207933939+02:00 [DEBUG] (3) kanata_state_machine::oskbd::linux: send to uinput: InputEvent { time: SystemTime { tv_sec: 0, tv_nsec: 0 }, kind: Key(KEY_CAPSLOCK), value: 0 }

Operating system

Fedora 40, running wayland

Additional context

No response

@Thulium-Drake Thulium-Drake added the bug Something isn't working label Oct 1, 2024
@jtroo
Copy link
Owner

jtroo commented Oct 2, 2024

For whatever reason your usb keyboard may not be getting auto-detected.

You can try using the linux- device defcfg options to force kanata to find all desired devices.

@Thulium-Drake
Copy link
Author

Thulium-Drake commented Oct 2, 2024

Thanks for the help! Unfortunately it doesn't work, the init logs show the following, I've marked the keyboard that doesn't work but is included:

2024-10-02T08:30:24.16669862+02:00 [INFO] kanata v1.6.1 starting
2024-10-02T08:30:24.166937721+02:00 [INFO] process unmapped keys: false
2024-10-02T08:30:24.166982736+02:00 [INFO] NOTE: kanata was compiled to never allow cmd
2024-10-02T08:30:24.167191139+02:00 [INFO] config file is valid
2024-10-02T08:30:24.168546655+02:00 [INFO] Created device "/dev/input/event16"
2024-10-02T08:30:24.168689695+02:00 [INFO] Sleeping for 2s. Please release all keys and don't press additional ones. Run kanata with --help to see how understand more and how to disable this sleep.
2024-10-02T08:30:26.16878176+02:00 [INFO] entering the processing loop
2024-10-02T08:30:26.168868905+02:00 [INFO] entering the event loop
2024-10-02T08:30:26.168880086+02:00 [INFO] looking for devices in /dev/input
2024-10-02T08:30:26.168989763+02:00 [INFO] Init: catching only releases and sending immediately
2024-10-02T08:30:26.186102087+02:00 [INFO] device [/dev/input/event2:AT Translated Set 2 keyboard] is included
2024-10-02T08:30:26.186128126+02:00 [INFO] device [/dev/input/event3:Keyed Up Labs ES-87] is included <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This is the keyboard, but it doesn't map it's keys.
2024-10-02T08:30:26.212105521+02:00 [INFO] device [/dev/input/event6:FRMW0004:00 32AC:0006 Consumer Control] is ignored
2024-10-02T08:30:26.238098835+02:00 [INFO] device [/dev/input/event8:PIXA3854:00 093A:0274 Mouse] is ignored
2024-10-02T08:30:26.25509998+02:00 [INFO] device [/dev/input/event10:DP-2] is ignored
2024-10-02T08:30:26.371150625+02:00 [INFO] device [/dev/input/event15:Logitech MX Master 3S] is ignored
2024-10-02T08:30:26.39515053+02:00 [INFO] registering /dev/input/event2: "AT Translated Set 2 keyboard"
2024-10-02T08:30:26.435100798+02:00 [INFO] registering /dev/input/event3: "Keyed Up Labs ES-87"  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2024-10-02T08:30:26.698295292+02:00 [INFO] Starting kanata proper
2024-10-02T08:30:26.698313536+02:00 [INFO] You may forcefully exit kanata by pressing lctl+spc+esc at any time. These keys refer to defsrc input, meaning BEFORE kanata remaps keys.

I also checked with wev to see if the caps is mapped to a different ID or so, but that doesn't seem to be the case.

[14:     wl_keyboard] key: serial: 43928; time: 78430507; key: 66; state: 1 (pressed)
                      sym: Caps_Lock    (65509), utf8: ''
[14:     wl_keyboard] modifiers: serial: 43929; group: 0
                      depressed: 00000002: Lock
                      latched: 00000000
                      locked: 00000002: Lock
[14:     wl_keyboard] key: serial: 43930; time: 78430603; key: 66; state: 0 (released)
                      sym: Caps_Lock    (65509), utf8: ''
[14:     wl_keyboard] modifiers: serial: 43931; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000002: Lock
[14:     wl_keyboard] key: serial: 43932; time: 78432466; key: 66; state: 1 (pressed)
                      sym: Caps_Lock    (65509), utf8: ''
[14:     wl_keyboard] modifiers: serial: 43933; group: 0
                      depressed: 00000002: Lock
                      latched: 00000000
                      locked: 00000002: Lock
[14:     wl_keyboard] key: serial: 43934; time: 78432531; key: 66; state: 0 (released)
                      sym: Caps_Lock    (65509), utf8: ''
[14:     wl_keyboard] modifiers: serial: 43935; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000

I pressed caps on both keyboards once, but there's no difference, except timing and the serial for the keypress itself.

@Thulium-Drake
Copy link
Author

It seems isolated to this one keyboard, at work I'm using a KeyCron, which remaps just fine :-)

@jtroo
Copy link
Owner

jtroo commented Oct 5, 2024

How strange. Perhaps the outputs are actually coming from a different device that doesn't have the expected name? You can try using evtest on every single input device, one at a time, while testing the non-functional keyboard's keys to see which device shows events.

@jtroo jtroo added question Further information is requested linux Issue pertains to Linux only labels Oct 5, 2024
@Thulium-Drake
Copy link
Author

Thulium-Drake commented Oct 12, 2024

I've added the output below! :-) and I've seen something really odd (for me, I don't know if it does make sense in keyboard world)

The non-functional keyboard seems to be split in 2 keyboards:

$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:	Lid Switch
/dev/input/event1:	Power Button
/dev/input/event10:	Keyed Up Labs ES-87 Keyboard
/dev/input/event11:	HD-Audio Generic HDMI/DP,pcm=3
/dev/input/event12:	HD-Audio Generic HDMI/DP,pcm=7
/dev/input/event13:	HD-Audio Generic HDMI/DP,pcm=8
/dev/input/event14:	HD-Audio Generic Headphone
/dev/input/event15:	Logitech MX Master 3S
/dev/input/event2:	AT Translated Set 2 keyboard
/dev/input/event3:	FRMW0004:00 32AC:0006 Wireless Radio Control
/dev/input/event4:	FRMW0004:00 32AC:0006 Consumer Control
/dev/input/event5:	Video Bus
/dev/input/event6:	PIXA3854:00 093A:0274 Mouse
/dev/input/event7:	PIXA3854:00 093A:0274 Touchpad
/dev/input/event8:	DP-2
/dev/input/event9:	Keyed Up Labs ES-87
Select the device event number [0-15]:

So it seems some of the keys are on input 10, see below for the ones evtest detected (and what happens when I press capslock:

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x4d9 product 0xa0ce version 0x110
Input device name: "Keyed Up Labs ES-87 Keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 40 (KEY_APOSTROPHE)
    Event code 41 (KEY_GRAVE)
    Event code 51 (KEY_COMMA)
    Event code 52 (KEY_DOT)
    Event code 53 (KEY_SLASH)
    Event code 55 (KEY_KPASTERISK)
    Event code 58 (KEY_CAPSLOCK)
    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 69 (KEY_NUMLOCK)
    Event code 70 (KEY_SCROLLLOCK)
    Event code 71 (KEY_KP7)
    Event code 72 (KEY_KP8)
    Event code 73 (KEY_KP9)
    Event code 74 (KEY_KPMINUS)
    Event code 75 (KEY_KP4)
    Event code 76 (KEY_KP5)
    Event code 77 (KEY_KP6)
    Event code 78 (KEY_KPPLUS)
    Event code 79 (KEY_KP1)
    Event code 80 (KEY_KP2)
    Event code 81 (KEY_KP3)
    Event code 82 (KEY_KP0)
    Event code 83 (KEY_KPDOT)
    Event code 87 (KEY_F11)
    Event code 88 (KEY_F12)
    Event code 96 (KEY_KPENTER)
    Event code 98 (KEY_KPSLASH)
    Event code 99 (KEY_SYSRQ)
    Event code 102 (KEY_HOME)
    Event code 103 (KEY_UP)
    Event code 104 (KEY_PAGEUP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 107 (KEY_END)
    Event code 108 (KEY_DOWN)
    Event code 109 (KEY_PAGEDOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
    Event code 117 (KEY_KPEQUAL)
    Event code 119 (KEY_PAUSE)
    Event code 127 (KEY_COMPOSE)
    Event code 161 (KEY_EJECTCD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 183 (KEY_F13)
    Event code 184 (KEY_F14)
    Event code 185 (KEY_F15)
    Event code 186 (KEY_F16)
    Event code 187 (KEY_F17)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
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)
Event: time 1728730090.577084, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1728730090.577084, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
Event: time 1728730090.577084, -------------- SYN_REPORT ------------
Event: time 1728730090.672453, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1728730090.672453, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 0
Event: time 1728730090.672453, -------------- SYN_REPORT ------------
Event: time 1728730094.296507, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1728730094.296507, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
Event: time 1728730094.296507, -------------- SYN_REPORT ------------
Event: time 1728730094.400509, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1728730094.400509, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 0
Event: time 1728730094.400509, -------------- SYN_REPORT ------------

And this is the same output for the other 'half' of the keyboard (device 9):

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x4d9 product 0xa0ce version 0x110
Input device name: "Keyed Up Labs ES-87"
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 12 (KEY_MINUS)
    Event code 13 (KEY_EQUAL)
    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 42 (KEY_LEFTSHIFT)
    Event code 43 (KEY_BACKSLASH)
    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 54 (KEY_RIGHTSHIFT)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 97 (KEY_RIGHTCTRL)
    Event code 100 (KEY_RIGHTALT)
    Event code 125 (KEY_LEFTMETA)
    Event code 126 (KEY_RIGHTMETA)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 17 (EV_LED)
    Event code 0 (LED_NUML) state 0
    Event code 1 (LED_CAPSL) state 0
    Event code 2 (LED_SCROLLL) state 0
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)
Event: time 1728730174.281204, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
Event: time 1728730174.281204, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1728730174.281204, -------------- SYN_REPORT ------------
Event: time 1728730176.386232, type 17 (EV_LED), code 1 (LED_CAPSL), value 1
Event: time 1728730176.386232, -------------- SYN_REPORT ------------
Event: time 1728730177.049230, type 17 (EV_LED), code 1 (LED_CAPSL), value 0
Event: time 1728730177.049230, -------------- SYN_REPORT ------------

@jtroo
Copy link
Owner

jtroo commented Oct 14, 2024

Yea some keyboards are split into multiple input devices at the kernel level. If you tell Kanata to capture both Keyed Up Labs ES-87 and Keyed Up Labs ES-87 Keyboard does the keyboard work as expected?

@jtroo jtroo removed the bug Something isn't working label Oct 14, 2024
@Thulium-Drake
Copy link
Author

Thulium-Drake commented Dec 2, 2024

Sorry for the delay... I haven't used that keyboard in a while (busy at home with other stuff...)

No, it still doesn't work as expected. I had the default config of capturing all keyboards and this has worked for most other keyboards:

  • Cherry MX 1.0
  • Keychron C1
  • Framework laptop keyboard

I haven't tried the 'standard' membrane keyboards yet, but I never encounter them :-)

I did try a configuration where I explicitly told kanata to use the two Keyed-Up devices to no avail.

Could this happen because the remapped key is on the other device? From what the evtest output told me, I'm remapping capslock on input device 9 to backspace on device 10?

@jakubkaczor
Copy link
Contributor

jakubkaczor commented Dec 16, 2024

I have a similar issue. My keyboard is also split into multiple input files. Fortunately, according to evtest, capslock and escape are assigned to the same file. Despite, kanata doesn't automatically register this file. I tried linux-device-detect-mode any, but it didn't help. Only registering the specific input file with linux-dev worked for me.

I don't know how the detection and classification of keyboards is implemented, but let me know if I could provide you with some properties of the keyboard, so it could be improved.

@jtroo
Copy link
Owner

jtroo commented Dec 16, 2024

There is an by-name detection change in the latest main/prerelease if you could test that to see if it fixes the issue

@jakubkaczor
Copy link
Contributor

jakubkaczor commented Dec 16, 2024

Unfortunately, main branch gives the same results, but I learned why. (_, DeviceType::Other) is matched before (DeviceDetectMode::Any, _)1. Thus, even if I set linux-device-detect-mode any, my device isn't registered, because it is considered neither a keyboard nor mouse. It is not considered a keyboard, because the criterion is containing the enter key2. This isn't the case, because the keyboard is split into multiple device files.

I would expect DeviceDetectMode::Any case be handled before any other, and also the criterion for being a keyboard to be more allowing. Perhaps containing any key from some wider, predefined set of keys could be checked?

Footnotes

  1. https://github.com/jtroo/kanata/blob/80189bd228030c8862d1a51357ccf3d580f5bb41/src/oskbd/linux.rs#L276)

  2. https://github.com/jtroo/kanata/blob/80189bd228030c8862d1a51357ccf3d580f5bb41/src/oskbd/linux.rs#L264C42-L264C60

@jakubkaczor
Copy link
Contributor

jakubkaczor commented Dec 16, 2024

Swapping the first, mentioned match cases, and appending || keys.contains(Key::KEY_ESC) in the "is keyboard" check solves both issues I mentioned. I can make a PR, but I am not sure if you don't want to rethink or redesign the criterion for being a keyboard anyway. You are the boss. Personally, I would check every key that can be found on a full keyboard, as it is done only once for each device.

@jtroo
Copy link
Owner

jtroo commented Dec 16, 2024

Sounds like a good PR to me, thanks for the investigation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Issue pertains to Linux only question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants