Prev: World domination foiled again...
Next: Missing?
From: Martin Gregorie on 18 Dec 2008 09:08 On Thu, 18 Dec 2008 13:12:27 +0000, Theo Markettos wrote: > > Indeed. Depending on how old your distro is, it'll either be hotplug > (quite old now) or udev. You'll have to look up the docs for each. > Thanks, guys. F8 and F9 are udev. > On my work machine I have udev, with the following in a file in > /etc/udev/rules.d/ > > KERNEL=="ttyS0", NAME="%k", MODE="0667", OPTIONS="last_rule", > OWNER="1941" (where '1941' is the numeric UID for my account) > > If you swap that for KERNEL=="ttyUSB[0-2]" that might do the trick. You > might need to restart udev or reboot for this to take effect. > I found the following line in 50-udev-default.rules: KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" which looks to be the controlling rule for both ttyS[0-3] and ttyyUSB[0-9] so I guess first cut says I should simply add , MODE="0666" to it. However, the file has a line warning that it shouldn't be modified because it gets automatically overwritten and there's nothing in the manpages to say how the rules should be modified. Can I simply put a file, say 51-udev-local-override.rules to the rules.d directory with my modified rule in it? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Geoffrey Clements on 18 Dec 2008 10:46 Martin Gregorie wrote: [snip] > I found the following line in 50-udev-default.rules: > > KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" > > which looks to be the controlling rule for both ttyS[0-3] and ttyyUSB[0-9] > so I guess first cut says I should simply add > > , MODE="0666" > > to it. However, the file has a line warning that it shouldn't be modified > because it gets automatically overwritten and there's nothing in the > manpages to say how the rules should be modified. Can I simply put a > file, say > > 51-udev-local-override.rules > > to the rules.d directory with my modified rule in it? > > That should do it, just was out for any preceding rules which match this device and specify a "last_rule" option. You can use "udevadm test" to see what will happen. -- Geoff Registered Linux user 196308 Replace bitbucket with geoff to mail me.
From: Martin Gregorie on 18 Dec 2008 14:31 On Thu, 18 Dec 2008 15:46:16 +0000, Geoffrey Clements wrote: > That should do it, just was out for any preceding rules which match this > device and specify a "last_rule" option. > > You can use "udevadm test" to see what will happen. Thanks for the advice. Permissions are now being set just as I want them. The rule ended up as: KERNEL=="tty[A-Z]*", GROUP="uucp", MODE="0666", OPTIONS="last_rule" in a separate file. I changed the match pattern so the rule only affects serial ports and USB-serial adapters. At that point it fixed the USB- serial adapter but not the ttyS* ports (and I still can't see why there's a difference). After adding the "last_rule" option it fixes the permissions on all the serial ports. BTW, I think there's a misfeature in the udev pattern matcher: "tty[A-Z]*" matches 'tty', 'ttyS0' and 'ttyUSB0' but not 'tty0'. IOW its acting as though [A-Z]* means 'match at least one of the letters A to Z or the end of the string' rather than the implied (and conventional) 'zero or more characters'. Can anybody give me the address of a person or group who should be told about it? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Mike Civil on 18 Dec 2008 16:15 In article <gie8en$4tl$1(a)localhost.localdomain>, Martin Gregorie <martin(a)see.sig.for.address.invalid> wrote: >BTW, I think there's a misfeature in the udev pattern matcher: >"tty[A-Z]*" matches 'tty', 'ttyS0' and 'ttyUSB0' but not 'tty0'. >IOW its acting as though [A-Z]* means 'match at least one of the letters >A to Z or the end of the string' rather than the implied (and >conventional) 'zero or more characters'. The udev docs do state that shell-style pattern patching is used, so it seems to be working as documented :) Mike
From: Martin Gregorie on 18 Dec 2008 17:31
On Thu, 18 Dec 2008 21:15:41 +0000, Mike Civil wrote: > In article <gie8en$4tl$1(a)localhost.localdomain>, Martin Gregorie > <martin(a)see.sig.for.address.invalid> wrote: >>BTW, I think there's a misfeature in the udev pattern matcher: >>"tty[A-Z]*" matches 'tty', 'ttyS0' and 'ttyUSB0' but not 'tty0'. IOW its >>acting as though [A-Z]* means 'match at least one of the letters A to Z >>or the end of the string' rather than the implied (and conventional) >>'zero or more characters'. > > The udev docs do state that shell-style pattern patching is used, so it > seems to be working as documented :) > OK, agreed. I missed the rule giving a+rw permissions to /dev/tty in 50-udev- default.rules because its not in the set labelled "# serial" and then didn't look at the group assigned to that device. My mistake. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | |