kanata icon indicating copy to clipboard operation
kanata copied to clipboard

Bug: Unable to find a keyboard device

Open Jirubizu opened this issue 1 year ago • 2 comments

Requirements

Describe the bug

Unable to find a keyboard device

Relevant kanata config

➜ ~ cat .config/kanata/config.kbd ;; Caps to escape/control configuration for Kanata

(defsrc caps )

(defalias escctrl (tap-hold 100 100 esc lctl) )

(deflayer base @escctrl )

To Reproduce

  1. Went through the setup for linux
  2. Created the provided config.kbd
  3. Launched kanata while passing the config via $HOME/.cargo/bin/kanata --cfg ${HOME}/.config/kanata/config.kbd

Expected behavior

I expected kanata to launch and apply my configuration.

Kanata version

kanata 1.6.1

Debug logs

➜ ~ $HOME/.cargo/bin/kanata --cfg ${HOME}/.config/kanata/config.kbd 2024-08-10T17:46:12.07873201+01:00 [INFO] kanata v1.6.1 starting 2024-08-10T17:46:12.079083984+01:00 [INFO] process unmapped keys: false 2024-08-10T17:46:12.079121144+01:00 [INFO] NOTE: kanata was compiled to never allow cmd 2024-08-10T17:46:12.079337813+01:00 [INFO] config file is valid 2024-08-10T17:46:12.080430694+01:00 [INFO] Created device "/dev/input/event14" 2024-08-10T17:46:12.080801674+01: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-08-10T17:46:14.08116411+01:00 [INFO] entering the processing loop 2024-08-10T17:46:14.081442816+01:00 [INFO] entering the event loop 2024-08-10T17:46:14.081477702+01:00 [INFO] looking for devices in /dev/input 2024-08-10T17:46:14.08166238+01:00 [INFO] Init: catching only releases and sending immediately 2024-08-10T17:46:14.08177352+01:00 [ERROR] failed to open keyboard device(s): No keyboard devices were found

Press enter to exit 2024-08-10T17:46:14.652880246+01:00 [INFO] Starting kanata proper 2024-08-10T17:46:14.652931142+01: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. 2024-08-10T17:46:14.652943896+01:00 [ERROR] channel disconnected

Operating system

Linux

Additional context

➜ ~ ls /dev/input by-path event0 event1 event2 event3 event4 event5 event6 event7 event8 event9 event10 event11 event12 event13 mice mouse0 mouse1 mouse2 mouse3 ➜ ~ ls /dev/input/by-path pci-0000:00:14.3-platform-VPC2004:00-event platform-AMDI0010:00-mouse platform-AMDI0010:01-event-mouse platform-i8042-serio-0-event-kbd platform-AMDI0010:00-event-mouse platform-AMDI0010:01-event platform-AMDI0010:01-mouse platform-PNP0C14:01-event ➜ ~ ls /dev/*input /dev/uinput

/dev/input: by-path event0 event1 event2 event3 event4 event5 event6 event7 event8 event9 event10 event11 event12 event13 mice mouse0 mouse1 mouse2 mouse3

System Information

➜ ~ fastfetch jirubizu@pop-os

OS: Pop!_OS jammy 22.04 x86_64 Host: 82UD (Yoga 6 13ALC7) Kernel: Linux 6.9.3-76060903-generic Uptime: 1 day, 6 hours, 49 mins Packages: 2145 (dpkg), 7 (flatpak-user), 7 (snap) Shell: zsh 5.8.1 Display (IVO854A): 1920x1200 @ 60 Hz in 13″ DE: Regolith:GNOME-Flashback:GNOME WM: i3 (X11) Theme: Yaru [GTK3] Icons: Yaru [GTK3] Cursor: Adwaita Terminal: alacritty 0.14.0-dev Terminal Font: Hack Nerd Font Mono (12pt) CPU: AMD Ryzen 7 5700U (16) @ 4.37 GHz GPU: AMD Lucienne [Integrated] Memory: 5.95 GiB / 13.48 GiB (44%) Swap: 768.00 KiB / 17.48 GiB (0%) Disk (/): 78.52 GiB / 459.50 GiB (17%) - ext4 Disk (/recovery): 2.44 GiB / 3.99 GiB (61%) - vfat Local IP (wlo1): 192.168.1.160/24 Battery: 37% [Discharging] Locale: en_US.UTF-8

Jirubizu avatar Aug 11 '24 19:08 Jirubizu

Can you try if specificying devices explicitly via defcfg works?

jtroo avatar Aug 12 '24 17:08 jtroo

sorry i'm currently on holiday but i'll be back Saturday and ill have a go

Jirubizu avatar Aug 18 '24 06:08 Jirubizu

I've had the same issue running on Pop!_OS 22.04 LTS.

Can you try if specificying devices explicitly via defcfg works?

This and running kanata under sudo privileges worked for me. Thanks.

Woodshape avatar Nov 04 '24 14:11 Woodshape

I'm also having this issue, I believe. Is there a way to solve it without giving kanata root privileges? I'm trying to use the uinput setup as described in kanata/docs/setup-linux.md, but that doesn't appear to support directly specifying the device. Or at least, directly specifying the device gives permission errors, and not specifying it leads to kanata saying that it can't find any devices.

umbra3275 avatar Nov 07 '24 03:11 umbra3275

I'm also having this issue, I believe. Is there a way to solve it without giving kanata root privileges? I'm trying to use the uinput setup as described in kanata/docs/setup-linux.md, but that doesn't appear to support directly specifying the device. Or at least, directly specifying the device gives permission errors, and not specifying it leads to kanata saying that it can't find any devices.

I would be interested in that as well. It's just as you described for me: directly specifying the device I only managed to solve with sudo privileges and not specifying it as described in kanata/docs/setup-linux.md did not work ("No keyboard devices were found").

Woodshape avatar Nov 07 '24 08:11 Woodshape

Is the user you are executing kanata as part of the input group? Or otherwise has permission to read the relevant input device file?

jtroo avatar Nov 07 '24 08:11 jtroo

okay update: user was part of both input and uinput groups, and after rebooting, directly specifying linux-dev /dev/input/by-id/... in defcfg in the config file worked. not sure why a reboot was necessary, but glad it works, at least. sorry for the trouble!

umbra3275 avatar Nov 07 '24 12:11 umbra3275

okay update: user was part of both input and uinput groups, and after rebooting, directly specifying linux-dev /dev/input/by-id/... in defcfg in the config file worked. not sure why a reboot was necessary, but glad it works, at least. sorry for the trouble!

Can you show your config file?

greenm01 avatar Dec 01 '24 18:12 greenm01

okay update: user was part of both input and uinput groups, and after rebooting, directly specifying linux-dev /dev/input/by-id/... in defcfg in the config file worked. not sure why a reboot was necessary, but glad it works, at least. sorry for the trouble!

Can you show your config file?

;; Kanata config for capslock to esc+ctrl

(defcfg
    linux-dev /dev/input/by-id/usb-HS-HW308-_-_-01-05-_USB_Keyboard-event-kbd
    ;; linux-dev /dev/uinput
)

(defsrc
    caps
)

(defalias
    escctrl (tap-hold 200 200 esc lctrl)
)

(deflayer base
    @escctrl
)

umbra3275 avatar Dec 01 '24 18:12 umbra3275