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  2019  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  2019 
<== Date ==> <== Thread ==>

Subject: RE: Linux USB serial questions
From: Mark Rivers <rivers@cars.uchicago.edu>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 18 Apr 2013 18:21:16 +0000
Thanks for all the replies I've received so far.  I am still reading and understanding them.

But now I have a more fundamental question, there is something I am not understanding about modprobe I think.

I now have 2 different USB ftdi_sio devices.  Both are manufactured by Newport but they are different models.

This is what lsusb shows for these devices:

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

Initially I plugged in the device with model=3006.  I then did modprobe to load the ftdi_sio driver for that vendor and model, and it created /dev/ttyUSB0.  It works fine, I can control it with no problems.

Now I plugged in the second device with model=3000, leaving the first device also plugged in.  The new device shows up with lsusb, as seen above.  However, it did not create a /dev/ttyUSBn for that device.

I then tried to run modprobe for the new device:

>sudo modprobe ftdi_sio vendor=0x104d product=0x3000

There is no error message.  However, it did not create a new /dev/ttyUSBn device:

>ls -l /dev/ttyUSB*
crw-rw-rw- 1 root dialout 188, 0 Apr 18 13:10 /dev/ttyUSB0

There is still only device ttyUSB0, not a new ttyUSB1.

What am I doing wrong?

Thanks,
Mark


________________________________
From: Mark Rivers
Sent: Wednesday, April 17, 2013 10:22 AM
To: tech-talk@aps.anl.gov
Subject: Linux USB serial questions

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




Replies:
Re: Linux USB serial questions J. Lewis Muir
Re: Linux USB serial questions Dale L. Brewe
Re: Linux USB serial questions Andrew Johnson
References:
Linux USB serial questions Mark Rivers

Navigate by Date:
Prev: RE: asynAddress, asynPortDriver maxAddr, and addr in setXXXParam Emmanuel Mayssat
Next: Re: Linux USB serial questions J. Lewis Muir
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  2019 
Navigate by Thread:
Prev: AW: Linux USB serial questions Zumbruch, Peter Dr.
Next: Re: Linux USB serial questions J. Lewis Muir
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  2019 
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 ·