The USB composite framework https://lwn.net/Articles/395712/ USB in a NutShell http://www.beyondlogic.org/usbnutshell/usb1.shtml 1. fix https://lkml.org/lkml/2017/8/9/1160 1. why stopping adbd service will cause the usb state change? We've found that while in host mode on HiKey using Android, if one runs the command: stop adbd The existing usb devices being utilized in host mode are disconnected. This is most visible with usb networking devices. This seems to be due to adbd closing the file: /dev/usb-ffs/adb/ep0 Which calls ffs_ep0_release() and the following backtrace: [] dwc2_hsotg_ep_disable+0x148/0x150 [] dwc2_hsotg_udc_stop+0x60/0x110 [] usb_gadget_remove_driver+0x58/0x78 [] usb_gadget_unregister_driver+0x74/0xe8 [] unregister_gadget+0x28/0x58 [] unregister_gadget_item+0x2c/0x40 [] ffs_data_clear+0xe8/0xf8 [] ffs_data_reset+0x20/0x58 [] ffs_data_closed+0x98/0xe8 [] ffs_ep0_release+0x20/0x30 Then when dwc2_hsotg_ep_disable() is called, we call kill_all_requests() which causes a bunch of the following messages: dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode init: Service 'adbd' (pid 1915) killed by signal 9 init: Sending signal 9 to service 'adbd' (pid 1915) process group... init: Successfully killed process cgroup uid 0 pid 1915 in 0ms init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029 dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length And the usb devices connected are basically hung at this point. It seems like if we're in host mode, we probably shouldn't run the dwc2_hostg_ep_disable logic, so this patch returns an error in that case. -------------------------- https://www.kernel.org/doc/Documentation/usb/functionfs.txt "ep0" is used for receiving events and handling setup requests. system/core/adb/adb.h hikey:/ # ls -l /dev/usb-ffs/adb/* -rw------- 1 shell shell 0 1970-01-01 00:00 /dev/usb-ffs/adb/ep0 -rw------- 1 shell shell 0 1970-01-01 00:14 /dev/usb-ffs/adb/ep1 -rw------- 1 shell shell 0 1970-01-01 00:14 /dev/usb-ffs/adb/ep2 hikey:/ # USB_FFS_ADB_EP0 / USB_FFS_ADB_OUT / USB_FFS_ADB_IN system/netd/server/CommandListener.cpp 127|hikey:/ # ls -l /sys/class/net/* lrwxrwxrwx 1 root root 0 1970-01-01 01:06 /sys/class/net/eth0 -> ../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.2/1-1.2:1.0/net/eth0 lrwxrwxrwx 1 root root 0 1970-01-01 00:00 /sys/class/net/lo -> ../../devices/virtual/net/lo lrwxrwxrwx 1 root root 0 1970-01-01 01:06 /sys/class/net/sit0 -> ../../devices/virtual/net/sit0 lrwxrwxrwx 1 root root 0 1970-01-01 01:06 /sys/class/net/wlan0 -> ../../devices/platform/soc/f723f000.dwmmc2/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/wl18xx.3.auto/net/wlan0 hikey:/ # android_work: did not send uevent (0 0 (null)) dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c0000.usb: dwc2_update_urb_state(): trimming xfer length asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x1404, offset 4 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 14 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200009 asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x0, offset 6 usb usb1-port1: Cannot enable. Maybe the USB cable is bad? usb usb1-port1: unable to enumerate USB device usb usb1-port1: disabled by hub (EMI?), re-enabling... ================= [ 96.444789] init: Service 'adbd' (pid 1881) killed by signal 9 [ 96.453015] init: processing action (init.svc.adbd=stopped) from (init.hikey.usb.rc:32) [ 96.463676] init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) [ 106.585981] init: starting service 'adbd'... [ 106.592537] init: property_set("ro.boottime.adbd", "106584125822") failed: property already set [ 106.594269] init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000 [ 106.608315] read descriptors [ 106.608327] read strings [ 106.617024] init: processing action (sys.usb.config=adb && sys.usb.configfs=1 && sys.usb.ffs.ready=1) from (/init.usb.configfs.rc:21) [ 106.631154] init: starting service 'mdnsd'... [ 106.637982] dwc2 f72c0000.usb: bound driver configfs-gadget ========================: 15:21:27 liu: master$ grep -rn USB_DWC2 out/target/product/hikey/obj/kernel/.config 3394:CONFIG_USB_DWC2=y 3395:# CONFIG_USB_DWC2_HOST is not set 3400:# CONFIG_USB_DWC2_PERIPHERAL is not set 3401:CONFIG_USB_DWC2_DUAL_ROLE=y 3402:# CONFIG_USB_DWC2_PCI is not set 3403:# CONFIG_USB_DWC2_DEBUG is not set 3404:# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set 15:21:49 liu: master$ 15:24:54 liu: master$ ll kernel/linaro/hisilicon/drivers/usb/ 总用量 128 drwxrwxr-x 24 liu liu 4096 Jul 21 15:17 ./ drwxrwxr-x 130 liu liu 4096 Jun 17 21:48 ../ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 atm/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 c67x00/ drwxrwxr-x 2 liu liu 4096 Jun 20 16:19 chipidea/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 class/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 common/ drwxrwxr-x 2 liu liu 4096 Jul 18 16:40 core/ drwxrwxr-x 2 liu liu 4096 Jul 21 15:24 dwc2/ drwxrwxr-x 2 liu liu 4096 Jun 28 13:02 dwc3/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 early/ drwxrwxr-x 5 liu liu 4096 Jun 28 13:02 gadget/ drwxrwxr-x 3 liu liu 4096 Jun 28 13:02 host/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 image/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 isp1760/ -rw-rw-r-- 1 liu liu 5490 Jun 17 21:48 Kconfig -rw-rw-r-- 1 liu liu 1642 Jun 17 21:48 Makefile drwxrwxr-x 3 liu liu 4096 Jun 17 21:48 misc/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 mon/ drwxrwxr-x 2 liu liu 4096 Jun 28 13:02 musb/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 phy/ -rw-rw-r-- 1 liu liu 2427 Jun 17 21:48 README drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 renesas_usbhs/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 serial/ drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 storage/ drwxrwxr-x 2 liu liu 4096 Jun 28 13:02 usbip/ -rw-rw-r-- 1 liu liu 15973 Jun 17 21:48 usb-skeleton.c drwxrwxr-x 2 liu liu 4096 Jun 17 21:48 wusbcore/ 15:25:16 liu: master$ 15:26:32 liu: master$ ll kernel/linaro/hisilicon/drivers/net/usb/asix* -rw-rw-r-- 1 liu liu 19353 Jun 17 21:48 kernel/linaro/hisilicon/drivers/net/usb/asix_common.c -rw-rw-r-- 1 liu liu 36456 Jun 17 21:48 kernel/linaro/hisilicon/drivers/net/usb/asix_devices.c -rw-rw-r-- 1 liu liu 8037 Jun 17 21:48 kernel/linaro/hisilicon/drivers/net/usb/asix.h 15:26:48 liu: master$ dm9601 1-1.2:1.0 eth0: register 'dm9601' at usb-f72c0000.usb-1.2, Davicom DM96xx USB 10/100 Ethernet, 00:e0:4c:53:44:5 kernel/linaro/hisilicon/drivers/net/usb/dm9601.c system/core/rootdir/init.usb.configfs.rc: on property:init.svc.adbd=stopped setprop sys.usb.ffs.ready 0 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} ==================== https://validation.linaro.org/scheduler/job/1565561/log_file#L_575_3: hi6220-hikey-01: hi6220-hikey-02: hi6220-hikey-05: hi6220-hikey-06: hi6220-hikey-07: hi6220-hikey-08: hi6220-hikey-10: asix 1-1.1:1.0 eth0: register 'asix' at usb-f72c0000.usb-1.1, ASIX AX88772B USB 2.0 Ethernet, 00:50:b6:14:c8:7c asix 1-1.1:1.0 eth0: unregister 'asix' usb-f72c0000.usb-1.1, ASIX AX88772B USB 2.0 Ethernet dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode android_work: did not send uevent (0 0 (null)) dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 14 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200009 dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200009 dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length https://validation.linaro.org/scheduler/job/1570927/log_file#L_1305_7 hi6220-hikey-03: hi6220-hikey-04: MOSCHIP usb-ethernet driver 1-1.1:1.0 eth0: unregister 'MOSCHIP usb-ethernet driver' usb-f72c0000.usb-1.1, MOSCHIP 7830/7832/7730 usb-NET adapter dwc2 f72c0000.usb: Set speed to high-speed usb 1-1: device descriptor read/64, error -110 usb 1-1: device not accepting address 7, error -110 usb usb1-port1: unable to enumerate USB device hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 usb usb1-port1: enable change, status 00000501 hub 1-0:1.0: hub_suspend hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 hub 1-0:1.0: port_wait_reset: err = -16 usb usb1-port1: not enabled, trying reset again... usb usb1-port1: debounce total 100ms stable 100ms status 0x501 hi6220-hikey-09: smsc75xx 1-1.1:1.0 eth0: register 'smsc75xx' at usb-f72c0000.usb-1.1, smsc75xx USB 2.0 Gigabit Ethernet, 80:3f:5d:08:5d:c Local side: [ 9.468395] dwc2 f72c0000.usb: bound driver configfs-gadget [ 12.008588] usb 1-1: unregistering device [ 12.163786] usb usb1-port1: debounce total 100ms stable 100ms status 0x101 [ 12.355669] dwc2 f72c0000.usb: Set speed to full-speed [ 12.361093] usb 1-1: new full-speed USB device number 7 using dwc2 [ 12.555569] dwc2 f72c0000.usb: Set speed to full-speed [ 12.580419] usb 1-1: not running at top speed; connect to a high speed hub [ 12.588483] usb 1-1: udev 7, busnum 1, minor = 6 [ 12.602661] hub 1-1:1.0: USB hub found [ 12.606870] hub 1-1:1.0: 3 ports detected [ 12.611013] hub 1-1:1.0: standalone hub [ 12.615196] hub 1-1:1.0: individual port power switching [ 12.620794] hub 1-1:1.0: individual port over-current protection [ 12.627065] hub 1-1:1.0: power on to power good time: 100ms [ 12.633161] hub 1-1:1.0: local power source is good [ 12.638517] hub 1-1:1.0: enabling power on all ports [ 12.644367] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 12.650056] usb usb1-port1: enable change, status 00000103 [ 12.752182] usb 1-1-port2: status 0101 change 0001 [ 12.859535] hub 1-1:1.0: state 7 ports 3 chg 0004 evt 0000 [ 12.865458] usb 1-1-port2: status 0101, change 0000, 12 Mb/s [ 12.951473] dwc2 f72c0000.usb: Set speed to full-speed [ 12.957875] usb 1-1.2: new full-speed USB device number 8 using dwc2 [ 13.051526] dwc2 f72c0000.usb: Set speed to full-speed [ 13.080452] usb 1-1.2: udev 8, busnum 1, minor = 7 [ 13.151144] dm9601 1-1.2:1.0 eth0: register 'dm9601' at usb-f72c0000.usb-1.2, Davicom DM96xx USB 10/100 Ethernet, 00:e0:4c:53:44:58 [ 13.164080] hub 1-1:1.0: state 7 ports 3 chg 0000 evt 0004 ------------------- [ 3470.193354] dwc2 f72c0000.usb: gintsts=14008029 gintmsk=d0bc3cc4 [ 3470.193377] dwc2 f72c0000.usb: ++Connector ID Status Change Interrupt++ (Host) [ 3470.193461] dwc2 f72c0000.usb: dwc2_conn_id_status_change() [ 3470.193486] dwc2 f72c0000.usb: gotgctl=2200000 [ 3470.193512] dwc2 f72c0000.usb: gotgctl.b.conidsts=0 [ 3470.193536] dwc2 f72c0000.usb: connId A [ 3470.193562] dwc2 f72c0000.usb: dwc2_core_init(ffffffc07410a018) [ 3470.255949] dwc2 f72c0000.usb: dwc2_hsotg_vbus_session: is_active: 0 [ 3470.256022] dwc2 f72c0000.usb: complete: ep ffffffc07434c418 ep0, req ffffffc074017e80, -108 => ffffff80087158a0 [ 3470.256064] dwc2 f72c0000.usb: dwc2_hsotg_complete_setup: failed -108 [ 3470.256128] dwc2 f72c0000.usb: complete: ep ffffffc07434c618 ep1out, req ffffffc070eb6400, -108 => ffffff800874aa7c [ 3470.256325] configfs-gadget gadget: reset config [ 3470.256360] dwc2 f72c0000.usb: dwc2_hsotg_ep_disable(ep ffffffc07434c618) [ 3470.256390] dwc2 f72c0000.usb: dwc2_hsotg_ep_disable: DxEPCTL=0x08000000 [ 3470.256421] dwc2 f72c0000.usb: dwc2_hsotg_ep_disable(ep ffffffc07434c518) [ 3470.256450] dwc2 f72c0000.usb: dwc2_hsotg_ep_disable: DxEPCTL=0x08000000 [ 3470.261564] android_work: sent uevent USB_STATE=DISCONNECTED [ 3470.352105] dwc2 f72c0000.usb: Internal DMA Mode [ 3470.352177] dwc2 f72c0000.usb: dma_enable:1 dma_desc_enable:0 [ 3470.352225] dwc2 f72c0000.usb: Using Buffer DMA mode [ 3470.352277] dwc2 f72c0000.usb: OTG VER PARAM: 0 [ 3470.352327] dwc2 f72c0000.usb: Host Mode [ 3470.407993] dwc2 f72c0000.usb: dwc2_hcd_start_func() ffffffc07410a018 [ 3470.408047] dwc2 f72c0000.usb: DWC OTG HCD START [ 3470.408119] dwc2 f72c0000.usb: dwc2_core_host_init(ffffffc07410a018) [ 3470.408148] dwc2 f72c0000.usb: Initializing HCFG.FSLSPClkSel to 00000000 [ 3470.408177] dwc2 f72c0000.usb: initial grxfsiz=00000800 [ 3470.408202] dwc2 f72c0000.usb: new grxfsiz=00000200 [ 3470.408229] dwc2 f72c0000.usb: initial gnptxfsiz=08000800 [ 3470.408255] dwc2 f72c0000.usb: new gnptxfsiz=02000200 [ 3470.408281] dwc2 f72c0000.usb: initial hptxfsiz=08001000 [ 3470.408306] dwc2 f72c0000.usb: new hptxfsiz=02000400 [ 3470.408357] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 0 [ 3470.408386] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 1 [ 3470.408413] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 2 [ 3470.408440] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 3 [ 3470.408468] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 4 [ 3470.408494] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 5 [ 3470.408521] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 6 [ 3470.408549] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 7 [ 3470.408576] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 8 [ 3470.408603] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 9 [ 3470.408631] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 10 [ 3470.408658] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 11 [ 3470.408685] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 12 [ 3470.408713] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 13 [ 3470.408740] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 14 [ 3470.408768] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 15 [ 3470.408795] dwc2 f72c0000.usb: Init: Port Power? op_state=9 [ 3470.408820] dwc2 f72c0000.usb: Init: Power Port (0) [ 3470.408846] dwc2 f72c0000.usb: dwc2_enable_host_interrupts() [ 3470.408873] dwc2 f72c0000.usb: DWC OTG HCD Has Root Hub [ 3470.408957] dwc2 f72c0000.usb: gintsts=05000021 gintmsk=f3000806 [ 3470.409070] usb usb1: usb wakeup-resume [ 3470.413264] hub 1-0:1.0: hub_resume [ 3470.419604] usb usb1-port1: status 0101 change 0001 [ 3470.424729] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_CONNECTION [ 3470.532038] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000 [ 3470.537937] usb usb1-port1: status 0101, change 0000, 12 Mb/s [ 3470.544092] dwc2 f72c0000.usb: SetPortFeature [ 3470.544143] dwc2 f72c0000.usb: SetPortFeature - USB_PORT_FEAT_RESET [ 3470.544195] dwc2 f72c0000.usb: In host mode, hprt0=00021501 [ 3470.615253] dwc2 f72c0000.usb: gintsts=05000021 gintmsk=f3000806 [ 3470.671985] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_RESET [ 3470.732415] dwc2 f72c0000.usb: Set speed to high-speed [ 3470.737877] usb 1-1: new high-speed USB device number 2 using dwc2 [ 3470.744679] dwc2 f72c0000.usb: SetPortFeature [ 3470.744731] dwc2 f72c0000.usb: SetPortFeature - USB_PORT_FEAT_RESET [ 3470.744783] dwc2 f72c0000.usb: In host mode, hprt0=00001101 [ 3470.744843] dwc2 f72c0000.usb: gintsts=05000029 gintmsk=f3000806 [ 3470.815915] dwc2 f72c0000.usb: gintsts=05000029 gintmsk=f3000806 [ 3470.876643] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_RESET [ 3470.924172] dwc2 f72c0000.usb: DWC OTG HCD HUB STATUS DATA: Root port status changed [ 3470.924325] dwc2 f72c0000.usb: port_connect_status_change: 0 [ 3470.924351] dwc2 f72c0000.usb: port_reset_change: 0 [ 3470.924375] dwc2 f72c0000.usb: port_enable_change: 1 [ 3470.924399] dwc2 f72c0000.usb: port_suspend_change: 0 [ 3470.924422] dwc2 f72c0000.usb: port_over_current_change: 0 [ 3470.936397] dwc2 f72c0000.usb: Set speed to high-speed [ 3470.942084] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv=ffffffc070d22c00 [ 3470.942163] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3470.942220] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3470.961452] usb 1-1: udev 2, busnum 1, minor = 1 [ 3470.982886] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x81 [ 3470.985608] hub 1-1:1.0: USB hub found [ 3470.989869] hub 1-1:1.0: 3 ports detected [ 3470.996579] hub 1-1:1.0: standalone hub [ 3471.000590] hub 1-1:1.0: individual port power switching [ 3471.006356] hub 1-1:1.0: individual port over-current protection [ 3471.013165] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x81, ep->hcpriv= (null) [ 3471.013185] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x81 [ 3471.013366] hub 1-1:1.0: TT per port [ 3471.017049] hub 1-1:1.0: TT requires at most 8 FS bit times (666 ns) [ 3471.023822] hub 1-1:1.0: power on to power good time: 100ms [ 3471.029805] hub 1-1:1.0: local power source is good [ 3471.035335] hub 1-1:1.0: enabling power on all ports [ 3471.040852] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 3471.046559] usb usb1-port1: enable change, status 00000503 [ 3471.052235] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_ENABLE [ 3471.147381] usb 1-1-port2: status 0101 change 0001 [ 3471.256737] hub 1-1:1.0: state 7 ports 3 chg 0004 evt 0000 [ 3471.263055] usb 1-1-port2: status 0101, change 0000, 12 Mb/s [ 3471.351681] dwc2 f72c0000.usb: Set speed to full-speed [ 3471.357559] usb 1-1.2: new full-speed USB device number 3 using dwc2 [ 3471.357762] dwc2 f72c0000.usb: dwc2_conn_id_status_change() [ 3471.357795] dwc2 f72c0000.usb: gotgctl=2200000 [ 3471.357824] dwc2 f72c0000.usb: gotgctl.b.conidsts=0 [ 3471.357851] dwc2 f72c0000.usb: connId A [ 3471.357882] dwc2 f72c0000.usb: dwc2_core_init(ffffffc07410a018) [ 3471.515995] dwc2 f72c0000.usb: Internal DMA Mode [ 3471.516065] dwc2 f72c0000.usb: dma_enable:1 dma_desc_enable:0 [ 3471.516112] dwc2 f72c0000.usb: Using Buffer DMA mode [ 3471.516163] dwc2 f72c0000.usb: OTG VER PARAM: 0 [ 3471.516212] dwc2 f72c0000.usb: Host Mode [ 3471.571994] dwc2 f72c0000.usb: dwc2_hcd_start_func() ffffffc07410a018 [ 3471.572055] dwc2 f72c0000.usb: DWC OTG HCD START [ 3471.572129] dwc2 f72c0000.usb: dwc2_core_host_init(ffffffc07410a018) [ 3471.572159] dwc2 f72c0000.usb: Initializing HCFG.FSLSPClkSel to 00000000 [ 3471.572188] dwc2 f72c0000.usb: initial grxfsiz=00000800 [ 3471.572214] dwc2 f72c0000.usb: new grxfsiz=00000200 [ 3471.572240] dwc2 f72c0000.usb: initial gnptxfsiz=08000800 [ 3471.572266] dwc2 f72c0000.usb: new gnptxfsiz=02000200 [ 3471.572292] dwc2 f72c0000.usb: initial hptxfsiz=08001000 [ 3471.572318] dwc2 f72c0000.usb: new hptxfsiz=02000400 [ 3471.572370] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 0 [ 3471.572399] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 1 [ 3471.572427] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 2 [ 3471.572454] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 3 [ 3471.572481] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 4 [ 3471.572508] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 5 [ 3471.572535] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 6 [ 3471.572563] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 7 [ 3471.572590] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 8 [ 3471.572617] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 9 [ 3471.572646] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 10 [ 3471.572673] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 11 [ 3471.572700] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 12 [ 3471.572727] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 13 [ 3471.572755] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 14 [ 3471.572782] dwc2 f72c0000.usb: dwc2_core_host_init: Halt channel 15 [ 3471.572808] dwc2 f72c0000.usb: Init: Port Power? op_state=9 [ 3471.572832] dwc2 f72c0000.usb: Init: Power Port (0) [ 3471.572858] dwc2 f72c0000.usb: dwc2_enable_host_interrupts() [ 3471.572885] dwc2 f72c0000.usb: DWC OTG HCD Has Root Hub [ 3471.573166] dwc2 f72c0000.usb: gintsts=05000021 gintmsk=f3000806 [ 3471.667911] dwc2 f72c0000.usb: DWC OTG HCD HUB STATUS DATA: Root port status changed [ 3471.668059] dwc2 f72c0000.usb: port_connect_status_change: 1 [ 3471.668085] dwc2 f72c0000.usb: port_reset_change: 0 [ 3471.668109] dwc2 f72c0000.usb: port_enable_change: 0 [ 3471.668133] dwc2 f72c0000.usb: port_suspend_change: 0 [ 3471.668157] dwc2 f72c0000.usb: port_over_current_change: 0 [ 3471.668538] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 3471.674556] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_CONNECTION [ 3471.674711] usb usb1-port1: status 0101, change 0001, 12 Mb/s [ 3471.680734] usb 1-1: USB disconnect, device number 2 [ 3476.456748] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3476.456877] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3476.456911] dwc2 f72c0000.usb: urb->status = -115 [ 3476.457168] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv=ffffffc033175400 [ 3476.457247] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.457303] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3476.457482] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.457546] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.457600] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3476.457738] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.457802] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.457856] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3476.458082] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.458146] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.458200] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3476.458455] usb 1-1: unregistering device [ 3476.463855] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3476.463966] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3476.463993] dwc2 f72c0000.usb: urb->status = -115 [ 3476.467610] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv=ffffffc070d22c00 [ 3476.467687] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3476.467750] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x81, ep->hcpriv=ffffffc070d22a00 [ 3476.616345] usb usb1-port1: debounce total 100ms stable 100ms status 0x101 [ 3476.623730] dwc2 f72c0000.usb: SetPortFeature [ 3476.623783] dwc2 f72c0000.usb: SetPortFeature - USB_PORT_FEAT_RESET [ 3476.623836] dwc2 f72c0000.usb: In host mode, hprt0=00021501 [ 3476.694396] dwc2 f72c0000.usb: gintsts=07000021 gintmsk=f3000806 [ 3476.752661] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_RESET [ 3476.812010] dwc2 f72c0000.usb: Set speed to full-speed [ 3476.817487] usb 1-1: new full-speed USB device number 7 using dwc2 [ 3476.825123] dwc2 f72c0000.usb: SetPortFeature [ 3476.825176] dwc2 f72c0000.usb: SetPortFeature - USB_PORT_FEAT_RESET [ 3476.825230] dwc2 f72c0000.usb: In host mode, hprt0=00021501 [ 3476.825291] dwc2 f72c0000.usb: gintsts=05000029 gintmsk=f3000806 [ 3476.876253] dwc2 f72c0000.usb: DWC OTG HCD HUB STATUS DATA: Root port status changed [ 3476.876374] dwc2 f72c0000.usb: port_connect_status_change: 0 [ 3476.876399] dwc2 f72c0000.usb: port_reset_change: 0 [ 3476.876423] dwc2 f72c0000.usb: port_enable_change: 1 [ 3476.876447] dwc2 f72c0000.usb: port_suspend_change: 0 [ 3476.876471] dwc2 f72c0000.usb: port_over_current_change: 0 [ 3476.876741] dwc2 f72c0000.usb: gintsts=05000029 gintmsk=f3000806 [ 3476.936376] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_RESET [ 3476.996553] dwc2 f72c0000.usb: Set speed to full-speed [ 3477.002579] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv=ffffffc070d22a00 [ 3477.002659] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3477.002716] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3477.020631] usb 1-1: not running at top speed; connect to a high speed hub [ 3477.028521] usb 1-1: udev 7, busnum 1, minor = 6 [ 3477.042953] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x81 [ 3477.048070] hub 1-1:1.0: USB hub found [ 3477.053250] hub 1-1:1.0: 3 ports detected [ 3477.057401] hub 1-1:1.0: standalone hub [ 3477.061369] hub 1-1:1.0: individual port power switching [ 3477.066829] hub 1-1:1.0: individual port over-current protection [ 3477.073558] hub 1-1:1.0: power on to power good time: 100ms [ 3477.079758] hub 1-1:1.0: local power source is good [ 3477.085111] hub 1-1:1.0: enabling power on all ports [ 3477.091025] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 3477.096731] usb usb1-port1: enable change, status 00000103 [ 3477.102525] dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_C_ENABLE [ 3477.195498] usb 1-1-port2: status 0101 change 0001 [ 3477.304649] hub 1-1:1.0: state 7 ports 3 chg 0004 evt 0000 [ 3477.311653] usb 1-1-port2: status 0101, change 0000, 12 Mb/s [ 3477.396285] dwc2 f72c0000.usb: Set speed to full-speed [ 3477.401741] usb 1-1.2: new full-speed USB device number 8 using dwc2 [ 3477.487734] dwc2 f72c0000.usb: Set speed to full-speed [ 3477.494281] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv=ffffffc070d27000 [ 3477.494364] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00, ep->hcpriv= (null) [ 3477.494421] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x00 [ 3477.520485] usb 1-1.2: udev 8, busnum 1, minor = 7 [ 3477.534962] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x81 [ 3477.535029] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x02 [ 3477.535086] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x83 [ 3477.542063] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x81, ep->hcpriv= (null) [ 3477.542139] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x02, ep->hcpriv= (null) [ 3477.542203] dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x83, ep->hcpriv= (null) [ 3477.542261] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x81 [ 3477.542316] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x02 [ 3477.542370] dwc2 f72c0000.usb: DWC OTG HCD EP RESET: bEndpointAddress=0x83 [ 3477.600092] type=1400 audit(1861.571:30): avc: denied { associate } for pid=1855 comm="Binder:1855_2" name="globalAlert" scontext=u:object_r:proc_net:s0 tcontext=u:object_r:proc:s0 tclass=filesystem permissive=1 [ 3477.606176] dm9601 1-1.2:1.0 eth0: register 'dm9601' at usb-f72c0000.usb-1.2, Davicom DM96xx USB 10/100 Ethernet, 00:e0:4c:53:44:58 [ 3477.633015] type=1400 audit(3482.995:31): avc: denied { module_request } for pid=1855 comm="Binder:1855_2" kmod="netdev-eth0" scontext=u:r:netd:s0 tcontext=u:r:kernel:s0 tclass=system permissive=1 [ 3477.709644] dm9601 1-1.2:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF [ 3477.779985] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3477.780028] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3477.780035] dwc2 f72c0000.usb: urb->status = -115 [ 3477.780067] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3477.780080] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3477.780085] dwc2 f72c0000.usb: urb->status = -115 [ 3477.780093] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3477.780122] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3477.780128] dwc2 f72c0000.usb: urb->status = -115 [ 3477.780150] dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue [ 3477.780163] dwc2 f72c0000.usb: Called usb_hcd_giveback_urb() [ 3477.780168] dwc2 f72c0000.usb: urb->status = -115 [ 3479.505966] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.512592] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.521505] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.528875] dwc2 f72c0000.usb: --Host Channel 12 Interrupt: Frame Overrun-- [ 3479.530430] dwc2 f72c0000.usb: --Host Channel 13 Interrupt: Frame Overrun-- [ 3479.530912] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.537445] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.544927] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.551399] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.558843] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.565127] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.572936] dm9601 1-1.2:1.0 eth0: kevent 4 may have been dropped [ 3479.620674] dm9601 1-1.2:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF [ 3479.755604] dm9601 1-1.2:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF [ 3480.809683] init: processing action (sys.sysctl.tcp_def_init_rwnd=*) from (/init.rc:689) [ 3492.217518] dwc2 f72c0000.usb: --Host Channel 13 Interrupt: Frame Overrun-- [ 3492.222763] dwc2 f72c0000.usb: --Host Channel 15 Interrupt: Frame Overrun-- [ 3492.223809] dwc2 f72c0000.usb: --Host Channel 5 Interrupt: Frame Overrun-- [ 3494.563634] dwc2 f72c0000.usb: --Host Channel 12 Interrupt: Frame Overrun-- ------------------------------------------------------------------------ "stop adbd" will cause "64 bytes from 192.168.0.103: icmp_seq=4982 ttl=64 time=3005 ms" hikey:/ # stop adbd [ 35.867371] init: Sending signal 9 to service 'adbd' (pid 1888) process group... [ 35.877885] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.890222] android_work: did not send uevent (0 0 (null)) [ 35.897499] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.904946] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.912467] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.919845] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.927230] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.934604] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.941981] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.949352] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.956763] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.964117] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.971490] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.978865] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.986240] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 35.993609] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.000968] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.008320] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.015680] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.023032] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.030389] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.037747] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.045103] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.052490] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.059849] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.067201] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.074578] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.082062] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.089678] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.098316] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode hikey:/ # [ 36.101325] init: Failed to kill process cgroup uid 0 pid 1888 in 226ms, 1 processes remain [ 36.115165] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 36.125091] init: Service 'adbd' (pid 1888) killed by signal 9 [ 36.131089] init: Sending signal 9 to service 'adbd' (pid 1888) process group... [ 36.139554] init: Successfully killed process cgroup uid 0 pid 1888 in 0ms [ 36.149212] init: processing action (init.svc.adbd=stopped) from (init.hikey.usb.rc:32) [ 36.157796] init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) 23:07:49 liu: master$ grep -rn "did not send uevent" kernel/linaro/hisilicon/drivers/usb/ kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1449: pr_info("%s: did not send uevent (%d %d %p)\n", __func__, 23:08:15 liu: master$ kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c #ifdef CONFIG_USB_CONFIGFS_UEVENT static void android_work(struct work_struct *data) { struct gadget_info *gi = container_of(data, struct gadget_info, work); struct usb_composite_dev *cdev = &gi->cdev; char *disconnected[2] = { "USB_STATE=DISCONNECTED", NULL }; char *connected[2] = { "USB_STATE=CONNECTED", NULL }; char *configured[2] = { "USB_STATE=CONFIGURED", NULL }; /* 0-connected 1-configured 2-disconnected*/ bool status[3] = { false, false, false }; unsigned long flags; bool uevent_sent = false; spin_lock_irqsave(&cdev->lock, flags); if (cdev->config) status[1] = true; if (gi->connected != gi->sw_connected) { if (gi->connected) status[0] = true; else status[2] = true; gi->sw_connected = gi->connected; } spin_unlock_irqrestore(&cdev->lock, flags); if (status[0]) { kobject_uevent_env(&android_device->kobj, KOBJ_CHANGE, connected); pr_info("%s: sent uevent %s\n", __func__, connected[0]); uevent_sent = true; } if (status[1]) { kobject_uevent_env(&android_device->kobj, KOBJ_CHANGE, configured); pr_info("%s: sent uevent %s\n", __func__, configured[0]); uevent_sent = true; } if (status[2]) { kobject_uevent_env(&android_device->kobj, KOBJ_CHANGE, disconnected); pr_info("%s: sent uevent %s\n", __func__, disconnected[0]); uevent_sent = true; } if (!uevent_sent) { pr_info("%s: did not send uevent (%d %d %p)\n", __func__, gi->connected, gi->sw_connected, cdev->config); } } #endif 127|hikey:/ # ls -l /config/usb_gadget/g1/ total 0 -rw-r--r-- 1 root root 4096 1970-01-01 00:00 UDC -rw-r--r-- 1 root root 4096 2017-07-26 15:22 bDeviceClass -rw-r--r-- 1 root root 4096 2017-07-26 15:22 bDeviceProtocol -rw-r--r-- 1 root root 4096 2017-07-26 15:22 bDeviceSubClass -rw-r--r-- 1 root root 4096 2017-07-26 15:22 bMaxPacketSize0 -rw-r--r-- 1 root root 4096 1970-01-01 00:00 bcdDevice -rw-r--r-- 1 root root 4096 1970-01-01 00:00 bcdUSB drwxr-xr-x 3 root root 0 1970-01-01 00:00 configs drwxr-xr-x 8 root root 0 1970-01-01 00:00 functions -rw-r--r-- 1 root root 4096 1970-01-01 00:00 idProduct -rw-r--r-- 1 root root 4096 1970-01-01 00:00 idVendor drwxr-xr-x 2 root root 0 1970-01-01 00:00 os_desc drwxr-xr-x 3 root root 0 1970-01-01 00:00 strings hikey:/ # hikey:/ # ls -l /sys/class/android_usb/ total 0 lrwxrwxrwx 1 root root 0 1970-01-01 00:00 android0 -> ../../devices/virtual/android_usb/android0 lrwxrwxrwx 1 root root 0 2017-07-26 15:24 f_audio_source -> ../../devices/virtual/android_usb/android0/f_audio_source lrwxrwxrwx 1 root root 0 2017-07-26 15:24 f_midi -> ../../devices/virtual/android_usb/android0/f_midi hikey:/ # ls -l /sys/class/android_usb/android0/ total 0 drwxr-xr-x 3 root root 0 1970-01-01 00:00 f_audio_source drwxr-xr-x 3 root root 0 1970-01-01 00:00 f_midi drwxr-xr-x 2 root root 0 2017-07-26 15:25 power -r--r--r-- 1 root root 4096 1970-01-01 00:00 state lrwxrwxrwx 1 root root 0 2017-07-26 15:25 subsystem -> ../../../../class/android_usb -rw-r--r-- 1 root root 4096 2017-07-26 15:25 uevent hikey:/ # 4.4 kernel [ 128.111096] /development/android/aosp/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c: 1475 configfs_composite_unbind [ 128.123869] android_work: did not send uevent (0 0 (null)) [ 128.130879] LIUYQ===/development/android/aosp/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c: 1253 purge_configs_funcs [ 128.142412] configfs-gadget gadget: unbind function 'Function FS Gadget'/ffffffc073114838 /development/android/aosp/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1255 -------------------------------------------------------------------- https://wiki.tizen.org/USB/Linux_USB_Layers/Configfs_Composite_Gadget/General_configuration USB/Linux USB Layers/Configfs Composite Gadget/General configuration Overview A USB Linux Gadget is a device which has a UDC (USB Device Controller) and can be connected to a USB Host to extend it with additional functions like a serial port or a mass storage capability. A gadget is seen by its host as a set of configurations, each of which contains a number of interfaces which, from the gadget's perspective, are known as functions, each function representing e.g. a serial connection or a SCSI disk. Linux provides a number of functions for gadgets to use. Creating a gadget means deciding what configurations there will be and which functions each configuration will provide. Configfs (please see Documentation/filesystems/configfs/*) lends itslef nicely for the purpose of telling the kernel about the above mentioned decision. This document is about how to do it. It also describes how configfs integration into gadget is designed. Requirements In order for this to work configfs must be available, so CONFIGFS_FS must be 'y' or 'm' in .config. As of this writing USB_LIBCOMPOSITE selects CONFIGFS_FS. Usage mount configfs $ modprobe libcomposite $ mount none $CONFIGFS_HOME -t configfs where CONFIGFS_HOME is the mount point for configfs 1. Creating the gadgets For each gadget to be created its corresponding directory must be created: $ mkdir $CONFIGFS_HOME/usb_gadget/ e.g.: $ mkdir $CONFIGFS_HOME/usb_gadget/g1 ... ... ... $ cd $CONFIGFS_HOME/usb_gadget/g1 Each gadget needs to have its vendor id and product id specified: $ echo > idVendor $ echo > idProduct A gadget also needs its serial number, manufacturer and product strings. In order to have a place to store them, a strings subdirectory must be created for each language, e.g.: $ mkdir strings/0x409 Then the strings can be specified: $ echo > strings/0x409/serialnumber $ echo > strings/0x409/manufacturer $ echo > strings/0x409/product 2. Creating the configurations Each gadget will consist of a number of configurations, their corresponding directories must be created: $ mkdir configs/. where can be any string which is legal in a filesystem and the is the configuration's number, e.g.: $ mkdir configs/c.1 Each configuration also needs its strings, so a subdirectory must be created for each language, e.g.: $ mkdir configs/c.1/strings/0x409 Then the configuration string can be specified: $ echo > configs/c.1/strings/0x409/configuration Some attributes can also be set for a configuration, e.g.: $ echo 120 > configs/c.1/MaxPower 3. Creating the functions The gadget will provide some functions, for each function its corresponding directory must be created: $ mkdir functions/. where corresponds to one of allowed function names and instance name is an arbitrary string allowed in a filesystem, e.g.: $ mkdir functions/ncm.usb0 # usb_f_ncm.ko gets loaded with request_module() Each function provides its specific set of attributes, with either read-only or read-write access. Where applicable they need to be written to as appropriate. Please refer to Documentation/ABI/*/configfs-usb-gadget* for more information. 4. Associating the functions with their configurations At this moment a number of gadgets is created, each of which has a number of configurations specified and a number of functions available. What remains is specifying which function is available in which configuration (the same function can be used in multiple configurations). This is achieved with creating symbolic links: $ ln -s functions/. configs/. e.g.: $ ln -s functions/ncm.usb0 configs/c.1 5. Enabling the gadget All the above steps serve the purpose of composing the gadget of configurations and functions. An example directory structure might look like this: . ./strings ./strings/0x409 ./strings/0x409/serialnumber ./strings/0x409/product ./strings/0x409/manufacturer ./configs ./configs/c.1 ./configs/c.1/ncm.usb0 -> ../../../../usb_gadget/g1/functions/ncm.usb0 ./configs/c.1/strings ./configs/c.1/strings/0x409 ./configs/c.1/strings/0x409/configuration ./configs/c.1/bmAttributes ./configs/c.1/MaxPower ./functions ./functions/ncm.usb0 ./functions/ncm.usb0/ifname ./functions/ncm.usb0/qmult ./functions/ncm.usb0/host_addr ./functions/ncm.usb0/dev_addr ./UDC ./bcdUSB ./bcdDevice ./idProduct ./idVendor ./bMaxPacketSize0 ./bDeviceProtocol ./bDeviceSubClass ./bDeviceClass Such a gadget must be finally enabled so that the USB host can enumerate it. In order to enable the gadget it must be bound to a UDC (USB Device Controller). $ echo > UDC where is one of those found in /sys/class/udc/* e.g.: $ echo s3c-hsotg > UDC 6. Disabling the gadget $ echo "" > UDC 7. Cleaning up Remove functions from configurations: $ rm configs/./ where . specify the configuration and is a symlink to a function being removed from the configuration, e.g.: $ rm configfs/c.1/ncm.usb0 Remove strings directories in configurations $ rmdir configs/./strings/ e.g.: $ rmdir configs/c.1/strings/0x409 and remove the configurations $ rmdir configs/. e.g.: rmdir configs/c.1 Remove functions (function modules are not unloaded, though) $ rmdir functions/. e.g.: $ rmdir functions/ncm.usb0 Remove strings directories in the gadget $ rmdir strings/ e.g.: $ rmdir strings/0x409 and finally remove the gadget: $ cd .. $ rmdir e.g.: $ rmdir g1 Implementation design Below the idea of how configfs works is presented. In configfs there are items and groups, both represented as directories. The difference between an item and a group is that a group can contain other groups. In the picture below only an item is shown. Both items and groups can have attributes, which are represented as files. The user can create and remove directories, but cannot remove files, which can be read-only or read-write, depending on what they represent. The filesystem part of configfs operates on config_items/groups and configfs_attributes which are generic and of the same type for all configured elements. However, they are embedded in usage-specific larger structures. In the picture below there is a "cs" which contains a config_item and an "sa" which contains a configfs_attribute. The filesystem view would be like this: File:Gadget fs view.jpg Whenever a user reads/writes the "sa" file, a function is called which accepts a struct config_item and a struct configfs_attribute. In the said function the "cs" and "sa" are retrieved using the well known container_of technique and an appropriate sa's function (show or store) is called and passed the "cs" and a character buffer. The "show" is for displaying the file's contents (copy data from the cs to the buffer), while the "store" is for modifying the file's contents (copy data from the buffer to the cs), but it is up to the implementer of the two functions to decide what they actually do. typedef struct configured_structure cs; typedef struc specific_attribute sa; File:Fun view.jpg The file names are decided by the config item/group designer, while the directories in general can be named at will. A group can have a number of its default sub-groups created automatically. For more information on configfs please see Documentation/filesystems/configfs/*. The concepts described above translate to USB gadgets like this: 1. A gadget has its config group, which has some attributes (idVendor, idProduct etc) and default sub-groups (configs, functions, strings). Writing to the attributes causes the information to be stored in appropriate locations. In the configs, functions and strings sub-groups a user can create their sub-groups to represent configurations, functions, and groups of strings in a given language. 2. The user creates configurations and functions, in the configurations creates symbolic links to functions. This information is used when the gadget's UDC attribute is written to, which means binding the gadget to the UDC. The code in drivers/usb/gadget/configfs.c iterates over all configurations, and in each configuration it iterates over all functions and binds them. This way the whole gadget is bound. 3. The file drivers/usb/gadget/configfs.c contains code for - gadget's config_group - gadget's default groups (configs, functions, strings) - associating functions with configurations (symlinks) 4. Each USB function naturally has its own view of what it wants configured, so config_groups for particular functions are defined in the functions implementation files drivers/usb/gadget/f_*.c. 5. Funciton's code is written in such a way that it uses usb_get_function_instance(), which, in turn, calls request_module. So, provided that modprobe works, modules for particular functions are loaded automatically. Please note that the converse is not true: after a gadget is disabled and torn down, the modules remain loaded. ------------------------------------------------------------------------------------------------------------------------------------------------ include/uapi/linux/usb/ch9.h /* USB 2.0 defines three speeds, here's how Linux identifies them */ enum usb_device_speed { USB_SPEED_UNKNOWN = 0, /* enumerating */ USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ USB_SPEED_HIGH, /* usb 2.0 */ USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ USB_SPEED_SUPER, /* usb 3.0 */ USB_SPEED_SUPER_PLUS, /* usb 3.1 */ }; ------------------------------------------------------------ /sys/class/udc/f72c0000.usb/current_speed hikey:/ # cat /sys/bus/usb/devices/*/product AX88772B DWC OTG Controller hikey:/ # ll /sys/bus/usb/devices/*/product -r--r--r-- 1 root root 4096 2017-08-08 09:28 /sys/bus/usb/devices/1-1.2/product -r--r--r-- 1 root root 4096 2017-08-08 09:14 /sys/bus/usb/devices/usb1/product hikey:/ # cat /sys/bus/usb/devices/*/manufacturer ASIX Elec. Corp. Linux 4.9.39-g5bc4705-dirty dwc2_hsotg hikey:/ # ll /sys/bus/usb/devices/*/manufacturer -r--r--r-- 1 root root 4096 2017-08-08 09:29 /sys/bus/usb/devices/1-1.2/manufacturer -r--r--r-- 1 root root 4096 2017-08-08 09:14 /sys/bus/usb/devices/usb1/manufacturer hikey:/ # ll /sys/bus/usb/devices/*/uevent -rw-r--r-- 1 root root 4096 1970-01-01 00:00 /sys/bus/usb/devices/1-0:1.0/uevent -rw-r--r-- 1 root root 4096 2017-08-08 09:20 /sys/bus/usb/devices/1-1.2/uevent -rw-r--r-- 1 root root 4096 2017-08-08 09:20 /sys/bus/usb/devices/1-1.2:1.0/uevent -rw-r--r-- 1 root root 4096 2017-08-08 09:20 /sys/bus/usb/devices/1-1/uevent -rw-r--r-- 1 root root 4096 2017-08-08 09:20 /sys/bus/usb/devices/1-1:1.0/uevent -rw-r--r-- 1 root root 4096 1970-01-01 00:00 /sys/bus/usb/devices/usb1/uevent hikey:/ # hikey:/ # cat /sys/bus/usb/devices/*/product AX88772B USB 2.0 10/100M Ethernet Adaptor DWC OTG Controller hikey:/ # hikey:/ # hikey:/ # hikey:/ # ll /sys/bus/usb/devices/*/product -r--r--r-- 1 root root 4096 2017-08-08 10:41 /sys/bus/usb/devices/1-1.1/product -r--r--r-- 1 root root 4096 2017-08-08 10:41 /sys/bus/usb/devices/1-1.2/product -r--r--r-- 1 root root 4096 1970-01-01 00:02 /sys/bus/usb/devices/usb1/product hikey:/ # ll -1d /sys/bus/usb/devices/* lrwxrwxrwx 1 root root 0 1970-01-01 00:02 /sys/bus/usb/devices/1-0:1.0 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-0:1.0 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1.1 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.1 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1.1:1.0 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.1/1-1.1:1.0 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1.2 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.2 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1.2:1.0 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.2/1-1.2:1.0 lrwxrwxrwx 1 root root 0 2017-08-08 10:41 /sys/bus/usb/devices/1-1:1.0 -> ../../../devices/platform/soc/f72c0000.usb/usb1/1-1/1-1:1.0 lrwxrwxrwx 1 root root 0 1970-01-01 00:02 /sys/bus/usb/devices/usb1 -> ../../../devices/platform/soc/f72c0000.usb/usb1 hikey:/ # lsusb Bus 001 Device 001: ID 1d6b:0002 Linux 4.9.39-g5bc4705-dirty dwc2_hsotg DWC OTG Controller Bus 001 Device 028: ID 0b95:772b ASIX Elec. Corp. AX88772B Bus 001 Device 027: ID 0424:2513 Bus 001 Device 029: ID 0fe6:9700 USB 2.0 10/100M Ethernet Adaptor hikey:/ # ----------------------------------- used by the adb command on host side system/core/adb/adb_io.cpp system/core/adb/adb_client.cpp ----------------------------------- hikey:/ # stop adbd [ 643.268789] init: Sending signal 9 to service 'adbd' (pid 1895) process group... [ 643.279810] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1183 ffs_epfile_release before call __ffs_epfile_read_buffer_free [ 643.296302] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1185 ffs_epfile_release before call ffs_data_closed [ 643.309995] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1183 ffs_epfile_release before call __ffs_epfile_read_buffer_free [ 643.324869] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1185 ffs_epfile_release before call ffs_data_closed [ 643.338568] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:620 ffs_ep0_release before call ffs_data_closed [ 643.351861] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1624 ffs_data_closed before call ffs_data_reset [ 643.365166] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1685 ffs_data_reset step into, and before call ffs_data_clear [ 643.379804] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1664 ffs_data_clear step into, and before call ffs_closed [ 643.393991] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:3732 ffs_closed before call unregister_gadget_item [ 643.407551] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1754 unregister_gadget_item in list_for_each_entry [ 643.420669] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:276 unregister_gadget [ 643.431241] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1366 usb_gadget_unregister_driver step into [ 643.443744] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1376 usb_gadget_unregister_driver before call usb_gadget_remove_driver [ 643.458628] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1231 147874216 [ 643.474540] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1235 147874216 after kobject_uevent [ 643.491713] dwc2 f72c0000.usb: /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/gadget.c:3559 dwc2_hsotg_pullup: is_on: 0 op_state: 9 [ 643.495442] init: Failed to kill process cgroup uid 0 pid 1895 in 218ms, 1 processes remain [ 643.514934] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1237 147874216 after usb_gadget_disconnect [ 643.532722] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c: 1547 step into android_disconnect [ 643.544551] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1414 android_work step into [ 643.555659] android_work: did not send uevent (0 0 (null)) /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1462 [ 643.555824] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1239 147874216 after udc->driver->disconnect(udc->gadget); [ 643.555846] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c: 1479 configfs_composite_unbind [ 643.556167] BUG: recent printk recursion! [ 643.556172] configfs-gadget gadget: unbind function 'Function FS Gadget'/ffffffc072b01e38 /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/configfs.c:1256 [ 643.556173] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1241 147874216 after udc->driver->unbind(udc->gadget); [ 643.556180] dwc2 f72c0000.usb: /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/gadget.c:3509 dwc2_hsotg_udc_stop [ 643.556749] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 643.556771] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 643.556785] configfs-gadget f72c0000.usb: unregistering UDC driver [g1], /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1243 147874216 after usb_gadget_udc_stop(udc); [ 643.556792] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1378 usb_gadget_unregister_driver set to USB_STATE_NOTATTACHED via usb_gadget_set_state [ 643.556795] dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode [ 643.556811] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/udc/core.c:1393 usb_gadget_unregister_driver in list_for_each_entry [ 643.556818] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:3734 ffs_closed after call unregister_gadget_item [ 643.556823] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1666 ffs_data_clear step into, and after call ffs_closed [ 643.556862] /development/android/master/kernel/linaro/hisilicon/drivers/usb/gadget/function/f_fs.c:1687 ffs_data_reset step into, and after call ffs_data_clear [ 643.558971] init: Service 'adbd' (pid 1895) killed by signal 9 [ 643.559000] init: Sending signal 9 to service 'adbd' (pid 1895) process group... [ 643.559170] init: Successfully killed process cgroup uid 0 pid 1895 in 0ms [ 643.561291] init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) [ 643.760043] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 643.760103] usb usb1-port1: enable change, status 00000101 /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:5060 port_event [ 643.760137] usb usb1-port1: disabled by hub (EMI?), re-enabling... /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:5070 port_event [ 643.760144] usb usb1-port1: status 0101, change 0002, 12 Mb/s [ 643.760154] usb 1-1: set to USB_STATE_NOTATTACHED via usb_set_device_state /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2104 usb_disconnect [ 643.760162] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:1919 recursively_mark_NOTATTACHED set to USB_STATE_NOTATTACHED via udev->state [ 643.760166] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:1919 recursively_mark_NOTATTACHED set to USB_STATE_NOTATTACHED via udev->state [ 643.760173] usb 1-1: USB disconnect, device number udev->devnum=2, udev->speed=2, USB_SPEED_HIGH=3, /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2107 usb_disconnect [ 643.760181] usb 1-1: change_bus_speed(hcd, 0) /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2112 usb_disconnect [ 643.760258] usb 1-1.1: set to USB_STATE_NOTATTACHED via usb_set_device_state /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2104 usb_disconnect [ 643.760266] usb 1-1.1: USB disconnect, device number udev->devnum=3, udev->speed=2, USB_SPEED_HIGH=3, /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2107 usb_disconnect [ 643.760273] usb 1-1.1: change_bus_speed(hcd, 0) /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2112 usb_disconnect [ 643.760280] usb 1-1.1: unregistering device [ 643.760803] asix 1-1.1:1.0 eth0: unregister 'asix' usb-f72c0000.usb-1.1, ASIX AX88772B USB 2.0 Ethernet [ 643.898905] dwc2 f72c0000.usb: Set speed to default high-speed via dwc2_change_bus_speed /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/hcd.c:4921 dwc2_free_dev [ 643.898925] usb 1-1: unregistering device [ 644.153177] usb usb1-port1: debounce total 175ms stable 100ms status 0x101 [ 644.160477] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4388 hub_port_init before calling hub_port_reset [ 644.364393] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2860 hub_port_reset before calling hcd->driver->reset_device [ 644.378093] dwc2 f72c0000.usb: Set speed to high-speed via dwc2_change_bus_speed /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/hcd.c:4934 dwc2_reset_device [ 644.394608] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2862 hub_port_reset after calling hcd->driver->reset_device [ 644.408007] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4390 hub_port_init after calling hub_port_reset retval=0 [ 644.421159] /development/android/master/kernel/linaro/hisilicon/drivers/usb/common/common.c:59 usb_speed_string speed=3 [ 644.432113] usb 1-1: new high-speed USB device number 4 using dwc2 /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4442 hub_port_init [ 644.447029] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4531 hub_port_init before calling hub_port_reset [ 644.648760] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2860 hub_port_reset before calling hcd->driver->reset_device [ 644.662459] dwc2 f72c0000.usb: Set speed to high-speed via dwc2_change_bus_speed /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/hcd.c:4934 dwc2_reset_device [ 644.679879] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2862 hub_port_reset after calling hcd->driver->reset_device [ 644.693507] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4533 hub_port_init after calling hub_port_reset retval=0 [ 644.727028] usb 1-1: udev 4, busnum 1, minor = 3 [ 644.748364] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c: 1666 step into hub_probe [ 644.759762] hub 1-1:1.0: USB hub found /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:1763 hub_probe [ 644.773421] hub 1-1:1.0: 3 ports detected [ 644.777610] hub 1-1:1.0: standalone hub [ 644.781603] hub 1-1:1.0: individual port power switching [ 644.787094] hub 1-1:1.0: individual port over-current protection [ 644.794446] hub 1-1:1.0: TT per port [ 644.798147] hub 1-1:1.0: TT requires at most 8 FS bit times (666 ns) [ 644.804636] hub 1-1:1.0: power on to power good time: 100ms [ 644.810869] hub 1-1:1.0: local power source is good [ 644.816346] hub 1-1:1.0: enabling power on all ports [ 644.822153] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 644.827780] usb usb1-port1: enable change, status 00000503 /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:5060 port_event [ 644.925259] usb 1-1-port1: status 0101 change 0001 [ 645.033080] hub 1-1:1.0: state 7 ports 3 chg 0002 evt 0000 [ 645.039543] usb 1-1-port1: status 0101, change 0000, 12 Mb/s [ 645.045693] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4388 hub_port_init before calling hub_port_reset [ 645.136056] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2860 hub_port_reset before calling hcd->driver->reset_device [ 645.149801] dwc2 f72c0000.usb: Set speed to high-speed via dwc2_change_bus_speed /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/hcd.c:4934 dwc2_reset_device [ 645.166316] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2862 hub_port_reset after calling hcd->driver->reset_device [ 645.180382] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4390 hub_port_init after calling hub_port_reset retval=0 [ 645.193646] /development/android/master/kernel/linaro/hisilicon/drivers/usb/common/common.c:59 usb_speed_string speed=3 [ 645.204656] usb 1-1.1: new high-speed USB device number 5 using dwc2 /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4442 hub_port_init [ 645.221339] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4531 hub_port_init before calling hub_port_reset [ 645.312039] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2860 hub_port_reset before calling hcd->driver->reset_device [ 645.325716] dwc2 f72c0000.usb: Set speed to high-speed via dwc2_change_bus_speed /development/android/master/kernel/linaro/hisilicon/drivers/usb/dwc2/hcd.c:4934 dwc2_reset_device [ 645.342861] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:2862 hub_port_reset after calling hcd->driver->reset_device [ 645.356277] /development/android/master/kernel/linaro/hisilicon/drivers/usb/core/hub.c:4533 hub_port_init after calling hub_port_reset retval=0 [ 645.400821] usb 1-1.1: udev 5, busnum 1, minor = 4 [ 645.858121] asix 1-1.1:1.0 eth0: register 'asix' at usb-f72c0000.usb-1.1, ASIX AX88772B USB 2.0 Ethernet, 00:00:00:00:67:13 [ 645.878835] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 647.420315] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 647.450520] asix 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 hikey:/ # ---------------------------------------------