Padma Kumar
Padma Kumar

Reputation: 20031

What is adb device -l listing?

adb devices -l
devices [-l]                  - list all connected devices
                                ('-l' will also list device qualifiers)

When I execute it I am getting like

padmakumar@padmakumar-desktop:~$ adb devices -l
List of devices attached 
Medfield14ABxxxx       device usb:2-1.5
Ztedfield14Axxxx       device usb:2-1.6
emulator-5554          device
015d2994ec2xxx         device usb:2-1.5 product:nakasi model:Nexus_7 device:grouper


Medfield14ABA072       device usb:1-1.1 ( changing to different port)

when I change to different port its displaying the bus number as 1 and 2 as displayed in lsusb command

what is this device usb:2-1.5 ,1.6 ,1.1 ?

so what this -l will do,whats the exact meaning for the device qualifiers?

I tried with lsusb but the information is different that adb device -l.

padmakumar@padmakumar-desktop:~$ lsusb
Bus 002 Device 008: ID 18d1:4e42 Google Inc. 
Bus 002 Device 005: ID 17ef:7470 Lenovo 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 046d:c03d Logitech, Inc. M-BT96a Pilot Optical Mouse
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Upvotes: 13

Views: 59064

Answers (2)

merovingen
merovingen

Reputation: 443

I ran into this same problem when automatically mount many devices. After much digging I found how to find the connection between the

adb devices -l 
List of devices attached 
XXXXXXXX       device usb:9-1.4 product:XXXXXXXXXXX
.............
XXXXXXXX       device usb:3-1 product:XXXXXXXXXXX

and

lsusb
Bus 009 Device 005: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)
.............
Bus 003 Device 003: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)

our MTP devices can be seen using the:

ls /dev | grep libmtp-
libmtp-3-1
.............
libmtp-9-1.4

and they on a bus:

ls -l /dev/libmtp-9-1.4
lrwxrwxrwx 1 root root /dev/libmtp-9-1.4 -> bus/usb/009/005

ls -l /dev/libmtp-3-1
lrwxrwxrwx 1 root root /dev/libmtp-3-1 -> bus/usb/003/003

Upvotes: 4

Jason Sankey
Jason Sankey

Reputation: 2338

It's the path of the device in the USB subsystem. For example 2-1.5 means controller 2, port 1, port 5. Between the two ports there must be a hub. This seems to match up with your lsusb output, which indicates Bus 002 Device 001 is a hub.

To find this out, I had a dig int the adb source code, and found this is referred to as the devpath. You can see how it is found in usb_linux.c. In summary, when a device is found the code resolves the symbolic link at /sys/dev/char/<major>:<minor> and takes the last path component as the devpath. If you run:

$ ls -l /sys/dev/char |grep usb

you can see the links point to /sys/devices/platform/... and you should see some of these paths end with components matching the devices. Finally I found a description of what these paths mean in this posting by Alan Stern.

Upvotes: 7

Related Questions