What USB port am I connected to?

Alex Janssen alex at ourwoods.org
Sun Nov 4 16:47:41 UTC 2007


John Dangler said the following on 11/02/2007 10:28 AM:
>
> And dmesg will tell you exactly what dev you're dealing with...
>
> Jack - BB
>
> ----- Original Message -----
> From: ubuntu-users-bounces at lists.ubuntu.com 
> <ubuntu-users-bounces at lists.ubuntu.com>
> To: ubuntu-users at lists.ubuntu.com <ubuntu-users at lists.ubuntu.com>
> Sent: Fri Nov 02 10:00:22 2007
> Subject: Re: What USB port am I connected to?
>
> John Dangler wrote:
>
> > On Fri, 2007-11-02 at 00:05 -0400, Alex Janssen wrote:
> >> I want to communicate with a serial device over the USB that is not a
> >> recognized device.  It is a PLC(programmable logic controller). How do
> >> I
> >> tell which USB device file to open?  i.e.; /dev/bus/usb/002/001 or
> >> 002... .  Is there a way to tell what I'm plugged into?  Is there a
> >> USB
> >> howto for programmers?
> >
> > 2 ways that I know of....
> > plug in the device
> > go to a terminal, type dmesg and look at the last output...
> > OR
> > lsusb should also give you some indication
>
> lshal, and the various gui hal viewers, will give much more information
> about the actual /dev name.  lsusb will only tell you which _bus_ it's on
> (in the example /dev/bus/usb/002) but not the device number, because that
> autoincrements every time something's plugged in.
> --
> derek
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
Thanks to all of you for your input on this.  I tried lsusb, lshal and 
dmesg.  dmesg provided the most useful information.  It showed the 
device as follows:

[   22.444000] 
/build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: 
USB Serial support registered for pl2303
[   22.444000] pl2303 3-1:1.0: pl2303 converter detected
[   22.444000] usb 3-1: pl2303 converter now attached to ttyUSB0
[   22.444000] usbcore: registered new interface driver pl2303
[   22.444000] 
/build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/pl2303.c: 
Prolific PL2303 USB to serial adaptor driver

I can open ttyUSB0 with my program and read/write.  I can just make a 
static assignment within my python program, but I think I'd like to make 
it more dynamic and have my program figure out which port it's on.

In case anyone else wants it, there are some good python code pointers 
in a thread at 
http://lists.freedesktop.org/archives/hal/2005-January/001623.html.

Thanks, again for your help.  You got me on the right track.

Alex

-- 
Ourwoods.org
 When you fall off of a horse, don't get back on because the horse probably doesn't like you. - Chess Checkers (325)





More information about the ubuntu-users mailing list