Re: serial communication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-03-30 at 19:42 -0500, lahmbi5678 wrote:
> In most cases the user doesn't have permision to access serial ports,
> so you'd first need to add the user to group dialout or take similar
> action depending on the underlying system. Then you'd add symbolic
> links like "ln -s /dev/ttyS0 com1", if not already present. With this
> solution you usually won't need to run as root. For the remaining
> issues you should file bugs.
> 
Access permissions are a good point, which I should not have missed.

In fact the symlinks aren't needed IME (I don't use them at all), but
the symlinks don't affect the access permissions: you need to change the
permissions of the device files, /dev/ttyS*. This used to be something
that you could do at boot time by adding a chmod command
to /etc/rc.d/rc.local but since then device management has moved to the
UDEV system which is more dynamic. These days I simply create a file
that local adds a local access permission rule to UDEV:

======== /etc/udev/rules.d/99-local.rules ========  
#
# Give world read/write access to ttyS* and ttyUSB* serial devices
#
KERNEL=="tty[A-Z]*", GROUP="uucp", MODE="0666"
======== /etc/udev/rules.d/99-local.rules ========  

The file content is the four lines between the lines starting with 
"========". Make sure you keep a copy of this file in a safe place and
remember to reinstate it after a distro reinstall.

This rule sets the permissions to allow all users to access the serial
ports on the motherboard as well as those on my multiport card and
serial USB connections. 

A chmod command in /etc/rc.d/rc.local will probably work for serial
ports on the motherboard and multiport adapter cards but will never work
for USB access because it is only run at boot time while these ports
(/dev/ttyUSB*) are only created when a USB device is plugged in and
destroyed when its unplugged. The UDEV rule works because it is run as
part of the port creation.
 

Martin





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux