5

I have connected a android mobile phone to the Odroid through usb.

Now when I do 'lsusb' on Odroid then I get following output..

Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0001
Bus 001 Device 002: ID 0424:2514
Bus 001 Device 004: ID 0bdb:190d
Bus 001 Device 005: ID 1004:618e

sys/bus/usb/devices list down as follows,

usb1
1-0:1.0
usb2
2-0:1.0
1-1
1-1:1.0
1-1.1
1-1.1:1.0
1-1.1:1.1
1-1.1:1.2
1-1.1:1.3
1-1.1:1.4
1-1.1:1.5

Now i needed to know which one is built-in and which one is connected one...?

manually checking vendor-id and product id, I could tell that the last one in the lsusb is my android phone and similarly checking the "uevent" file inside "2-0:1.0" directory.

Programmatically i am parsing bDeviceClass, product, idVendor, product, manufacturer and other things to get the info.

But is there any flag or some extra info in files which tells me which usb is connected and which usb is built-in ?

Hope my question is clear.

g3rv4
  • 19,750
  • 4
  • 36
  • 58
Vijay C
  • 4,739
  • 4
  • 41
  • 46

1 Answers1

2

You can use output from dmesg to find out which is the connected one

   $ dmesg | grep usb
    [225415.950096] usb 1-1: new high speed USB device using ehci_hcd and address 10
    [225416.104344] usb 1-1: New USB device found, idVendor=0fce, idProduct=2149
    [225416.104358] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [225416.104369] usb 1-1: Product: SEMC HSUSB Device
    [225416.104376] usb 1-1: Manufacturer: SEMC
    [225416.104383] usb 1-1: SerialNumber: 43423531315133584454
    [225416.109151] scsi7 : usb-storage 1-1:1.1
    [226418.198922] usb 1-1: USB disconnect, address 10
  • Thanks for the reply.. but its very hard to tell from the output that which one is connected and which one is not... its not clearing mentioned...... Simultaneously its difficult to parse programatically as the output text is different in my Odroid. so it wont be generic... – Vijay C Feb 23 '12 at 07:14
  • Ok, np. I think you should try to clarify your question a bit. To me, it's unclear what you mean by "built in one". I can guess that it is a usb port, but its still a guess. If you ask in more general terms, then someone with sufficient knowledge of the linux kernel will tell you how to poll the usb-devices and their connection state. Good luck! – Ярослав Рахматуллин Feb 23 '12 at 09:52
  • check out the links in this post (http://www.cygnal.org/ubb/Forum9/HTML/001544.html) and look into hal and udev. – Ярослав Рахматуллин Feb 23 '12 at 09:57
  • Android does not have udev, it uses an init daemon "ueventd" to read uevents coming from the kernel through a netlink socket. – m-ric Oct 26 '12 at 17:57