[PLUG] USB Serial Port Adapters

Fred James fredjame at fredjame.cnc.net
Fri Jun 17 20:45:58 PDT 2011


Jackman wrote:
> Why can't udev rules be applied here?
>
> On Fri, Jun 17, 2011 at 6:48 PM, Fred James <fredjame at fredjame.cnc.net> wrote:
>   
>> Tim Wescott wrote:
>>     
>>> (omissions for brevity)
>>>   I did an experiment: I started with my Fax
>>> modem and the board I'm developing plugged in.  I did ls /dev/ttyU*.
>>> Then I unplugged the development board and did ls again.  Then I plugged
>>> in a debugger that has its own USB serial port adapter, and did ls
>>> again.  Here's my results:
>>>
>>> tim at servo:~$ ls /dev/ttyU*
>>> /dev/ttyUSB0  /dev/ttyUSB1
>>> tim at servo:~$ ls /dev/ttyU*
>>> /dev/ttyUSB0
>>> tim at servo:~$ ls /dev/ttyU*
>>> /dev/ttyUSB0  /dev/ttyUSB1
>>>
>>> What _did_ happen is that at different times the same device -- ttyUSB1
>>> -- got mapped to different physical devices.  That is what I _do not_
>>> want to happen.  What I want to happen is to plug in the development
>>> board and have /dev/ttyUSBdevelop appear, and to plug in the debugger
>>> and have /dev/ttyUSBdebug appear (or some similar me-defined mapping).
>>> Different devices.  Different, _unique_, identifiers.
>>>
>>> Otherwise, every time I plug a bunch of stuff in to the machine, I'm
>>> going to have to do a bunch of hand work to figure out what ports map to
>>> what devices at the moment.
>>>
>>>       
>> Tim Wescott
>> Thought 1:  If you can use CLI (command line interface) to determine
>> what you need to know, then a (BASH) script can be written to do that.
>> Thought 2:  If a device can be identified (example: ttyUSB1 is the
>> debugger), then it can be mounted to a directory (example: ~/debugger)
>> Thought 3:  If 1 and if 2, then the two can be written together in a script.
>> Does any of that help?
>> Regards
>> Fred James
>>     
Jackman
According to <http://reactivated.net/writing_udev_rules.html#about>, it 
can ...
"

udev rules are flexible and very powerful. Here are some of the things 
you can use rules to achieve:

    * Rename a device node from the default name to something else
    * Provide an alternative/persistent name for a device node by
      creating a symbolic link to the default device node
    * Name a device node based on the output of a program
    * Change permissions and ownership of a device node
    * Launch a script when a device node is created or deleted
      (typically when a device is attached or unplugged)
    * Rename network interfaces

"
Regards
Fred James




More information about the PLUG mailing list