You are not logged in.

#1 2022-01-13 03:14:23

minhduc0711
Member
Registered: 2021-05-04
Posts: 13

[SOLVED] Proper way to allow access to /dev/input/event*

From https://wiki.archlinux.org/title/Users_ … emd_groups

Before arch migrated to systemd, users had to be manually added to these groups in order to be able to access the corresponding devices. This way has been deprecated in favour of udev marking the devices with a uaccess tag and logind assigning the permissions to users dynamically via ACLs according to which session is currently active. Note that the session must not be broken for this to work (see General troubleshooting#Session permissions to check it).

How I understand it is that I don't have to do anything in order to access the input devices. I have already done the session broken check. Nevertheless, I still get a permission denied error when trying to access a device:

$ cat /dev/input/event0
cat: /dev/input/event0: Permission denied 

So eventually I still had to add myself to the "input" group. What is the correct way to give myself access to these devices?

Last edited by minhduc0711 (2022-01-15 15:55:36)

Offline

#2 2022-01-14 19:32:08

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [SOLVED] Proper way to allow access to /dev/input/event*

minhduc0711 wrote:
$ cat /dev/input/event0
cat: /dev/input/event0: Permission denied

Why are you attempting to access those nodes? What are you trying to do?

minhduc0711 wrote:

So eventually I still had to add myself to the "input" group.

What was not working when your user was not in the input group?

See also https://xyproblem.info/

Offline

#3 2022-01-15 13:36:12

minhduc0711
Member
Registered: 2021-05-04
Posts: 13

Re: [SOLVED] Proper way to allow access to /dev/input/event*

Sorry for being unclear.

I use way-displays to manage my display configuration. It needs access to /dev/input/event* nodes in order to detect laptop lid closing/opening.

Turns out I have no permission to access /dev/input/event*, and thus this functionality did not work. Adding myself to the "input" group grants me permission. However, the "input" group was listed in the "presystemd groups" in the mentioned wiki article, which leds me to believe I should have permission without needing to do anything.

Last edited by minhduc0711 (2022-01-15 13:38:32)

Offline

#4 2022-01-15 14:20:31

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: [SOLVED] Proper way to allow access to /dev/input/event*

As far as I know, access to input devices has been further restricted. Only the "session owner"  (usually your compositor) is able to request access through a dbus interface now. This was probably done to make keylogging harder.
Edit: Anything else has to be manually configured, you might be able to create a custom udev rule to allow access to the lid switch only instead of just allowing generall access to all input. (uaccess or simply a user group)

Edit: This article details the process used now: https://github.com/KillingSpark/HowLogindWorks

Last edited by progandy (2022-01-15 14:26:06)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2022-01-15 15:54:23

minhduc0711
Member
Registered: 2021-05-04
Posts: 13

Re: [SOLVED] Proper way to allow access to /dev/input/event*

Ah, thanks for your explanation. I read https://wiki.archlinux.org/title/Udev#udev_rule_example and now I have this udev rule that only allows access to the lid switch:

KERNEL=="event[0-9]*", SUBSYSTEM=="input", ATTRS{name}=="Lid Switch", TAG+="uaccess"

Offline

Board footer

Powered by FluxBB