Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
<== Date ==> <== Thread ==>

Subject: Re: Linux USB serial questions
From: Eric Norum <eric@norum.ca>
To: Mark Rivers <rivers@cars.uchicago.edu>
Cc: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Wed, 17 Apr 2013 09:01:41 -0700
Here's what I have for an FPGA programming dongle.  It runs the script RUN whenever the device is connected (since ACTION="")

ATTRS{idVendor}=="1443", MODE="666"
ACTION="" ATTRS{idVendor}=="0403", ATTRS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/local/sbin/dftdrvdtch %s{busnum} %s{devnum}"


You can have  ATTRS{serial}=="xxxxxxxxx" qualifiers in rules to perform actions for a particular device.  Here's an example I found on the net for a printer:
SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380", SYMLINK+="epson_680"

Here's the page with the above example -- I found it very helpful


On Apr 17, 2013, at 8:22 AM, Mark Rivers <rivers@cars.uchicago.edu> wrote:

Folks,

I have a couple of questions about how to automatically set up USB serial devices on Linux.  I have a Newport motor controller which is a USB device, but is actually a "serial" device.  I can configure it fine on Linux by plugging it in and executing the following 2 commands as root:

modprobe ftdi_sio vendor=0x104d product=0x3000
chmod o+rw /dev/ttyUSB0

The first command loads the ftdi_sio driver with the vendor and product codes for this device.  Those codes can be determined from the lsusb command:

Colorado:motor/iocBoot/iocWithAsyn>/usr/sbin/lsusb
Bus 002 Device 003: ID 104d:3000 Newport Corporation

The second command sets the permissions on the device so any user can read and write it.

After doing those commands my EPICS IOC can access the device, set the baud rate, data bits, stop bits, etc.  I now have a motor record driver to talk to it.

My question is how to have those 2 commands executed automatically so I don't need to manually do it.  My first thought was to create a udev entry for the device.  I created the following file and put it in /etc/udev/rules.d

Colorado:motor/iocBoot/iocWithAsyn>more ~/81-Agilis.rules
SYSFS{idVendor}=="104d", ATTRS{idProduct}=="3000", MODE="0666"

If this file is present after the Linux system is booted and after I have issued the "modprobe" command then it works correctly.  Each time I unplug the device /dev/ttyUSB0 disappears, and each time I plug it in it reappears with the correct permissions.  If the udev file is not present then when I plug it in the device is missing read/write permission for others.

However, if that udev file is present when the system boots, before I issue the "modprobe" command then the "modprobe" command does not work in the sense that no /dev/ttyUSBn device appears.  I think this could be because the udev file is causing some other driver to load, and so it won't load the ftdi_sio driver.  Is there a way to specify which driver to load in the udev file?

Does anyone know how to do this?

I have a related question.  An EPICS user at NIH has 18 of these devices which he wants to use at the same time.  Is there a way to assign a specific device (based upon its serial number for example) to a  specific /dev/ttyUSBn port?  If not,  how does one figure out which motor is connected to which /dev/ttyUSBn port?

Thanks,
Mark




-- 
Eric Norum
eric@norum.ca





Replies:
AW: Linux USB serial questions Zumbruch, Peter Dr.
References:
Linux USB serial questions Mark Rivers

Navigate by Date:
Prev: Re: sscan/ saveData problem with RW permission, and not an NFS issue Tim Mooney
Next: RE: autosave limitation? Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
Navigate by Thread:
Prev: Linux USB serial questions Mark Rivers
Next: AW: Linux USB serial questions Zumbruch, Peter Dr.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·