Experimental Physics and Industrial Control System
Dear Mark,
There are three things I want to share. I think, you already know them,
but just in case.
1) If an user is in the dialout group (uucp for RHEL, I guess), the user
can read/write to a Serial Port.
So I think, don't need to execute chmod o+rw /dev/ttyUSB0
2) Each device has its own unique name (usually by-id directories
in /dev/ directory. If you type tree in /dev/, you will see many
symlinks
For example,
ctrluser@ctrlpc1:/dev/serial$ tree
.
├── by-id
│ └── usb-Arduino__www.arduino.cc__0043_A4139363931351B06171-if00 ->
../../ttyACM0
└── by-path
└── pci-0000:00:1d.0-usb-0:1.2:1.0 -> ../../ttyACM0
3) And you can write your own symlink for any device, I didn't try it
myself, but I think it can be used to fix your devices in their own
symlinks.
Please see 70-persistent-cd.rules for further reference. In my system,
----------------------------------------------------------------------
root@ctrlpc1:/etc/udev/rules.d# more 70-persistent-cd.rules
# This file was automatically generated by the /lib/udev/write_cd_rules
# program, run by the cd-aliases-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and set the $GENERATED variable.
# CDDVDW_SH-216AB (pci-0000:00:1f.2-scsi-4:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-4:0:0:0", SYMLINK+="cdrom",
ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-4:0:0:0", SYMLINK+="cdrw",
ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-4:0:0:0", SYMLINK+="dvd",
ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-4:0:0:0", SYMLINK+="dvdrw",
ENV{GENERATED}="1"
--------------------------------------------------------------------
root@ctrlpc1:/dev# tree |grep "pci-0000:00:1f.2-scsi-4:0:0:0"
│ │ └── pci-0000:00:1f.2-scsi-4:0:0:0 -> ../../sr0
--------------------------------------------------------------------
root@ctrlpc1:/dev# tree |grep sr0
│ ├── 11:0 -> ../sr0
├── cdrom -> sr0
├── cdrw -> sr0
│ │ └── pci-0000:00:1f.2-scsi-4:0:0:0 -> ../../sr0
├── dvd -> sr0
├── dvdrw -> sr0
├── scd0 -> sr0
├── sr0
---------------------------------------------------------------------
Thanks,
Jeong Han
On 04/18/2013 12:22 AM, Mark Rivers 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
--
Jeong Han Lee, Dr.rer.nat.
---------------------------
Accelerator Division
Rare Isotope Science Project
Institute for Basic Science
70, Yuseong-daero 1689-gil, Yuseong-gu,
Daejeon 305-811, South Korea
---------------------------
cell : +82-10-7363-2083
tel : +82-42-878-8733
fax : +82-42-878-8799
- Navigate by Date:
- Prev:
RE: sscan/ saveData problem with RW permission, and not an NFS issue Vesna Samardzic-Boban
- 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
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Linux USB serial questions Andrew Johnson
- Next:
Calling ca_context_create(1) too late michael.abbott
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024