-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUSB_Analysis
More file actions
1283 lines (863 loc) · 51.7 KB
/
Copy pathUSB_Analysis
File metadata and controls
1283 lines (863 loc) · 51.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
https://www.kernel.org/doc/Documentation/usb/usbmon.txt
http://www.linux-usb.org/usb.ids
mount -t debugfs none_debugs /sys/kernel/debug
modprobe usbmon
jaguar-ThinkPad-T540p usbmon # pwd
/sys/kernel/debug/usb/usbmon
jaguar-ThinkPad-T540p usbmon # ls
0s 0u 1s 1t 1u 2s 2t 2u 3s 3t 3u 4s 4t 4u
sysfs structures for Linux USB:
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
1-0:1.0 1-12:1.0 1-3 1-7 2-0:1.0 3-1 4-0:1.0 4-1:1.0 usb2 usb4
1-12 1-12:1.1 1-3:1.0 1-7:1.0 3-0:1.0 3-1:1.0 4-1 usb1 usb3
USB-controllers:
The names that begin with "usb" refer to USB controllers.
More accurately, they refer to the "root hub" associated with each controller.
usb1 ---> root hub of usb-controller. It's bus number is 1. //bus1-port0(not actually a port) is used to refer roothub of bus1
usb2 ---> root hub of usb-controller. It's bus number is 2
USB devices: bus-port.port.port....
eg: 1-2.3.1 ==> bus1(root-hub) - device plugged into port2 of root-hub.This device is another hub
=> device plugged into port3 of that hub.this device is another hub
==> device plugged into port1 of that hub.this device is not a hub.
simply 1-2.3.1 == device plugged into : bus1--port2 of root-hub .port3 of 1st level-hub . port1 of 2nd level hub.
1-12 ----> bus1 - port12 : device is attached to the port12 of roothub
4-1 ----> bus4 - port1 : device is attached to port1 of roothub
Interfaces of devices : bus-port.port.port..... :config.interface
Each interface gets its own entry in sysfs and can have its own driver.
eg: 1-2.3:1.0 ==> device plugged into : bus1--port2 of root-hub .port3 of 1st level-hub . port1 of 2nd level hub
device is using configuration 1 and this configuration has only a single interface, number 0.
1-12:1.1
Special case : ROOT-HUB's interface
A hub will never have more than a single interface; that's part of the USB spec.
But other devices can have multiple interfaces (and sometimes multiple configurations)
eg: "1-0:1.0" It refers to the root hub's interface.
This acts just like the interface in an actual hub an almost every respec
1-0:1.0 --> bus1-port0 is used to refer roothub of bus1 -- here roothub is part of controller,not actually a port.
2-0:1.0
3-0:1.0
4-0:1.0
jaguar@jaguar-ThinkPad-T540p ~ $ cat /sys/bus/usb/devices/1-3:1.0/bInterfaceClass
fe
jaguar@jaguar-ThinkPad-T540p ~ $ cat /sys/bus/usb/devices/1-3:1.0/bInterfaceNumber
00
jaguar@jaguar-ThinkPad-T540p ~ $ cat /sys/bus/usb/devices/1-3:1.0/bInterfaceProtocol
00
jaguar@jaguar-ThinkPad-T540p ~ $ cat /sys/bus/usb/devices/1-3:1.0/bInterfaceSubClass
01
jaguar@jaguar-ThinkPad-T540p ~ $ cat /sys/bus/usb/devices/1-3:1.0/bNumEndpoints
00
cat /proc/bus/usb/devices : find the T-line which corresponds tothe device
lsusb
# cat /sys/kernel/debug/usbmon/3u > /tmp/1.mon.out
to listen on a single bus, otherwise, to listen on all buses, type:
# cat /sys/kernel/debug/usbmon/0u > /tmp/1.mon.out
sudo tshark -D
jaguar@jaguar-ThinkPad-T540p ~ $ sudo tshark -D
Running as user "root" and group "root". This could be dangerous.
tshark: Lua: Error during loading:
[string "/usr/share/wireshark/init.lua"]:44: dofile has been disabled due to running Wireshark as superuser. See https://wiki.wireshark.org/CaptureSetup/CapturePrivileges for help in running Wireshark as an unprivileged user.
1. wlan0
2. nflog
3. nfqueue
4. pan1
5. usbmon1
6. usbmon2
7. usbmon3
8. usbmon4
9. any
10. lo (Loopback)
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 005: ID 0471:df55 Philips (or NXP) LPCXpresso LPC-Link
Bus 001 Device 004: ID 5986:026a Acer, Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
to capture 0471:df55 on bus 1 ----- in a file trace1.pcap
jaguar@jaguar-ThinkPad-T540p ~ $ tshark -i usbmon2 -w trace1.pcap
Capturing on 'usbmon2'
tshark: Couldn't run /usr/bin/dumpcap in child process: Permission denied
jaguar@jaguar-ThinkPad-T540p ~ $ sudo tshark -i usbmon1 -w ~/trace1.pcap
Running as user "root" and group "root". This could be dangerous.
tshark: Lua: Error during loading:
[string "/usr/share/wireshark/init.lua"]:44: dofile has been disabled due to running Wireshark as superuser. See https://wiki.wireshark.org/CaptureSetup/CapturePrivileges for help in running Wireshark as an unprivileged user.
Capturing on 'usbmon1'
tshark: The file to which the capture would be saved ("/home/jaguar/trace1.pcap") could not be opened: Permission denied.
When a device plugs into a port, the device’s pull-up brings its line high,
enabling the hub to detect that a device is attached
The hub detects the device.
Each hub uses its interrupt endpoint
to report events at the hub. The report indicates only whether the hub or a
port (and if so, which port) has experienced an event
URB-status-word:=>
(URB status, interval, start frame, and error count)
a letter/several numbers separated by colon
(all fields except the status are optional : Interval is printed only for interrupt and isochronous URBs. Start frame is printed only for
isochronous URBs,Error count is printed only for isochronous callback events.)
URB status : number
This field makes no sense for submissions
In case of a submission of a Control packet, this field contains a Setup Tag
if Setup Tag was 's': then only decode below
Setup packet : ( bmRequestType, bRequest, wValue, wIndex, wLength):as per USB-2.0.
ffff8801f6e0a6c0 3824618392 C Ii:1:001:1 0:2048 2 = 4000
explaination:
C - callback event
Ii:1:001:1 ==== Interrupt : IN : bus-1 : device-1 : endpoint-1 // bus1,dev-1 is HUB.
URB type and direction, Bus number, Device address, Endpoint number
0:2048
status-0: Interval-2048
---------------------------------------------------------------------------------------------------------
ffff8801f6e0a6c0 3824618402 S Ii:1:001:1 -115:2048 4 <
S - setup event
Ii:1:001:1 ==== Interrupt : IN : bus-1 : device-1 : endpoint-1 // bus1,dev-1 is HUB.
URB type and direction, Bus number, Device address, Endpoint number
-115:2048
status-EINPROGRESS: Interval-2048
4 <
requested data length =4
-----------------------------------------------------------------------------------------------------------------
ffff8800b5c8fa80 3824618413 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
S - setup event
Ci:1:001:0 ==== Control : IN : bus-1 : device-1 : endpoint-0
s
Setup Tag
a3 00 0000 0006 0004
bmRequestType = a3 , bRequest =00 , wValue=0000, wIndex=0006, wLength=0004
bmRequestType: direction of data flow, the type of request, and the recipient.
1(OUT/IN)010(standard/class-specific/vendor-specific)0011
a3 = 1010 0011 ===> 1(dev->host) 01(class) 00011(other element in device)
bRequest: 00 (GET_STATUS)
wValue : request-specific value -
wIndex : enpoint-index/interface-index --- endpoint 6 => port6
wLength: number of data bytes in the Data stage that follow
Data transactions occur in three phases: Token, Data, and Handshake.
All communication on the USB is host-directed.
In the Token phase, the host will generate a Token packet which will address a specific device/endpoint combination.
A Token packet can be IN, OUT, or SETUP.
IN : The host is requesting data from the addressed dev/ep.
OUT : The host is sending data to the addressed dev/ep.
SETUP: The host is transmitting control information to the device.
In the data phase, the transmitter will send one data packet.
For IN requests, the device may send a NAK or STALL packet during the data phase to
indicate that it isn’t able to service the token that it received.
in the Handshake phase the receiver can send an ACK, NAK, or STALL indicating the success or failure of the transaction.
All of the transfers described above follow this general scheme with the exception of the Isochronous transfer.
In this case, no Handshake phase occurs because it is more important to stream data out in a timely fashion.
It is acceptable to drop packets occasionally and there is no need to waste time by attempting to retransmit.
cat 1u > ~/link.mon
vusb-analyzer ~/link.mon
USB class/device drivers communicate with USB host controllers by submitting URBs.
Each URB request host controller to send/rxv data to/from an EP on device.
host controller schedules the request on the bus and notifies the driver when request completes.
URB submission to USB-subsystem:
usb_submit_urb : submits URB and transfers control of the URB ,describing that request ,to the USB subsystem
If the submission is successful, the complete callback from the URB will be called exactly once,
when the USB core and Host Controller Driver (HCD) are finished with the URB.
When the completion function is called, control of the URB is returned to the device driver which issued the request.
The completion handler may then immediately free or reuse that URB.
ffff8801f6e36480 1880200748 C Ii:1:001:1 0:2048 2 = 0800
ffff8801f6e36480 1880200759 S Ii:1:001:1 -115:2048 4 <
ffff8801f5393540 1880200792 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880200803 C Ci:1:001:0 0 4 = 01010100
ffff8801f5393540 1880200807 S Co:1:001:0 s 23 01 0010 0003 0000 0
ffff8801f5393540 1880200816 C Co:1:001:0 0 0
ffff8801f5393540 1880200824 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880200839 C Ci:1:001:0 0 4 = 01010000
ffff8801f5393540 1880230373 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880230388 C Ci:1:001:0 0 4 = 01010000
ffff8801f5393540 1880262368 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880262384 C Ci:1:001:0 0 4 = 01010000
ffff8801f5393540 1880294432 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880294460 C Ci:1:001:0 0 4 = 01010000
ffff8801f5393540 1880326439 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880326465 C Ci:1:001:0 0 4 = 01010000
ffff8801f5393540 1880326556 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8801f5393540 1880326586 C Co:1:001:0 0 0
ffff8801f5393540 1880382396 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880382426 C Ci:1:001:0 0 4 = 03051000
ffff8801f5393540 1880382439 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8801f5393540 1880382455 C Co:1:001:0 0 0
ffff8801f5393540 1880438526 S Ci:1:000:0 s 80 06 0100 0000 0040 64 <
ffff8801f5393540 1880438700 C Ci:1:000:0 0 18 = 12010002 00000040 710455df 01000000 0001
ffff8801f5393540 1880438780 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8801f5393540 1880438806 C Co:1:001:0 0 0
ffff8801f5393540 1880494395 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880494429 C Ci:1:001:0 0 4 = 03051000
ffff8801f5393540 1880494441 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8801f5393540 1880494456 C Co:1:001:0 0 0
ffff8801f5393540 1880566429 S Ci:1:010:0 s 80 06 0100 0000 0012 18 <
ffff8801f5393540 1880566631 C Ci:1:010:0 0 18 = 12010002 00000040 710455df 01000000 0001
ffff8801f5393540 1880566674 S Ci:1:010:0 s 80 06 0200 0000 0009 9 <
ffff8801f5393540 1880566863 C Ci:1:010:0 0 9 = 09021900 01010080 32
ffff8801f5393540 1880566897 S Ci:1:010:0 s 80 06 0200 0000 0019 25 <
ffff8801f5393540 1880567111 C Ci:1:010:0 0 25 = 09021900 01010080 32090400 0000fe01 00000721 01ffff00 08
ffff8801f5393600 1880567333 S Co:1:010:0 s 00 09 0001 0000 0000 0
ffff8801f5393600 1880567452 C Co:1:010:0 0 0
decoding URB with Id: ffff8801f5393540
ffff8801f5393540 1880200792 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
S: Event is an URB submission :
Ci:1:001:0 ==> driver is submitting control request for IN data to bus1-dev1-Ep0
s a3 00 0000 0003 0004 ==> setup-stage-data: bmRequestType,bRequest,wValue,wIndex,wLength
req-direction:dev-host,req for a specific class,req to other element in device.
request = GET_STATUS
Endpoint = 03 which is OUT ep
number of data bytes in the Data stage that follow = 4
===> Host initiated control transfer by sending setup type token packet.
token indicates device should transmit the status of EP-3
setup stage of Control-IN transfer is completed.
ffff8801f5393540 1880200803 C Ci:1:001:0 0 4 = 01010100
C : Event is URB-callback
C Ci:1:001:0 ==> call-back event of URB-submitted for control request for IN data to bus1-dev1-Ep0
0 => URB's status is success.
4 => data bytes recieved in the data stage .
01010100 ==> EP3 status of bus1-dev1
==> device recieved the control-IN request and replied with control-info requested,successfully.
ffff8801f5393540 1880200807 S Co:1:001:0 s 23 01 0010 0003 0000 0
setup stage of control-OUT request : to bus1-dev1-ep0 : host-dev-->clear-feature request for ep3
feature =10 (C_PORT_CONNECTION) , no data-stage follows
====> host sent control-OUT request to device asking for clear-C_PORT_CONNECTION : disable the feature(connection status)on ep3.
ffff8801f5393540 1880200816 C Co:1:001:0 0 0
--> call back event--of URB-submitted for OUT-control request--success.
ffff8801f5393540 1880200824 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880200839 C Ci:1:001:0 0 4 = 01010000
get-status( dev-->host),ep3
success : 01010000 -->
Above is repeted 5 times..
ffff8801f5393540 1880326556 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8801f5393540 1880326586 C Co:1:001:0 0 0
(host-->dev)Set_Feature : PORT_RESET -reset processing is not yet completed.
success.
ffff8801f5393540 1880382396 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880382426 C Ci:1:001:0 0 4 = 03051000
setup-CTRL-IN-Get_status of ep3
successfull - status = 03051000
ffff8801f5393540 1880382439 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8801f5393540 1880382455 C Co:1:001:0 0 0
setup-CTRL-out:CLEAR_FEATURE= C_PORT_RESET -
ffff8801f5393540 1880438526 S Ci:1:000:0 s 80 06 0100 0000 0040 64 <
ffff8801f5393540 1880438700 C Ci:1:000:0 0 18 = 12010002 00000040 710455df 01000000 0001
setup-CTRL-IN:
80= 1000 0000 = 1 00 0000 => dev->host,std-req,req to device.
06 --> get_descriptor
0100 -->00 01 --.> bDescriptorType =01 ==> device descriptor type.
64 bytes of data expecting in data stage
success : 18 bytes
ffff8801f5393540 1880438780 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8801f5393540 1880438806 C Co:1:001:0 0 0
h->dev:SET_FEATURE : PORT_RESET
ffff8801f5393540 1880494395 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8801f5393540 1880494429 C Ci:1:001:0 0 4 = 03051000
dev-->host GET_STATUS :ep3
ffff8801f5393540 1880494441 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8801f5393540 1880494456 C Co:1:001:0 0 0
host-->dev clear_feature -C_PORT_RESET
ffff8801f5393540 1880566429 S Ci:1:010:0 s 80 06 0100 0000 0012 18 <
ffff8801f5393540 1880566631 C Ci:1:010:0 0 18 = 12010002 00000040 710455df 01000000 0001
#########################################################################################
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 004: ID 5986:026a Acer, Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
|__ Port 7: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 12: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 12: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
1-0:1.0 1-12:1.0 1-7 2-0:1.0 3-1 4-0:1.0 4-1:1.0 usb2 usb4
1-12 1-12:1.1 1-7:1.0 3-0:1.0 3-1:1.0 4-1 usb1 usb3
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
usb1 --> usb controller
1-0:1.0 root-hub --part of usb1-controller/not a port
1-12 ----> Accer camera @ bus1-port12
1-12:1.0 -- interface 0 of accer camera to port 12 of bus1
1-12:1.1 -- interface 1 of accer camera to port 12 of bus1
1-7 -----validity sensors@ bus1-port7
1-7:1.0 ----validity sensors: bus1-port7
2-0:1.0
3-1
3-0:1.0
3-1:1.0
4-0:1.0
4-1:1.0
4-1
usb2 usb3 usb4
jaguar@jaguar-ThinkPad-T540p ~ $ ls -l /sys/bus/usb/devices/
total 0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12:1.1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-7
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-7:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-1 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-1:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb2 -> ../../../devices/pci0000:00/0000:00:14.0/usb2
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb4 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4
jaguar@jaguar-ThinkPad-T540p ~ $ ls -l /sys/bus/usb/drivers
total 0
drwxr-xr-x 2 root root 0 Aug 6 17:23 btusb
drwxr-xr-x 2 root root 0 Aug 6 17:23 hub
drwxr-xr-x 2 root root 0 Aug 6 17:23 uas
drwxr-xr-x 2 root root 0 Aug 6 17:23 usb
drwxr-xr-x 2 root root 0 Aug 6 17:23 usbfs
drwxr-xr-x 2 root root 0 Aug 6 17:23 usbhid
drwxr-xr-x 2 root root 0 Aug 6 17:23 usb-storage
drwxr-xr-x 2 root root 0 Aug 6 17:23 uvcvideo
jaguar@jaguar-ThinkPad-T540p ~ $ ls -l /sys/bus/usb/drivers/usb
total 0
lrwxrwxrwx 1 root root 0 Aug 6 17:24 1-12 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-12
lrwxrwxrwx 1 root root 0 Aug 6 17:24 1-7 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-7
lrwxrwxrwx 1 root root 0 Aug 6 17:24 3-1 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1
lrwxrwxrwx 1 root root 0 Aug 6 17:24 4-1 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1
--w------- 1 root root 4096 Aug 6 17:24 bind
--w------- 1 root root 4096 Aug 6 17:24 uevent
--w------- 1 root root 4096 Aug 6 17:24 unbind
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb1 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb2 -> ../../../../devices/pci0000:00/0000:00:14.0/usb2
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb3 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb4 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb4
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar-ThinkPad-T540p usbmon # cat ~/link.mon
ffff8801f6e36480 169368299 C Ii:1:001:1 0:2048 2 = 0800
ffff8801f6e36480 169368319 S Ii:1:001:1 -115:2048 4 <
ffff8800c8ce5000 169368408 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169368428 C Ci:1:001:0 0 4 = 01010100
ffff8800c8ce5000 169368438 S Co:1:001:0 s 23 01 0010 0003 0000 0
ffff8800c8ce5000 169368453 C Co:1:001:0 0 0
ffff8800c8ce5000 169368461 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169368503 C Ci:1:001:0 0 4 = 01010000
ffff8800c8ce5000 169398438 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169398468 C Ci:1:001:0 0 4 = 01010000
ffff8800c8ce5000 169430417 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169430443 C Ci:1:001:0 0 4 = 01010000
ffff8800c8ce5000 169462445 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169462480 C Ci:1:001:0 0 4 = 01010000
ffff8800c8ce5000 169494368 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169494390 C Ci:1:001:0 0 4 = 01010000
ffff8800c8ce5000 169494446 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8800c8ce5000 169494462 C Co:1:001:0 0 0
ffff8800c8ce5000 169550437 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169550465 C Ci:1:001:0 0 4 = 03051000
ffff8800c8ce5000 169550474 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8800c8ce5000 169550489 C Co:1:001:0 0 0
ffff8800c8ce5000 169606486 S Ci:1:000:0 s 80 06 0100 0000 0040 64 <
ffff8800c8ce5000 169606646 C Ci:1:000:0 0 18 = 12010002 00000040 710455df 01000000 0001
ffff8800c8ce5000 169606682 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8800c8ce5000 169606709 C Co:1:001:0 0 0
ffff8800c8ce5000 169662395 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8ce5000 169662426 C Ci:1:001:0 0 4 = 03051000
ffff8800c8ce5000 169662435 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8800c8ce5000 169662449 C Co:1:001:0 0 0
ffff8800c8ce5000 169734381 S Ci:1:014:0 s 80 06 0100 0000 0012 18 <
ffff8800c8ce5000 169734579 C Ci:1:014:0 0 18 = 12010002 00000040 710455df 01000000 0001
ffff8800c8ce5000 169734613 S Ci:1:014:0 s 80 06 0200 0000 0009 9 <
ffff8800c8ce5000 169734869 C Ci:1:014:0 0 9 = 09021900 01010080 32
ffff8800c8ce5000 169734921 S Ci:1:014:0 s 80 06 0200 0000 0019 25 <
ffff8800c8ce5000 169735169 C Ci:1:014:0 0 25 = 09021900 01010080 32090400 0000fe01 00000721 01ffff00 08
ffff8800c8ce59c0 169735461 S Co:1:014:0 s 00 09 0001 0000 0000 0
ffff8800c8ce59c0 169735565 C Co:1:014:0 0 0
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
|__ Port 3: Dev 14, If 0, Class=Application Specific Interface, Driver=, 480M
|__ Port 7: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 12: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 12: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 014: ID 0471:df55 Philips (or NXP) LPCXpresso LPC-Link
Bus 001 Device 004: ID 5986:026a Acer, Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
1-0:1.0 1-12:1.0 1-3 1-7 2-0:1.0 3-1 4-0:1.0 4-1:1.0 usb2 usb4
1-12 1-12:1.1 1-3:1.0 1-7:1.0 3-0:1.0 3-1:1.0 4-1 usb1 usb3
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls -l /sys/bus/usb/devices/
total 0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-12:1.1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.1
lrwxrwxrwx 1 root root 0 Aug 6 17:27 1-3 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-3
lrwxrwxrwx 1 root root 0 Aug 6 17:27 1-3:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-7
lrwxrwxrwx 1 root root 0 Aug 6 17:23 1-7:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-1 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 3-1:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 4-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1:1.0
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb2 -> ../../../devices/pci0000:00/0000:00:14.0/usb2
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Aug 6 17:23 usb4 -> ../../../devices/pci0000:00/0000:00:1d.0/usb4
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls -l /sys/bus/usb/drivers/usb
total 0
lrwxrwxrwx 1 root root 0 Aug 6 17:24 1-12 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-12
lrwxrwxrwx 1 root root 0 Aug 6 17:28 1-3 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-3
lrwxrwxrwx 1 root root 0 Aug 6 17:24 1-7 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-7
lrwxrwxrwx 1 root root 0 Aug 6 17:24 3-1 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1
lrwxrwxrwx 1 root root 0 Aug 6 17:24 4-1 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb4/4-1
--w------- 1 root root 4096 Aug 6 17:24 bind
--w------- 1 root root 4096 Aug 6 17:24 uevent
--w------- 1 root root 4096 Aug 6 17:24 unbind
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb1 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb2 -> ../../../../devices/pci0000:00/0000:00:14.0/usb2
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb3 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Aug 6 17:24 usb4 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb4
jaguar@jaguar-ThinkPad-T540p ~ $
###########################################################################################################3
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
|__ Port 7: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 12: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 12: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 004: ID 5986:026a Acer, Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
1-0:1.0 1-12 1-12:1.0 1-12:1.1 1-7 1-7:1.0 2-0:1.0 3-0:1.0 3-1 3-1:1.0 4-0:1.0 4-1 4-1:1.0 usb1 usb2 usb3 usb4
jaguar@jaguar-ThinkPad-T540p ~ $
usb1 --> usb controller
1-0:1.0 root-hub --part of usb1-controller/not a port
1-12 ----> Accer camera @ bus1-port12
1-12:1.0 -- interface 0 of accer camera to port 12 of bus1
1-12:1.1 -- interface 1 of accer camera to port 12 of bus1
1-7 -----validity sensors@ bus1-port7
1-7:1.0 ----validity sensors: bus1-port7
2-0:1.0
3-1
3-0:1.0
3-1:1.0
4-0:1.0
4-1:1.0
4-1
usb2 usb3 usb4
jaguar-ThinkPad-T540p usbmon # cat ~/link.mon
URB-ffff8801f6e36480
addressing bus1-dev1-ep1 rootHUB-ep1
ffff8801f6e36480 2403355872 C Ii:1:001:1 0:2048 2 = 0800
ffff8801f6e36480 2403355895 S Ii:1:001:1 -115:2048 4 <
Each hub uses its interrupt endpoint to report events at the hub.
The report indicates only whether the hub or a port (and if so, which port) has experienced an event.
-EINPROGRESS = - 115
- Out of memory (-ENOMEM)
- Unplugged device (-ENODEV)
- Stalled endpoint (-EPIPE)
- Too many queued ISO transfers (-EAGAIN)
- Too many requested ISO frames (-EFBIG)
- Invalid INT interval (-EINVAL)
- More than one packet for INT (-EINVAL)
URB- ffff8800c8c10900
addressing bus1-dev1-ep0 rootHUB-ep0
ffff8800c8c10900 2403355967 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403355987 C Ci:1:001:0 0 4 = 01010100
GET_STATUS
ffff8800c8c10900 2403355994 S Co:1:001:0 s 23 01 0010 0003 0000 0
ffff8800c8c10900 2403356008 C Co:1:001:0 0 0
CLEAR_FEATURE : C_PORT_CONNECTION
ffff8800c8c10900 2403356014 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403356025 C Ci:1:001:0 0 4 = 01010000
GET_STATUS
ffff8800c8c10900 2403386434 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403386460 C Ci:1:001:0 0 4 = 01010000
GET_STATUS
ffff8800c8c10900 2403418425 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403418450 C Ci:1:001:0 0 4 = 01010000
GET_STATUS
ffff8800c8c10900 2403450419 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403450442 C Ci:1:001:0 0 4 = 01010000
GET_STATUS
ffff8800c8c10900 2403482387 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403482408 C Ci:1:001:0 0 4 = 01010000
GET_STATUS
ffff8800c8c10900 2403482467 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8800c8c10900 2403482481 C Co:1:001:0 0 0
SET_FEATURE : PORT_RESET
ffff8800c8c10900 2403538391 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403538412 C Ci:1:001:0 0 4 = 03051000
GET_STATUS
ffff8800c8c10900 2403538420 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8800c8c10900 2403538431 C Co:1:001:0 0 0
CLEAR_FEATURE= C_PORT_RESET
addressing bus1-dev0-ep0 LPC-link-ep-0 (Univeral-address 0 on bus1)
ffff8800c8c10900 2403594509 S Ci:1:000:0 s 80 06 0100 0000 0040 64 <
ffff8800c8c10900 2403594674 C Ci:1:000:0 0 18 = 12010002 00000040 710455df 01000000 0001
GET_DESCRIPTOR : DEVICE_DESCRIPTOR
addressing bus1-dev1-ep0 rootHUB-ep-0
ffff8800c8c10900 2403594723 S Co:1:001:0 s 23 03 0004 0003 0000 0
ffff8800c8c10900 2403594740 C Co:1:001:0 0 0
SET_FEATURE : PORT_RESET
ffff8800c8c10900 2403650385 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ffff8800c8c10900 2403650407 C Ci:1:001:0 0 4 = 03051000
GET_STATUS
ffff8800c8c10900 2403650415 S Co:1:001:0 s 23 01 0014 0003 0000 0
ffff8800c8c10900 2403650428 C Co:1:001:0 0 0
CLEAR_FEATURE= C_PORT_RESET
addressing bus1-dev17-ep0 LPC-link-ep-0
ffff8800c8c10900 2403722370 S Ci:1:017:0 s 80 06 0100 0000 0012 18 <
ffff8800c8c10900 2403722547 C Ci:1:017:0 0 18 = 12010002 00000040 710455df 01000000 0001
GET_DESCRIPTOR=DEVICE
ffff8800c8c10900 2403722579 S Ci:1:017:0 s 80 06 0200 0000 0009 9 <
ffff8800c8c10900 2403722727 C Ci:1:017:0 0 9 = 09021900 01010080 32
GET_DESCRIPTOR=CONFIGURATION
CONFIGURATION DESCRIPTOR
bLength: 9
bDescriptorType: 0x02 (CONFIGURATION)
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
Configuration bmAttributes: 0x80 NOT SELF-POWERED NO REMOTE-WAKEUP
1... .... = Must be 1: Must be 1 for USB 1.1 and higher
.0.. .... = Self-Powered: This device is powered from the USB bus
..0. .... = Remote Wakeup: This device does NOT support remote wakeup
bMaxPower: 50 (100mA)
ffff8800c8c10900 2403722758 S Ci:1:017:0 s 80 06 0200 0000 0019 25 <
ffff8800c8c10900 2403722964 C Ci:1:017:0 0 25 = 09021900 01010080 32090400 0000fe01 00000721 01ffff00 08
GET_DESCRIPTOR=CONFIGURATION
CONFIGURATION DESCRIPTOR
bLength: 9
bDescriptorType: 0x02 (CONFIGURATION)
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
Configuration bmAttributes: 0x80 NOT SELF-POWERED NO REMOTE-WAKEUP
1... .... = Must be 1: Must be 1 for USB 1.1 and higher
.0.. .... = Self-Powered: This device is powered from the USB bus
..0. .... = Remote Wakeup: This device does NOT support remote wakeup
bMaxPower: 50 (100mA)
INTERFACE DESCRIPTOR (0.0): class Application Specific
bLength: 9
bDescriptorType: 0x04 (INTERFACE)
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 0
bInterfaceClass: Application Specific (0xfe)
bInterfaceProtocol: Device Firmware Upgrade (0x01)
bInterfaceProtocol: Unknown (0x00)
iInterface: 0
DFU Descriptor: DFU FUNCTIONAL
bLength: 7
bDescriptorType: 0x21 (DFU FUNCTIONAL)
0000 .... = Reserved: 0x00
.... 0... = Will Detach: False
.... .0.. = Manifestation Tolerant: False
.... ..0. = Can Upload: False
.... ...1 = Can Download: True
wDetachTimeOut: 65535
wTransferSize: 2048
URB-ffff8800c8c10780
addressing bus1-dev14-ep0 LPC-link-ep-0
ffff8800c8c10780 2403723183 S Co:1:017:0 s 00 09 0001 0000 0000 0
ffff8800c8c10780 2403723295 C Co:1:017:0 0 0
SET_CONFIGURATION
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
|__ Port 3: Dev 17, If 0, Class=Application Specific Interface, Driver=, 480M
|__ Port 7: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 12: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 12: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
jaguar@jaguar-ThinkPad-T540p ~ $ lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 017: ID 0471:df55 Philips (or NXP) LPCXpresso LPC-Link
Bus 001 Device 004: ID 5986:026a Acer, Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jaguar@jaguar-ThinkPad-T540p ~ $
jaguar@jaguar-ThinkPad-T540p ~ $ ls /sys/bus/usb/devices/
1-0:1.0 1-12:1.0 1-3 1-7 2-0:1.0 3-1 4-0:1.0 4-1:1.0 usb2 usb4
1-12 1-12:1.1 1-3:1.0 1-7:1.0 3-0:1.0 3-1:1.0 4-1 usb1 usb3
jaguar@jaguar-ThinkPad-T540p ~ $
all hubs only have one interface; the interrupt interface to notify of events on the hub
Root Hub: The USB controller implements a root hub
The hub driver lives in drivers/usb/core/hub.c.
The USB initialisation function starts up the khubd thread which waits for and handles USB events.
(drivers/usb/core/hub.c:usb_hub_init())
hub driver setup:
usb_init() ---> usb_hub_init()--->usb_register_driver(): adds itself(hub-driver) to the USB bus and sets up usb_probe_device()
The root hub setup : The Linux driver core goes through all devices on the PCI bus
including the USB host controller,and calls the probe() function registerd by deriver of host controller (uhci_hcd_init())
The USB host controller driver-->usb_hcd_pci_probe() --->does some generic setup, then calls back into the host driver start()
--->calls usb_add_hcd() which does some generic HCD setup and ends up calling register_root_hub().
register_root_hub() creates a new USB device and registers it with drivers/usb/core/hub.c
usb_new_device() first calls drivers/usb/core/config.c:usb_get_configuration which sets up the interface(Interrupt interface of hub)
for the device before registering with the Linux driver core via drivers/base/core/device_add()-->which rescans USB bus
Binding root hub to a driver:
USB core usb_init()-->usb_register_device_driver(): setting up usb_probe_device() --->driver_register
ore/device_add()-->which rescans USB bus-->driver core will now see this new device and start probing for a driver to handle it.
usb_probe_device() of The USB generic drive is called back.This converts the Linux driver core device back to a USB device
that was registered by register_root_hub()) and calls calls the drivers probe function generic_probe().
The role of the generic driver is to get the interfaces on the device up and running
Firstly it calls :choose_configuration() which simply reads through the device data and chooses a sane configuration
how does it know what is a sane configuration for the root hub? All the information has been "faked" for the root hub in drivers/usb/core/hcd.c:usb2_rh_dev_descriptor and the like. The root hub details are defined by the USB specification, so these can be kept statically.
usb_set_configuration() is called to set up the chosen configuration.
It uses the helper function usb_control_message() to send a message to the device about what configuration mode to go into
It then goes through the available interfaces setting up the kernel structures, and adds them with device_add().
When a new interface is added, the driver core will now try and find a driver to handle it.
When an interface driver is registered with drivers/usb/core/driver.c:usb_register_driver() it sets the probe function to drivers/usb/core/driver.c:usb_probe_interface().
driver core calls this function, and the first thing it does is checks the ID against the IDs the driver is happy to handle from the drivers id_table: usb_match_one_id() : match the class, subclass and protocol
The root hub is part of the hub class, so can be handled by the hub drive
drivers/usb/core/hub.c:hub_probe() will be called to get the hub driver to bind with the new hub
hub_probe() ---> hub_configure()
does some setup . Interesting is setting up Interrupt end point of roothub.
The interrupt end-point on a hub will send an event whenever something happens on the hub, such as a device being plugged in or unplugged.
Interrupt end-point is setup:
This is done by creating a URB and binding it to the end-point, asking that hub_irq be called whenever this URB is complete (e.g. when an event is received).
New events on the hub:
The root hub is setup and listening for new events -
plug in our device : host controller will raise an interrupt signalling that one of its ports has changed state.