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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1703132129450.16895-100000@netrider.rowland.org>
Date:   Mon, 13 Mar 2017 21:43:44 -0400 (EDT)
From:   Alan Stern <stern@...land.harvard.edu>
To:     Dave Mielke <dave@...lke.cc>
cc:     Samuel Thibault <samuel.thibault@...-lyon.org>,
        <gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <kevin.derome@...tech.eu>,
        <clause.andreabush@...il.com>, <mengualjeanphi@...e.fr>
Subject: Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk

On Sun, 12 Mar 2017, Dave Mielke wrote:

> [quoted lines by Alan Stern on 2017/03/12 at 21:40 -0400]
> 
> >No, I was wondering why an HID device would run at high speed.  Both
> >you and Samuel implied that this was because it was a USB-2 device.  
> >But that is not an adequate answer, because it is perfectly valid for a 
> >USB-2 device to run at full speed.
> 
> What should we look at to find out what speed it wants to operate at? We didn't 

The speed is reported in the kernel log and in 
/sys/kernel/debug/usb/devices.

> look into it becuaase the real problem, from our perspective, was that the 64ms 
> interval was being honoured by the host when it should be the 10ms as is 
> literally in the endpoint descriptor. Our assumption was that since it says 
> it's USB 2.0 then bInterval must be intterpreted in light of that regardless of 
> the actual speed used for communication.

You should read the USB specification.  Specifically, table 9-13 in 
section 9.6.6 describes bInterval like this (in part):

	Interval for polling endpoint for data transfers.
	Expressed in frames or microframes depending on the
	device operating speed (i.e., either 1 millisecond or
	125 μs units).

	For full-/high-speed isochronous endpoints, this value
	must be in the range from 1 to 16. The bInterval value
	is used as the exponent for a 2^(bInterval-1) value; e.g., a
	bInterval of 4 means a period of 8 (2^(4-1)).

	For full-/low-speed interrupt endpoints, the value of
	this field may be from 1 to 255.

	For high-speed interrupt endpoints, the bInterval value
	is used as the exponent for a 2^(bInterval-1) value; e.g., a
	bInterval of 4 means a period of 8 (2^(4-1)). This value
	must be from 1 to 16.

> Yes, I did know this, so maybe I misunderstood what you were wondering about.
> Were you wondering why 64ms was too long?

No.  I was wondering why an HID device would run at high speed.

> I think I've misunderstood something about how to interpret bInterval. I'm now 
> suspecting that bInterval must be interpreted the new (mocro frame) way only if 
> the device is operating at least at high speed, and that, even if the device 
> advertizes itself as USB 2.0, bInterval must still be interpreted the old way 
> if the device is operating at full or low speed. Is that correct?

Like I said, read the spec.

> If the above is correct, how can we tell from usbfs which way to 
> interpret bInterval?

There is an ioctl you can use to find the device speed: 
USBDEVFS_CONNECTINFO.  Unfortunately, this ioctl is badly out of date 
and only distinguishes between low speed and non-low speed.  A patch to 
remedy this situation would be welcome.

However, in general, users of usbfs don't need to know the device
speed.  In particular, you don't need to interpret bInterval.  Just
submit URBs quickly enough that the pipeline never empties out.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ