Re: Data toggles not reset on "set configuration" for ports handled by "xhci_hcd" driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 21, 2020 at 02:30:12PM +0200, Martin Thierer wrote:
> I'm debugging a problem with the "xum1541" usb adapter (used to
> interface with legacy cbm floppy drives), which doesn't work correctly
> when plugged into some usb ports but works fine in others.
> 
> The symptom of failure is that the host command only works the first
> time after the device has been plugged in.
> 
> This is what I found so far:
> 
> The device mostly uses bulk transfers for communication. After every
> start, the host program issues a "set configuration" command (even
> though the device only has a single configuration). On receiving the
> "set configuration" message, the firmware of the xum1541 device does
> an endpoint reset including a reset of the data toggles.
> 
> The problem is, that my host computer only seems to reset its data
> toggles when the device is plugged into a usb port that as per syslog
> uses the "ehci-pci" driver, while it does not in ports using the
> "xhci_hcd" driver.
> 
> That's why the data toggles get out of sync when the device is plugged
> into a port handled by the "xhci_hcd" driver and therefore stops
> working.
> 
> For now I try to work around this issue by avoiding the "set
> configuration" call altogether, but I'm still curious what the correct
> behaviour is.
> 
> The notion of a "set configuration" call that doesn't really change
> the configuration triggering a "lightweight reset" seems to be common,
> but I'm not sure if there's consensus what the reset should include.
> 
> So I'm not sure which behaviour (to reset the data toggles or not) is
> correct, but I think at least the linux kernel should behave
> consistently regardless of the usb driver / port used?

The USB 2.0 specification says (section 8.5.2):

	A bulk endpoint’s toggle sequence is initialized to DATA0 when 
	the endpoint experiences any configuration event (configuration 
	events are explained in Sections 9.1.1.5 and 9.4.5).

Section 9.1.1.5 says:

	Before a USB device’s function may be used, the device must be 
	configured. From the device’s perspective, configuration 
	involves correctly processing a SetConfiguration() request with 
	a non-zero configuration value. Configuring a device or changing 
	an alternate setting causes all of the status and configuration 
	values associated with endpoints in the affected interfaces to 
	be set to their default values. This includes setting the data 
	toggle of any endpoint using data toggles to the value DATA0.

Together these should explain the correct behavior.

> Is resetting the data toggles even handled by the driver (or by the
> hardware)?

The driver.

Alan Stern



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux