Change /dev/input/event*

Hi,

I’m working on Apalis imx8qm V1.0B and Ixora V1.2A.
At the moment I’m using your Yocto distribution 4.0.

I’m planning the porting of my entire system on Apalis imx8qm V1.1B with your Yocto distribution 5.0 (as you already suggested in the past), but before doing this I want to fix an issue that is giving me some trouble.

With Apalis/Ixora combo I drive a full HD capacitive touch panel (USB interface) and I noticed that some times the touchscreen reference is on /dev/input/event2 and some times it is on /dev/input/event3.

Is there a way to “force” the touchscreen always on the same reference? e.g. touchscreen reference always on /dev/input/event3

Let me know,
Thanks.

Merlin

I know not answering your question, but does a touchscreen device symlink get created as /dev/input/touchscreen0 during startup? Can you use that?

Hi DaveM,
I have touchscreen0 in /dev/input but it is linked to /dev/input/event1 so I’m not using it.
How can I change this symlink creation on startup?

Thanks a lot.

do you have multiple touchscreens connected? what kind of rules are in /etc/udev/rules.d/*?

what’s the output of:

grep -ir touch /etc/udev/rules.d
dmesg | grep input

I’m not a udev person, but I would think u can create some rule in there.

Hi @Merlin!

As @DaveM said, you can create a udev rule for this device, so you will have always the same link for your device.

You can get some inspiration from Toradex’s udev rules directly from your module (I’m on BSP 5.4, Reference Multimedia Image):

root@apalis-imx8-06980209:~# cat /etc/udev/rules.d/99-toradex.rules
ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="5a820000.i2c", SYMLINK+="apalis-i2c1"
ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="5a830000.i2c", SYMLINK+="apalis-i2c3"
ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="5a810000.i2c", SYMLINK+="apalis-i2c-on-module"
ACTION=="add", ATTRS{iomem_base}=="0x5A070010", SYMLINK+="apalis-uart1"
ACTION=="add", ATTRS{iomem_base}=="0x5A090010", SYMLINK+="apalis-uart2"
ACTION=="add", ATTRS{iomem_base}=="0x5A060010", SYMLINK+="apalis-uart3"
ACTION=="add", ATTRS{iomem_base}=="0x5A080010", SYMLINK+="apalis-uart4"
ACTION=="add", KERNELS=="watchdog", SYMLINK+="apalis-watchdog"
ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="5a000000.spi", SYMLINK+="apalis-spi1-cs%n"
ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="5a020000.spi", SYMLINK+="apalis-spi2-cs%n"
KERNEL=="mmcblk[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="5b010000.mmc", SYMLINK+="emmc"
KERNEL=="mmcblk[0-9]boot[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="5b010000.mmc", SYMLINK+="emmc-boot%n"
KERNEL=="mmcblk[0-9]p[0-9]", ENV{DEVTYPE}=="partition", KERNELS=="5b010000.mmc", SYMLINK+="emmc-part%n"
SUBSYSTEM=="iio", KERNELS=="iio:device0", RUN+="/etc/udev/scripts/toradex-adc.sh"
ACTION=="add|change", KERNEL=="mmcblk[0-9]", KERNELS=="5b030000.mmc", SYMLINK+="apalis-sd4bit"
ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]*", KERNELS=="5b030000.mmc", SYMLINK+="apalis-sd4bit-part%n"
ACTION=="add|change", KERNEL=="mmcblk[0-9]", KERNELS=="5b020000.mmc", SYMLINK+="apalis-mmc8bit"
ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]*", KERNELS=="5b020000.mmc", SYMLINK+="apalis-mmc8bit-part%n"

Best regards,

Hi @henrique.tx , hi @DaveM,
Thanks for your answers.

I will try after the porting to BSP 5 will be complete.
I guess it would be a better solution that the one I temporarily adopted: I’m using /dev/input/by-id reference and not /dev/input/event* reference.
Can this strategy create any problems?

Thank for your help,
Merlin

Hi @Merlin !

The /dev/input/by-id/* are created by udev rules as well (see /lib/udev/rules.d/60-persistent-input.rules) and those links shouldn’t change. Not even between boots.

But the best really would be to use the symlinks created by your own udev rules.

Best regards,