At Wed, 2 May 2012 16:27:48 +0000 CentOS mailing list <[email protected]> wrote:
>
> Can someone please help me with writing a udev rule?
>
> I need /dev/ttyUSB0 to automatically have 777 rights when plugged in. I'd
> like it to only apply to that one specific device.
>
> I'm not sure where to start, what files to look at and also what to write to
> make it work.
Does this give you a clue:
sauron.deepsoft.com% cat /etc/udev/rules.d/10-local.rules
#KERNEL="ttyS0", SYMLINK="mouse"
#KERNEL="mice", NAME="input/%k",SYMLINK="mouse"
KERNEL=="ttyS4", SYMLINK="modem"
KERNEL=="ttyS5", SYMLINK="back", MODE="0666"
KERNEL=="ttyS7", SYMLINK="front", MODE="0666"
#KERNEL=="sr[0-9]*", GROUP="disk", MODE="0666"
#KERNEL=="scd[0-9]*", GROUP="disk", MODE="0666"
#KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1",
PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvdrom"
KERNEL=="sd[a-z]*", BUS=="scsi", SYSFS{vendor}=="Kingston", NAME="thumb"
Things to note: '/dev/ttyUSB0' is probably not a good name (I get away
with ttyS4, ttyS5, and ttyS7, since these are not hotplugable devices
(they are on a 4 port PCI card). Anything subject to hot pluging (like
my Kingston thum drive), should probably be using a NAME or SYMLINK
directive and be testing on something like a SYSFS{vendor} or something.
Each time you plug it in the name could change, depending on what else
is plugged in at the time.
You probably want something like:
KERNEL=="ttyUSB*", BUS=="usb", SYSFS{vendor}=="whatever", MODE="0777",
SYMLINK="USBSerialPort"
Put this in /etc/udev/rules.d/10-local.rules
Replace 'whatever' with the vendor name or use SYSFS{idVendor} and the
hex code, possibly also with a SYSFS{idProduct} test as well. You can
find out what works for the SYSFS keys by looking in
/sys/bus/usb/devices/usb*/* -- the keys are the names of the files and
the values to test for are the contents of these 'files'.
>
> TIA
>
> Brad
> This e-mail transmission contains information that is confidential and may be
> privileged. It is intended only for the addressee(s) named above. If you
> receive this e-mail in error, please do not read, copy or disseminate it in
> any manner. If you are not the intended recipient, any disclosure, copying,
> distribution or use of the contents of this information is prohibited. Please
> reply to the message immediately by informing the sender that the message was
> misdirected. After replying, please erase it from your computer system. Your
> assistance in correcting this error is appreciated.
> _______________________________________________
> CentOS mailing list
> [email protected]
> http://lists.centos.org/mailman/listinfo/centos
>
>
--
Robert Heller -- 978-544-6933 / [email protected]
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
_______________________________________________
CentOS mailing list
[email protected]
http://lists.centos.org/mailman/listinfo/centos