elektronist
Posts: 4
Joined: Tue Nov 20, 2012 3:32 pm

Group of /dev/ttyAMA0

Fri Dec 28, 2012 11:16 am

I want to change the group of /dev/ttyAMA0 from tty to dialout permanently, but couldn't find any entry in udev rules.

Where is the group of /dev/ttyAMA0 defined by udev ? Or any other system...

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Group of /dev/ttyAMA0

Fri Dec 28, 2012 4:01 pm

The device should be root:dialout unless/until you log in on that terminal, when it is correctly changed to pi:tty. Is that not the behaviour you are seeing, and in what distro image?

elektronist
Posts: 4
Joined: Tue Nov 20, 2012 3:32 pm

Re: Group of /dev/ttyAMA0

Sat Dec 29, 2012 10:51 am

For both graphical and nongraphical pi user:

Code: Select all

pi@raspberrypi ~ $ ls -la /dev/ttyAMA0
crw-rw---- 1 root tty 204, 64 Ara 28 12:59 /dev/ttyAMA0
raspbian wheezy 2012-10-28 fully updated.

So, it looks like with raspbian this device's group is tty not dialout. My goal is to use my serial programs as simple user in dialout group. Of course

Code: Select all

sudo chgrp dialout /dev/ttyAMA0
works. But for a standalone/headless device this is not very practical nor 'nice'.

elektronist
Posts: 4
Joined: Tue Nov 20, 2012 3:32 pm

Re: Group of /dev/ttyAMA0

Sat Dec 29, 2012 11:05 am

Also tried with Bodhi. Result is the same.

With a usb-rs232 dongle:

Code: Select all

pi@raspberrypi ~ $ ls -l /dev/ttyUSB0
crw-rw---T 1 root dialout 188, 0 Dec 29 05:00 /dev/ttyUSB0

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Group of /dev/ttyAMA0

Thu Jan 03, 2013 10:31 am

jojopi wrote:The device should be root:dialout unless/until you log in on that terminal, when it is correctly changed to pi:tty.
Ok, that was misleading. udev sets the device to root:dialout, but getty sets it to root:tty immediately, and login changes it to pi:tty. (There may be some race condition or trigger that can make udev chgrp the device after getty, because I still have some pies where getty is running and the group is dialout.)

Still if you disable getty, which you need to do anyway for most outbound uses of the port, the permissions should stay as you want. Remove or comment out this line from /etc/inittab:

Code: Select all

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

elektronist
Posts: 4
Joined: Tue Nov 20, 2012 3:32 pm

Re: Group of /dev/ttyAMA0

Wed Feb 06, 2013 3:45 pm

jojopi wrote:
jojopi wrote:The device should be root:dialout unless/until you log in on that terminal, when it is correctly changed to pi:tty.
Ok, that was misleading. udev sets the device to root:dialout, but getty sets it to root:tty immediately, and login changes it to pi:tty. (There may be some race condition or trigger that can make udev chgrp the device after getty, because I still have some pies where getty is running and the group is dialout.)

Still if you disable getty, which you need to do anyway for most outbound uses of the port, the permissions should stay as you want. Remove or comment out this line from /etc/inittab:

Code: Select all

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Thanks! That was the solution. Sorry for my belated message.

Return to “Advanced users”