I’ve managed to compile a custom out-of-tree kernel driver for the Raspicomm RS485 module (MAX3140).
It is working fine when I manually create the tty device in /dev with the following command:
$ mknod /dev/ttyRPC0 c $(cat /sys/devices/virtual/tty/ttyRPC0/dev | tr ':' ' ')
But I thought that /dev/ttyRPC0
would have been automatically created when the kernel module was loaded, but it is definitively not the case in BalenaOS.
Do you know how I can dynamically create the device node when the kernel driver is loaded?
FYI, here are the udev events generated when the kernel driver is loaded:
$ udevadm monitor --environment
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[59723.497909] add /module/raspicommrs485 (module)
ACTION=add
DEVPATH=/module/raspicommrs485
SEQNUM=5407
SUBSYSTEM=module
KERNEL[59723.503265] add /devices/virtual/tty/ttyRPC0 (tty)
ACTION=add
DEVNAME=/dev/ttyRPC0
DEVPATH=/devices/virtual/tty/ttyRPC0
MAJOR=244
MINOR=0
SEQNUM=5408
SUBSYSTEM=tty
UDEV [59723.507952] add /module/raspicommrs485 (module)
ACTION=add
DEVPATH=/module/raspicommrs485
SEQNUM=5407
SUBSYSTEM=module
USEC_INITIALIZED=59723504950
UDEV [59723.509476] add /module/raspicommrs485 (module)
ACTION=add
DEVPATH=/module/raspicommrs485
SEQNUM=5407
SUBSYSTEM=module
USEC_INITIALIZED=59723508022
UDEV [59723.513963] add /devices/virtual/tty/ttyRPC0 (tty)
ACTION=add
DEVNAME=/dev/ttyRPC0
DEVPATH=/devices/virtual/tty/ttyRPC0
MAJOR=244
MINOR=0
SEQNUM=5408
SUBSYSTEM=tty
TAGS=:systemd:
USEC_INITIALIZED=59723512733
UDEV [59723.514945] add /devices/virtual/tty/ttyRPC0 (tty)
ACTION=add
DEVNAME=/dev/ttyRPC0
DEVPATH=/devices/virtual/tty/ttyRPC0
ID_MM_CANDIDATE=1
MAJOR=244
MINOR=0
SEQNUM=5408
SUBSYSTEM=tty
TAGS=:systemd:
USEC_INITIALIZED=59723512929
Thanks.