Open jthaman opened 2 years ago
Hi @jthaman! The driver is designed to start automatically when you plug a supported kinesis keyboard into the computer (or when the computer starts with one already plugged in). It uses udev
rules to detect the added hardware, and udev
asks systemd
to start the appropriate service. I believe you should see that the driver is running with systemctl status kfreestyle2d
when the keyboard is plugged in. If that's not the case, I'm happy to help troubleshoot.
Here is the output of that command, while the freestyle 2 keyboard is plugged in.
× kfreestyle2d.service - Userspace driver for Kinesis Freestyle 2 Keyboard
Loaded: loaded (/etc/systemd/system/kfreestyle2d.service; static)
Active: failed (Result: exit-code) since Tue 2021-11-02 19:07:27 EDT; 50min ago
Process: 663 ExecStart=/usr/local/share/kfreestyle2d/kfreestyle2d /dev/kfreestyle2-fn (code=exited, status=4)
Main PID: 663 (code=exited, status=4)
CPU: 1ms
Nov 02 19:07:27 arch-desktop systemd[1]: Started Userspace driver for Kinesis Freestyle 2 Keyboard.
Nov 02 19:07:27 arch-desktop kfreestyle2d[663]: Unable to open uinput: Permission denied
Nov 02 19:07:27 arch-desktop kfreestyle2d[663]: Unofficial kinesis userspace driver
Nov 02 19:07:27 arch-desktop systemd[1]: kfreestyle2d.service: Main process exited, code=exited, status=4/NOPERMISSION
Nov 02 19:07:27 arch-desktop systemd[1]: kfreestyle2d.service: Failed with result 'exit-code'.
~
@jthaman Huh. So this suggests either that you don't have the uinput
kernel module loaded, the udev rules that we provide to modify the permissions on /dev/uinput
aren't working, or that the driver is running as the wrong user/group.
Can you share the output of:
cat /etc/modules
ls -l /dev/uinput
lsmod | grep uinput
Sure,
cat /etc/modules:
uinput
ls -l /dev/uinput
crw-rw----+ 1 root root 10, 223 Nov 2 19:07 /dev/uinput
lsmod | grep uinput
< no output for this one>
Okay, so this tells me a few things:
/etc/modules
. It didn't load the uinput
kernel module at boot, which is why lsmod | grep uinput
displays nothing. We can force uinput
to be loaded with modprobe uinput
, but without the permission changes I discuss next that won't help.udev
rules that we install to change the permissions of /dev/uinput
are not being applied. It should be owned by the input
group according to this rule: https://github.com/whereswaldon/kfreestyle2d/blob/master/99-kfreestyle2d.rules.template#L2
Can you check if the udev
rules are installed? They should be in /etc/udev/rules.d/99-kfreestyle2d.rules
. Maybe just paste that file here?
Sorry, this got lost in the shuffle a few weeks ago. Here is the output of the requested .rules file. I'm using Arch linux, if that matters.
KERNEL=="uinput", GROUP="uinput", MODE:="0660"
# Identify Kinesis products
KERNEL=="hidraw[0-9]*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="058f", ATTRS{idProduct}=="9410", ENV{KINESIS_PRODUCT}="freestyle2"
# Make Freestyle2 Fn keys readable
ENV{KINESIS_PRODUCT}=="freestyle2", KERNEL=="hidraw[0-9]*", SUBSYSTEM=="hidraw", ATTRS{bInterfaceNumber}=="01", MODE:="0660", GROUP="uinput", SYMLINK="kfreestyle2-fn", RUN+="/bin/systemctl --no-block start kfreestyle2d.service"
Okay @jthaman, these rules look correct to me. I thought Arch would respect /etc/modules
, but it seems like you may need to create a config file for Arch to properly load uinput
.
Given that you have the right rules, I wonder whether the uinput
group exists on your computer. If it doesn't, simply create a system group by that name and try again.
If that still doesn't work, I'm quite confused. I'd recommend trying some of the techniques I used here when I was figuring all of this out in the first place. I'm happy to consult as you go, but I don't have a good sense of what's wrong.
Hello there. Thanks for a driver!
I also had some issues with running driver on Arch Linux.
uinput
moduleWhat I tried:
/etc/modprobe.d
I've created file /etc/modprobe.d/uinput.conf
with following contents:uinput
It didn't work for me, mkinitcpio -P
output was:
libkmod: kmod_config_parse: /etc/modprobe.d/uinput.conf line 1: ignoring bad line starting with 'uinput'
Add uinput
to /etc/modules
file. Didn't work silently
Create a systemd service, that will load necessary module -- worked for me.
Here's a config for service (I called it /etc/systemd/system/uinput-load.service
):
[Unit]
Description=Load uinput kernel module
[Service]
Type=oneshot
ExecStart=/sbin/modprobe uinput
[Install]
WantedBy=sysinit.target
Run systemctl enable uinput-load
Make kfreestyle2d
systemd service run after the module loading service.
Add line to the /etc/systemd/system/kfreestyle2d.service
to the [Unit]
section:
After=uinput-load.service
I can't say if it helped me.
I see that it is partially the same as /etc/udev/rules.d/99-kfreestyle2d.rules
.
But still, it looks like a part of my solution 😅
Create udev
rule at /etc/udev/rules.d/99-uinput.rules
With following content:
KERNEL=="uinput", MODE="0660", GROUP="uinput"
The group should be the same as in /etc/systemd/system/kfreestyle2d.service
@tatarianBarbarian Would you be interested in opening a PR to add the extra services to the repo? They ought to be portable.
@whereswaldon
Sure. At least I'll try 😅
There's still a lingering permissions issue on Arch Linux related to ACLs on /dev/uinput
. I discuss it some here. I'm uncertain what the best, most portable solution is.
However, I tried it again just now (after a reboot) and the issue seems to have self-resolved. I am on Arch on this machine, so perhaps it just takes a reboot?
Maybe I'm missing something, but I downloaded the ZIP, cd'd into it, and gave it a
sudo make install
. I restarted my computer, and can't tell that anything is different. I thought I needed to enable the systemd unit, but I got a message back from systemd saying that this isn't the case. How does one verify if the driver is installed and running?Thanks for any help.