We’re creating an app that opens the serial port for communication with another machine. And we’ve discovered that any time you unplug the cable, the permissions on the device (/dev/ttyS0) are reset–which makes the application unable to access it.
Is there any way to disable this so that it doesn’t reset the permissions, or to otherwise lock them in?
I’m pretty sure this is one area where it varies greatly by distribution, not to mention which kernel you’re using. For instance, I’m familiar with Debian and I believe you have to modify the /etc/udev/permissions.rules file. This is on a 2.6.12 or greater kernel (after udev was added; incompatible with earlier kernels). I also have a little experience with Fedora, although I don’t recall what I needed to do to “permanently” change the settings – one infuriating thing about Fedora, and the reason for the quotes around “permanently”, is that it has a tendency to overwrite your modifications whenever you upgrade – without letting you know it has done so. Make sure to document what you did; I’ve wasted hours recreating my solution.
It’s odd that unplugging the cable would cause a reset; never had that problem, although that might be because our solution is to set the group permissions (may not work if you rely on user, rather than group or world, permissions). My advice – from the /etc directory, run “grep -R tty” to get a list of files that do something with the tty settings, eyeball that list for a likely candidate, and try some modifications. Hope that helps…
Ooops. Of course, that should be “grep -R tty *”. And, of course, you’ll need root permissions to read most of /etc…