LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-23-2010, 12:21 PM   #16
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398

lsusb just tells you what each USB device is identifying itself as.

You have two (different, I think) devices that both use the same chipset to talk to USB, and that chipset is a "PL2303 Serial Port...". As I said, that chipset is very common.

The name Pl2303... is irrelevant, it is just matched to the Vendor:Product string in /usr/share/misc/usb.ids and printed by lsusb for your convenience.

It's the USB identifier string 067b:2303 that matters, and this is built-in to the hardware. You cannot change it.
 
Old 07-23-2010, 12:30 PM   #17
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
Hmm that's unfortunate. Ok, thanks a lot for your help tredegar
 
Old 07-23-2010, 01:12 PM   #18
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,932

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
I assume that the adapters have unique serial numbers and therefore you should be able to write a rule to create a different device IDs based on it.
 
Old 07-23-2010, 01:24 PM   #19
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Good point michaelk. Thank you.

The link I gave in post #9 has useful information on this:
http://www.reactivated.net/writing_u...tml#sysfsmatch

Not sure that the OP has read it though.
 
Old 07-23-2010, 04:55 PM   #20
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
Yeah I have read it, but I seem to be unable to access the udevinfo. Says the command doesn't exist. Without that I can't access the ATTR data that I need.
 
Old 07-24-2010, 04:26 AM   #21
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
You have not made clear what version of ubuntu you are running.

In the recent releases (9.10, I think, and certainly 10.04) udevinfo has been replaced by udevadm

Some people are not happy about this.
 
Old 07-24-2010, 04:12 PM   #22
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
Ah that would be it. Yes I am using Ubuntu 9.10 Karmic, but unfortunately I don't have that laptop with me. When I do, I will try udevadm, and let you guys know if it works. Thanks!
 
Old 07-28-2010, 12:14 PM   #23
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
udevadm does in fact work on my linux platform, but I am getting the usage incorrect. I usually put it udevadm info or something similar and it always outputs "missing option". What does that mean?
 
Old 07-28-2010, 01:43 PM   #24
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
it always outputs "missing option". What does that mean?
It means "missing option" because the command is missing options it needs.

man udevadm isn't very helpful, but you need a command like this (which you can find other examples of by searching the interweb):

udevadm info -a -p $(udevadm info -q path -n /path/to/device)

So if I plug in something with a pl2303 chip (my GPS receiver in this case) it is attached to /dev/ttyUSB0

So see here:
Code:
root@vaio2:~# udevadm info -ap  $(udevadm info -q path -n /dev/ttyUSB0)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="pl2303"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0':
    KERNELS=="2-1.5:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="pl2303"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{modalias}=="usb:v067Bp2303d0300dc00dsc00dp00icFFisc00ip00"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5':
    KERNELS=="2-1.5"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="80"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{urbnum}=="9653"
    ATTRS{idVendor}=="067b"
    ATTRS{idProduct}=="2303"
    ATTRS{bcdDevice}=="0300"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="5"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Prolific Technology Inc."
    ATTRS{product}=="USB-Serial Controller"
[SNIP]
Unfortunately, the pl2303 does not seem to have a "serial number".

Last edited by tredegar; 07-28-2010 at 01:50 PM. Reason: Clicked "post" instead of "Go advanced" :(
 
1 members found this post helpful.
Old 07-28-2010, 04:15 PM   #25
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
At least they have different kernels. That should be useful in determining the different ports. Either that or the ATTRS{modalias} info. Looks like serial code to me.
 
Old 07-28-2010, 04:46 PM   #26
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
At least they have different kernels. That should be useful in determining the different ports.
No the "kernel" refers to the version of the linux kernel you are running. This will change as you update, it will not change with devices you plug in.

You should plug in your different devices that are handled by the pl2303 driver, and then determine if there is any difference between the ways they are seen by udevadm (code to do this is as above).

I strongly suspect that there will not be any useful difference to identify the device that is plugged in: It'll always be a "pl2303".

So maybe you'll have to resort to plugging things into a specific port, and using udevadm to search "up the tree" (as shown by the code in my previous posts) to determine the port the device is plugged into, and then make the appropriate link(s) based on that.

This is a difficult problem to solve. I currently have only one device that reports itself as a pl2303. It is my GPS receiver.

My distro (Ubuntu 10.04) assumes that a pl2303 device will be a GPS device, attached to /dev/ttyUSB0. So it fires up gpsd which interrogates it at /dev/ttyUSB0. The device at /dev/ttyUSB0 is sent stuff (by gpsd) to see if it answers correctly (my GPS device does). If it doesn't answer correctly, gpsd decides it is not a GPS device, so gives up quietly. This is good, and correct behaviour by gpsd

I do not know what devices you have connected through these "USB->Serial" connectors, so, as I said before. It's difficult for me to help you.

You could "come clean" and tell us the full story.

It might make everything easier.

Last edited by tredegar; 07-28-2010 at 04:48 PM. Reason: typo
 
Old 07-28-2010, 05:25 PM   #27
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
Ok no problem. I need to connect to three devices: the first is an HCS12 microprocessor and the other two are ax2850 motor drivers. This is what udevadm info gives with all three devices plugged in:

Code:
  looking at device '/devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="ftdi_sio"
    ATTRS{latency_timer}=="1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0':
    KERNELS=="7-2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="ftdi_sio"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{modalias}=="usb:v0403p6001d0400dc00dsc00dp00icFFiscFFipFF"
    ATTRS{supports_autosuspend}=="0"
    ATTRS{interface}=="USB HS SERIAL CONVERTER"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb7/7-2':
    KERNELS=="7-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}==" 44mA"
    ATTRS{urbnum}=="12"
    ATTRS{idVendor}=="0403"
    ATTRS{idProduct}=="6001"
    ATTRS{bcdDevice}=="0400"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="7"
    ATTRS{devnum}=="6"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="FTDI"
    ATTRS{product}=="USB HS SERIAL CONVERTER"
    ATTRS{serial}=="FTEMES2V"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb7':
    KERNELS=="usb7"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="117"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0001"
    ATTRS{bcdDevice}=="0206"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="7"
    ATTRS{devnum}=="1"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="2"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.31-22-generic uhci_hcd"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{serial}=="0000:00:1d.1"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1':
    KERNELS=="0000:00:1d.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2935"
    ATTRS{subsystem_vendor}=="0x1179"
    ATTRS{subsystem_device}=="0xff00"
    ATTRS{class}=="0x0c0300"
    ATTRS{irq}=="19"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{modalias}=="pci:v00008086d00002935sv00001179sd0000FF00bc0Csc03i00"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
but what does it all mean? I'm confused where the first port's info ends and the next one begins..

P.S. Thanks for your patience and understanding so far.
 
Old 08-04-2010, 01:07 PM   #28
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
What if I use ATTRS{devnum} in the rules? They all appear to be different values and it should be able to figure out which port is being referred to. Here are my rules:

Code:
KERNEL=="6-2", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ATTRS{devnum}=="7", SYMLINK="Driver12"
KERNEL=="6-1", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ATTRS{devnum}=="8", SYMLINK="Driver34"
KERNEL=="7-2", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{devnum}=="4", SYMLINK="HCS12"
 
Old 08-04-2010, 01:25 PM   #29
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Your HCS12 is easily identifiable because it has a unique Vendor:Product ID

Quote:
What if I use ATTRS{devnum} in the rules?
I don't know, but I suspect that devnum might change between boots - you'll have to experiment.

If you could find something in the udevadm output that referred to the physical location (Eg "second port from the left") of the device you could use that, as long as you always used the "correct" port - Again, I don't know.

There's a problem ( with pl2303's ) very similar to yours here No solution yet, but I think you should read it.
 
Old 08-05-2010, 05:52 PM   #30
ibwood
Member
 
Registered: Jul 2010
Posts: 46

Original Poster
Rep: Reputation: 15
I have decided to take a different approach, so I just bought a new device and replaced it with one of the identical USB-to-serial converters. Everything is unique now so this should work

Again, thanks a lot for your patience tredegar.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 10 com1 port will not connect to router console port using minicom rgjr979 Linux - Newbie 4 12-28-2009 06:35 PM
Toshiba Satellite USB does not work kaz2100 Linux - General 1 04-09-2005 08:09 PM
Toshiba Sattelite ext usb modem problem (no serial port) denzel Linux - Hardware 4 09-24-2003 03:19 AM
Toshiba Satellite bigredgiant1 Red Hat 8 09-02-2003 10:11 PM
Toshiba Satellite teamstatic84 Linux - Laptop and Netbook 1 07-21-2003 05:50 AM


All times are GMT -5. The time now is 10:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration