I'm running a program (specifically oscam) that interfaces with a serial reader on a USB port. However, the tty device file that the USB device gets assigned to differs and, in particular, changes when the system wakes up from suspend.
I've created a udev rule so as to assign a consistent tty device symlink to the serial reader. This worked out fine, and I can now always access it under the same name. This allowed me to include the symlinked name rather than the actual device name in the config file, so that I did not have to change it every other re-plug.
However, the program seems to resolve this to symlink the actual device tty upon loading its configurations. This means that, as long as the program is running, it will not re-resolve the alias when trying to access the device.
Now here's my issue; when I wake my computer from suspend, the program is still running and thus does not resolve the now changed symlink. It works fine when I then kill off the program and start it back up.
A possible solution would of course be to include this killing and restarting of the program in /etc/pm/sleep.d/
, but this feels hacky, and I would like to share my fix back into the upstream.
My question is thus; is there some kind of signal that is fired when my system wakes from suspend, and can I catch that signal? I would then get the program to re-resolve the link specified in the configuration file.
RUN
action within udev rule? so when ever the link is made the script will run (restart program...)