mateus_guilherme
Posts: 20
Joined: Sat Feb 15, 2020 6:36 pm

Assign permanent access names for infrared sensors

Mon May 11, 2020 6:38 pm

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.

HiassofT
Posts: 304
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Assign permanent access names for infrared sensors

Mon May 11, 2020 6:52 pm

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

Return to “General discussion”