lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8c2e18a9-44d1-47b3-8fe4-46bdc5be8d76@rowland.harvard.edu>
Date: Tue, 15 Apr 2025 12:14:58 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>
Cc: Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	Kever Yang <kever.yang@...k-chips.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Hervé Codina <herve.codina@...tlin.com>,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
	Stefan Wahren <wahrenst@....net>,
	Fabrice Gasnier <fabrice.gasnier@...s.st.com>
Subject: Re: DWC2 gadget: unexpected device reenumeration on Rockchip RK3308

On Tue, Apr 15, 2025 at 04:28:25PM +0200, Luca Ceresoli wrote:
> > > You should enable host-side debugging before connecting the cable:
> > > 
> > > 	echo 'module usbcore =p' >/sys/kernel/debug/dynamic_debug/control
> 
> Did that, and here is my host log:
> 
> ### First enumeration starts
> 
> [105021.069029] hub 3-3:1.0: state 7 ports 4 chg 0000 evt 0010
> [105021.076825] usb 3-3-port4: status 0101, change 0001, 12 Mb/s
> [105021.080244] usb 3-3-port4: indicator auto status 0
> [105021.190710] usb 3-3-port4: debounce total 100ms stable 100ms status 0x101
> [105021.286322] usb 3-3.4: new high-speed USB device number 87 using xhci_hcd
> [105021.396995] usb 3-3.4: skipped 1 descriptor after configuration
> [105021.397009] usb 3-3.4: skipped 4 descriptors after interface
> [105021.398516] usb 3-3.4: default language 0x0409
> [105021.403247] usb 3-3.4: udev 87, busnum 3, minor = 342
> [105021.403257] usb 3-3.4: New USB device found, idVendor=1209, idProduct=0001, bcdDevice= 1.00
> [105021.403262] usb 3-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [105021.403265] usb 3-3.4: Product: foobar
> [105021.403267] usb 3-3.4: Manufacturer: ACME
> [105021.403269] usb 3-3.4: SerialNumber: 12345678
> [105021.403762] usb 3-3.4: usb_probe_device
> [105021.403768] usb 3-3.4: configuration #1 chosen from 1 choice
> [105021.410537] usb 3-3.4: adding 3-3.4:1.0 (config #1, interface 0)
> [105021.412201] cdc_acm 3-3.4:1.0: usb_probe_interface
> [105021.412207] cdc_acm 3-3.4:1.0: usb_probe_interface - got id
> [105021.413917] cdc_acm 3-3.4:1.0: ttyACM0: USB ACM device
> [105021.413966] usb 3-3.4: adding 3-3.4:1.1 (config #1, interface 1)
> 
> ### 6 seconds delay, second enumeration starts
> 
> [105027.468951] hub 3-3:1.0: state 7 ports 4 chg 0000 evt 0010
> [105027.477656] usb 3-3-port4: status 0101, change 0001, 12 Mb/s
> [105027.481091] usb 3-3-port4: indicator auto status 0
> [105027.481116] usb 3-3.4: USB disconnect, device number 87
> [105027.481123] usb 3-3.4: unregistering device
> [105027.481128] usb 3-3.4: unregistering interface 3-3.4:1.0
> [105027.481803] usb 3-3.4: unregistering interface 3-3.4:1.1
> [105027.481899] usb 3-3.4: usb_disable_device nuking all URBs

This shows that as far as the host is concerned, the device was 
disconnected from the USB bus...

> [105027.591528] usb 3-3-port4: debounce total 100ms stable 100ms status 0x101
> [105027.686604] usb 3-3.4: new high-speed USB device number 88 using xhci_hcd
> [105027.797310] usb 3-3.4: skipped 1 descriptor after configuration
> [105027.797328] usb 3-3.4: skipped 4 descriptors after interface
> [105027.798834] usb 3-3.4: default language 0x0409
> [105027.803564] usb 3-3.4: udev 88, busnum 3, minor = 343
> [105027.803574] usb 3-3.4: New USB device found, idVendor=1209, idProduct=0001, bcdDevice= 1.00
> [105027.803578] usb 3-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [105027.803582] usb 3-3.4: Product: foobar
> [105027.803584] usb 3-3.4: Manufacturer: ACME
> [105027.803586] usb 3-3.4: SerialNumber: 12345678
> [105027.803919] usb 3-3.4: usb_probe_device
> [105027.803926] usb 3-3.4: configuration #1 chosen from 1 choice
> [105027.810831] usb 3-3.4: adding 3-3.4:1.0 (config #1, interface 0)
> [105027.812617] cdc_acm 3-3.4:1.0: usb_probe_interface
> [105027.812627] cdc_acm 3-3.4:1.0: usb_probe_interface - got id
> [105027.814357] cdc_acm 3-3.4:1.0: ttyACM0: USB ACM device
> [105027.814424] usb 3-3.4: adding 3-3.4:1.1 (config #1, interface 1)

and then reconnected.

> ### Second enumeration finished
> 
> Do you find useful hints in this log?
> 
> To me it doesn't, I'm afraid.

Not much, no.  There's no way to tell the reason for the disconnection.  
It could be something that the device did, or a problem with the cable 
(unlikely since it occurs regularly at 6-second intervals).

> > > It's quite possible that you're getting messed up by link power
> > > management (LPM).  But that's just a guess.
> 
> What would be a symptom, if that happened?

The debugging log wouldn't show much unless something went wrong.  You 
could see if there are any files containing "lpm" in their names in the 
/sys/bus/usb/devices/3-3.4/ directory (while the device is connected) 
and what they contain.  Also, there's a way to disable LPM on the host 
by setting a usbcore quirks module parameter:

	echo 1209:0001:k >/sys/module/usbcore/parameters/quirks

(1209 and 0001 are the device's vendor and product IDs, and k is the 
code for disabling LPM.)  You can do this before connecting the device 
and it will remain in effect until you reboot.

You could also try connecting a usbmon trace for bus 3, showing what 
happens during the initial connection and ensuing disconnection.  Any 
LPM transitions would show up in the trace.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ