Page 1 of 1

Assign permanent access names for infrared sensors

Posted: Mon May 11, 2020 6:38 pm
by mateus_guilherme
Hello

I am working on a project that needs two infrared sensors (left and right). I would like to define the permanent access names for each infrared sensor. Example:

#left sensor
dtoverlay = gpio-ir, gpio_pin = 19 --- >>> /dev/lirc0 --- >>> /dev/input/event0

#right sensor
dtoverlay = gpio-ir, gpio_pin = 26 --- >>> /dev/lirc1 --- >>> /dev/input/event1

my python script is doing event readings on /dev/input/event0 and /dev/input/event1 devices. However, when I use a keyboard or mouse, these numbers can change. Is there a way to define these names? UDEV maybe? I've been looking on google but I haven't found any example.

thanks.

Re: Assign permanent access names for infrared sensors

Posted: Mon May 11, 2020 6:52 pm
by HiassofT
The easiest way would be to make use of the existing udev setup which give you /dev/input/by-path/XXX-event symlinks.

With a gpio-ir receiver on gpio 5 you'd get a /dev/input/by-path/platform-ir-receiver@5-event symlink which points to the eventX device.

You should have 2 platform-ir-receiver symlinks there, one with @19 and another one with @26 in it's name.

so long,

Hias