EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Help with udev
From: "Denison, PN \(Peter\)" <[email protected]>
To: "Mark Rivers" <[email protected]>, <[email protected]>
Date: Fri, 21 Dec 2007 09:34:36 -0000
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Mark Rivers
> Sent: 21 December 2007 03:47
>  
> I have written EPICS device support for a USB device (Saturn 
> spectroscopy system from XIA).  It is working fine under both 
> Windows and Linux.
>  
> However, on Linux I have been running the IOC application 
> with root privilege, which I would like to avoid.  The 
> problem arises because USB devices are created dynamically, 
> so one cannot statically give them the desired mode (e.g. 
> 666, 660, etc.).
>  
> My understanding is that one can use the Linux "udev" 
> facility to handle this.  I've found some examples of how to 
> do it on the Web, but I can't seem to get it to work.  I was 
> hoping someone might be able to tell me what I'm doing wrong.
>  
> I've created a file, /etc/udev/rules.d/80-saturn.rules
>  
> [epics@baja rules.d]$ more /etc/udev/rules.d/80-saturn.rules 
> SUBSYSTEM=="usb_device",ACTION=="add",ATTRS{idVendor}=="10E9",
> ATTRS{idProduct}=="0700",MODE="0666"
> SUBSYSTEM=="usb_device",ACTION=="add",ATTRS{idVendor}=="10E9",
> ATTRS{idProduct}=="0701",MODE="0666"
> This should set the permissions on the device to 666 when the 
> USB device is added.  I have verified that these are the 
> correct idVendor and idProduct with udevinfo:

I generally use the /sys filesystem to locate and identify my devices.
An example udev rules entry that I have is:

BUS=="scsi", SYSFS{model}=="JD FIREFLY", KERNEL=="sd?[0-9]", NAME="%k",
SYMLINK="usbdisk"

Admittedly, this is for a USB disk, but you could follow the same style.

I would recommend, as a starter, using BUS=="usb",
SYSFS{idVendor}=="10E9", SYSFS{idProduct}=="0700", rather than your
SUBSYSTEM and ATTRS above. This assumes you have a /sys filesystem
mounted (which is always a good idea).

I would also recommend using a symlink, so you get a /dev/saturn (or
similar) device that will not change name, even when the USB device
does. If you expect more than one concurrent device, you need a little
tweak to number the symlinks consecutively.

Sorry this isn't a complete solution, but I hope it will help along the
way...

-- 
Peter Denison, Senior Software Engineer, Diamond Light Source Ltd.
Tel: +44 1235 778511
(apologies in advance for the lines below. Some bits are a legal
requirement and I have no control over them)

<DIV><FONT size="1" color="gray">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
</FONT></DIV> 


References:
Help with udev Mark Rivers

Navigate by Date:
Prev: Help with udev Mark Rivers
Next: RE: Help with udev Dr. Peter Hartmann
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Help with udev Mark Rivers
Next: RE: Help with udev Dr. Peter Hartmann
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·