Rupesh Gujare <rgujare@xxxxxxxxxxxxxxx> wrote on 2012/04/04 10:36:12: > From: Rupesh Gujare <rgujare@xxxxxxxxxxxxxxx> > > On 03/04/12 20:07, Joakim Tjernlund wrote: > > Rupesh Gujare<rgujare@xxxxxxxxxxxxxxx> wrote on 2012/04/03 19:31:18: > >> On 03/04/12 17:56, Joakim Tjernlund wrote: > >>> Rupesh Gujare<rgujare@xxxxxxxxxxxxxxx> wrote on 2012/04/03 17:09:50: > >>>> On 03/04/12 15:39, Joakim Tjernlund wrote: > >>>>> We are just starting to look into the USB protocol and so got a question. > >>>>> > >>>>> We will have an USB HOST with a builtin USB hub with many ports and we need to find out which > >>>>> physical port an device is attached to. Is this possible? Does Linux support retrieving > >>>>> this port information? > >>>>> > >>>>> Jocke > >>>>> > >>>>> -- > >>>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in > >>>>> the body of a message to majordomo@xxxxxxxxxxxxxxx > >>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html > >>>>> > >>>> $sudo lsusb -v > >>>> $sudo lsusb -t > >>> Tried that but I don't quite get it. I can see > >>> Hub Port Status: > >>> Port 1: 0000.0100 power > >>> Port 2: 0000.0100 power > >>> Port 3: 0000.0100 power > >>> Port 4: 0000.0100 power > >>> Port 5: 0000.0303 lowspeed power enable connect > >>> Port 6: 0000.0100 power > >>> > >>> But I cannot match 0000.0303 to a device. Can you give me an example? > >>> > >>> Jocke > >>> > >>> > >> Did you tried $lsusb -t > > Yes, but mine look: > > lsusb -t > > Bus# 2 > > `-Dev# 1 Vendor 0x1d6b Product 0x0002 > > `-Dev# 2 Vendor 0x8087 Product 0x0024 > > Bus# 1 > > `-Dev# 1 Vendor 0x1d6b Product 0x0002 > > `-Dev# 2 Vendor 0x8087 Product 0x0024 > > `-Dev# 3 Vendor 0x03f0 Product 0x0024 > > > >> Following is output when I connect USB mass storage drive on port 4. :- > >> > >> $ sudo lsusb -t > >> /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M > >> |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M > >> |__ Port 4: Dev 5, If 0, Class=stor., Driver=usb-storage, 480M > >> > > hmm, wonder what the problem might be. I got: > > lsusb -V > > lsusb (usbutils) 004 > > > > Jocke > > > > > $lsusb -V > lsusb (usbutils) 001 > > Which kernel version & linux distribution are you working on ? > If you are on older one moving to newer version might help. gentoo with kernel 3.2.1 > > Can you find following device tree ? > /sys/bus/usb/devices/ Yes, lots of stuff there. ls /sys/bus/usb/devices/ 1-0:1.0 1-1 1-1:1.0 1-1.5 1-1.5:1.0 2-0:1.0 2-1 2-1:1.0 usb1 usb2 > > If I remember correctly 'lsusb' will read USB device information from > above tree. Here is a strace with lsusb 005, do you see what is up? strace -s 80 lsusb -t execve("/usr/bin/lsusb", ["lsusb", "-t"], [/* 50 vars */]) = 0 brk(0) = 0x973f000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a7000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=116216, ...}) = 0 mmap2(NULL, 116216, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb778a000 close(3) = 0 open("/usr/lib/libusb-1.0.so.0", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\263\21O4\0\0\0\274\307\0\0\0\0\0\0004\0 \0\6\0(\0\35\0\34\0\1\0\0\0\0\0\0\0\0\220\21O\0\220\21O\220\273\0\0\220\273\0\0\5\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=52292, ...}) = 0 mmap2(0x4f119000, 53620, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4f119000 mmap2(0x4f125000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb) = 0x4f125000 close(3) = 0 open("/lib/libz.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P[CA4\0\0\0\2447\1\0\0\0\0\0004\0 \0\7\0(\0\37\0\36\0\1\0\0\0\0\0\0\0\0@CA\0@CA\240(\1\0\240(\1\0\5\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=81020, ...}) = 0 mmap2(0x41434000, 82160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x41434000 mmap2(0x41447000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12) = 0x41447000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360C*A4\0\0\0\260\303\25\0\0\0\0\0004\0 \0\v\0(\0G\0F\0\6\0\0\0004\0\0\0004\240(A4\240(A`\1\0\0`\1\0\0\5\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1429192, ...}) = 0 mmap2(0x4128a000, 1432104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4128a000 mmap2(0x413e2000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x158) = 0x413e2000 mmap2(0x413e5000, 10792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x413e5000 close(3) = 0 open("/lib/librt.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220\316DA4\0\0\0\210y\0\0\0\0\0\0004\0 \0\n\0(\0#\0\"\0\6\0\0\0004\0\0\0004\260DA4\260DA@\1\0\0@\1\0\0\5\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=32512, ...}) = 0 mmap2(0x4144b000, 33392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4144b000 mmap2(0x41452000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6) = 0x41452000 close(3) = 0 open("/lib/libpthread.so.0", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\\?A4\0\0\0008k\1\0\0\0\0\0004\0 \0\n\0(\0&\0%\0\6\0\0\0004\0\0\0004\0?A4\0?A@\1\0\0@\1\0\0\5\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=94504, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7789000 mmap2(0x413f0000, 102924, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x413f0000 mprotect(0x41405000, 4096, PROT_NONE) = 0 mmap2(0x41406000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15) = 0x41406000 mmap2(0x41408000, 4620, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x41408000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7788000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb77886c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 mprotect(0x41406000, 4096, PROT_READ) = 0 mprotect(0x41452000, 4096, PROT_READ) = 0 mprotect(0x413e2000, 8192, PROT_READ) = 0 mprotect(0x41447000, 4096, PROT_READ) = 0 mprotect(0x4f125000, 4096, PROT_READ) = 0 mprotect(0x8060000, 4096, PROT_READ) = 0 mprotect(0x4f115000, 4096, PROT_READ) = 0 munmap(0xb778a000, 116216) = 0 set_tid_address(0xb7788728) = 10287 set_robust_list(0xb7788730, 0xc) = 0 futex(0xbf8804e0, FUTEX_WAKE_PRIVATE, 1) = 0 futex(0xbf8804e0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, bf8804f0) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRTMIN, {0x413f5670, [], SA_SIGINFO}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x413f56f0, [], SA_RESTART|SA_SIGINFO}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0 uname({sys="Linux", node="gentoo-jocke2", ...}) = 0 brk(0) = 0x973f000 brk(0x9760000) = 0x9760000 open("/usr/share/misc/usb.ids", O_RDONLY|O_LARGEFILE) = 3 _llseek(3, 0, [0], SEEK_CUR) = 0 read(3, "#\n#\tList of USB ID's\n#\n#\tMaintained by Stephen J. Gowdy <linux.usb.ids@xxxxxxxxx"..., 8192) = 8192 read(3, "Premium Starter Webcam\n\t1c02 PhotoSmart A710 series\n\t1c17 Color LaserJet 2550l"..., 16384) = 16384 read(3, "ra\n\t05af Digital Camera\n\t05b0 Digital Camera\n\t05b1 Digital Camera\n\t05b2 Digi"..., 16384) = 16384 read(3, "\n\t0061 X74 Hub\n\t0065 X5130\n\t0069 X74/X75 Printer\n\t006d X125\n\t006e C510\n\t007"..., 16384) = 16384 read(3, " LifeCam VX-7000 (UVC-compliant)\n\t0734 Wireless Optical Desktop 700\n\t0737 Comp"..., 16384) = 16384 read(3, " BlueTooth Keyboard and Mouse\n\t020b SK-3105 SmartCard Reader\n\t050e Internet C"..., 16384) = 16384 brk(0x9781000) = 0x9781000 read(3, " S1 IS\n\t309d Camera\n\t309f Camera\n\t30a0 Camera\n\t30a1 Camera\n\t30a2 Camera\n\t30"..., 16384) = 16384 read(3, "International\n04d1 ITT Canon\n04d2 Altec Lansing Technologies\n\t0070 ADA70 Spea"..., 16384) = 16384 read(3, "CP-129C\n\t01c2 DCP-131C\n\t01c3 DCP-329C\n\t01c4 DCP-331C\n\t01c5 MFC-239C\n\t01ca M"..., 16384) = 16384 read(3, "m 1\n\t0674 Multi-mode Camera\n\t0679 NMS Video Camera (Webcam)\n\t1002 Che-ez! Spl"..., 16384) = 16384 read(3, "dia Card Reader\n\t6386 Memory Card\n\t6387 Transcend JetFlash Flash Drive\n\t6390 "..., 16384) = 16384 brk(0x97a2000) = 0x97a2000 read(3, "TAD\n\t0350 Express Card\n\t0400 UFDC\n\t0401 UFDC\n\t0403 Locked B Device\n\t0405 Lo"..., 16384) = 16384 read(3, "L Adapter\n\td667 Efficient Networks Virtual Bus for ADSL Modem\n\te240 Speedstrea"..., 16384) = 16384 read(3, "JTAG Emulator\n\t3203 Rockchip Media Player\n\t32bb Music Mediatouch\n071c Xionics"..., 16384) = 16384 read(3, "wer Vampire\n07c1 Keisokugiken\n\t0068 HKS-0200 USBDAQ\n07c4 Datafab Systems, Inc"..., 16384) = 16384 read(3, "\n\t2000 OpenCom 1000\n086e System TALKS, Inc.\n\t1920 SGC-X2UL\n086f MEC IMEX, In"..., 16384) = 16384 read(3, "95b Medialogic Corp.\n095c K-Tec Electronics\n095d Polycom, Inc.\n\t0001 Polycom"..., 16384) = 16384 brk(0x97c3000) = 0x97c3000 read(3, "Card Reader\n\t2206 MMC/SD+MemoryStick Card Reader\n\t2301 SmartMedia+CompactFlash"..., 16384) = 16384 read(3, "nexx\n0bf6 Addonics Technologies, Inc.\n\t0103 Storage Device\n\t1234 Storage Devi"..., 16384) = 16384 read(3, "gies, Inc.\n0d56 AVLAB Technology, Inc.\n0d57 Solomon Microtech, Ltd\n0d5c SMC N"..., 16384) = 16384 read(3, ", Ltd\n0e9b ADTEC Corp.\n0e9c Streamzap, Inc.\n\t0000 Streamzap Remote Control\n0e"..., 16384) = 16384 read(3, "Optics Corp.\n109a DATASOFT Systems GmbH\n109f eSOL Co., Ltd\n\t3163 Trigem Mobil"..., 16384) = 16384 read(3, "c VFS471 Fingerprint Reader\n138e Jungo LTD\n\t9000 Raisonance S.A. STM32 ARM ev"..., 16384) = 16384 brk(0x97e4000) = 0x97e4000 read(3, "06 Edgeport/4i\n\t0207 Edgeport/2i\n\t020c Edgeport/421\n\t020d Edgeport/21\n\t020e "..., 16384) = 16384 read(3, "mer Infrared Receiver/Transceiver\n\t0702 Integrated Consumer Infrared Receiver/T"..., 16384) = 16384 read(3, "7050 Nova-T Stick\n\t7060 Nova-T Stick 2\n\t7070 Nova-T Stick 3\n\t7240 WinTV HVR-"..., 16384) = 16384 read(3, "\n\t0232 ARK3116 Serial\n6615 IRTOUCHSYSTEMS Co. Ltd.\n\t0001 Touchscreen\n6666 Pr"..., 16384) = 16384 read(3, "ace)\n\t02b Tab\n\t02c Space Bar\n\t02d - and _ (Minus and underscore)\n\t02e = and "..., 16384) = 16384 read(3, "035 Percent Load\n\t036 Temperature\n\t037 Humidity\n\t038 Bad Count\n\t040 Config "..., 16384) = 7157 read(3, "", 9227) = 0 read(3, "", 16384) = 0 close(3) = 0 open("/dev/bus/usb", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC) brk(0x980b000) = 0x980b000 getdents(3, /* 4 entries */, 32768) = 64 brk(0x9803000) = 0x9803000 close(3) = 0 clock_gettime(CLOCK_MONOTONIC, {3512495, 416315610}) = 0 uname({sys="Linux", node="gentoo-jocke2", ...}) = 0 stat64("/sys/bus/usb/devices", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open("/sys/bus/usb/devices", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 getdents(3, /* 12 entries */, 32768) = 220 stat64("/sys/bus/usb/devices/usb1/busnum", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 stat64("/sys/bus/usb/devices/usb1/devnum", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 stat64("/sys/bus/usb/devices/usb1/descriptors", {st_mode=S_IFREG|0444, st_size=65553, ...}) = 0 stat64("/sys/bus/usb/devices/usb1/bConfigurationValue", {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 close(3) = 0 pipe([3, 4]) = 0 timerfd_create(CLOCK_MONOTONIC, 0x800 /* TFD_??? */) = 5 access("/proc/bus/usb/devices", R_OK) = 0 open("/proc/bus/usb/devices", O_RDONLY|O_LARGEFILE) = 6 _llseek(6, 0, [0], SEEK_SET) = 0 read(6, "\nT: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 3\nB: Alloc= "..., 16383) = 1967 close(6) = 0 write(2, "Bus# 2\n", 8Bus# 2 ) = 8 write(2, "`-Dev# 1 Vendor 0x1d6b Product 0x0002\n", 40`-Dev# 1 Vendor 0x1d6b Product 0x0002 ) = 40 write(2, " `-Dev# 2 Vendor 0x8087 Product 0x0024\n", 42 `-Dev# 2 Vendor 0x8087 Product 0x0024 ) = 42 write(2, "Bus# 1\n", 8Bus# 1 ) = 8 write(2, "`-Dev# 1 Vendor 0x1d6b Product 0x0002\n", 40`-Dev# 1 Vendor 0x1d6b Product 0x0002 ) = 40 write(2, " `-Dev# 2 Vendor 0x8087 Product 0x0024\n", 42 `-Dev# 2 Vendor 0x8087 Product 0x0024 ) = 42 write(2, " `-Dev# 3 Vendor 0x03f0 Product 0x0024\n", 44 `-Dev# 3 Vendor 0x03f0 Product 0x0024 ) = 44 close(3) = 0 close(4) = 0 close(5) = 0 exit_group(0) = ? -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html