We try to connect to ttyS0:
cu -l ttyS0 -s 115200 cu: open (/dev/ttyS0): Permission denied cu: ttyS0: Line in use |
We have a permission problem!
Default permissions for ttyS0:
ls -l /dev/ttyS0 crw------- 1 root root 4, 64 feb 19 08:54 /dev/ttyS0 |
Some poblems to solve:
ttyS0 permissions change after reboot
find /sys -name dev | grep ttyS0 /sys/class/tty/ttyS0/dev /etc/udev/rules.d# udevinfo -a -p /sys/class/tty/ttyS0 Udevinfo starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/class/tty/ttyS0': KERNEL=="ttyS0" SUBSYSTEM=="tty" DRIVER=="" looking at parent device '/devices/pnp0/00:08': KERNELS=="00:08" SUBSYSTEMS=="pnp" DRIVERS=="serial" ATTRS{id}=="PNP0501" looking at parent device '/devices/pnp0': KERNELS=="pnp0" SUBSYSTEMS=="" DRIVERS=="" |
We create 00-my.rules file,
echo SUBSYSTEM=="tty", KERNEL=="ttyS0", OWNER="uucp" > /etc/udev/rules.d/00-my.rules |
Add your user to dialout group:
gpasswd -a <youruser> dialout |
We solve the problem:
ls -l /dev/ttyS0 crw-rw---- 1 uucp dialout 4, 64 feb 30 00:29 /dev/ttyS0 cu -l ttyS0 -s 115200 Connected. |
Good luck!