You are not logged in.

#1 2008-11-04 21:01:28

Xinix
Member
Registered: 2008-03-14
Posts: 83

Please help with udev rule

Hi all,

I've got a Garmin GPS receiver that  I wish to use with Viking. When I plug in the gps a /dev/ttyUSB0 device is created with owner root:root, so in order to be able to use it as a normal user,  I need to chmod 666 /dev/ttyUSB0.

I have been looking in /etc/udev/rules.d but I cannot find any rule to modify so that the device is created for root:tty. Guess I reached the end of my skills here.

Could someone please give me a rule that creates /dev/ttyUSB devices that are accessible by a normal user account?

TIA!

Offline

#2 2008-11-04 23:49:33

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Please help with udev rule

Look into /lib/udev/rules.d/50-udev-default.rules, there's a line
KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", SYMLINK+="%k"
I think it should be enough to append
,GROUP="tty"
to it. The proper way would be not to modify that file, but create a new one in /etc/udev/rules.d/ with that line in there. According to udev manual, files in /etc/udev/rules.d/ take precedence over /lib/udev/rules.d.

EDIT: By the way, you might want to file a feature request about this on the bugtracker, it's a pretty reasonable thing to ask.

Last edited by bender02 (2008-11-04 23:50:40)

Offline

#3 2008-11-05 07:22:06

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Please help with udev rule

Create a new rule which adds a symlink for easy reference, and overrides the permissions. E.g. in /etc/udev/rules.d/91-local.rules

SUBSYSTEM=="usb", ATTR{product}=="CanoScan", GROUP="users", MODE="0660"
KERNEL=="kqemu", NAME="%k", MODE="0660", GROUP="users"
ATTRS{model}=="DVD-RAM GSA-H30N", SYMLINK+="cdrom cdrw dvd dvdrw", MODE="0664"
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"

And no, that filename is not chosen randomly. 91 is deliberately higher than the other rules, for the GROUP & MODE to take precedence.

Offline

#4 2008-11-05 15:22:24

Xinix
Member
Registered: 2008-03-14
Posts: 83

Re: Please help with udev rule

thanks people, I will try as soon as possible. Yes, I will report a bug since it is indeed unexpected behaviour if you ask me wink

Offline

#5 2008-11-06 15:36:47

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Please help with udev rule

It's not really a bug. Udev can't know the desired permissions for every device in existence, so it has to play safe and set the permissions restrictively. It's up to you to set the permissions to whatever is convenient for you, via a custom udev rule.

I would suggest:  MODE="0660", GROUP="users"

Offline

Board footer

Powered by FluxBB