What USB port am I connected to?
news at pointerstop.ca
Mon Nov 5 20:45:20 UTC 2007
Alex Janssen wrote:
> 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.
>> ubuntu-users mailing list
>> ubuntu-users at lists.ubuntu.com
>> Modify settings or unsubscribe at:
> 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]
> 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]
> 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.
It's actually easier to write a udev rule - look for the one (that doesn't
actually work...) that sets up a symlink for Palm
You can do something similar that would set a symlink from /dev/pl2303 to
whatever ttyUSB* device was actually being used. Then your program just
opens /dev/pl2303. The information you need to determine that it's a
pl2303 should be available from "lshal".
More information about the ubuntu-users