This patch adds the US_FL_IGNORE_RESIDUE flag for the TrekStor i.Beat
Joy 2.0. Original version of this patch was sent by Stefan Werner
<dustbln@gmx.de> with test/rediff/etc. by me.
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/unusual_devs.h | 7 +++++++
1 file changed, 7 insertions(+)
A while ago, Matthew Dharm wrote:
> Looks good. Tho, I would like to see a future patch to do two things:
> 1) Change comments from C++ style to C-style
> 2) Make sure we're naming consistently everywhere SCM, USBAT,
> USBAT-02 (most noticably needing fixing is the string used at
> transport-selection time, but a sweep of all uses to be consistent
> would be in order).
Sorry for the long delay, here is a patch to address this. I also clarified
some ATA/ATAPI wording + function names.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/shuttle_usbat.c | 306 ++++++++++++++++++++----------------
drivers/usb/storage/shuttle_usbat.h | 66 +++----
drivers/usb/storage/transport.h | 2
drivers/usb/storage/unusual_devs.h | 10 -
drivers/usb/storage/usb.c | 4
5 files changed, 213 insertions(+), 175 deletions(-)
There appears to be one more case where the HP8200 CD writer devices are
detected as flash readers - when the USB cable is replugged after use, with
the power cable still connected.
Oddly enough, the identify device command appears to 'fall through' when the
devices are in this state, the status register reading exactly the same opcode
as the command (0xA1) that was just executed.
I think it's safe to label this behaviour as specific to HP8200 devices, I
can't get the flash devices to respond like this.
This patch should solve the last of the HP8200 issues which have cropped up
recently.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/shuttle_usbat.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
the following patch splits the NOTE: in the Device Drivers->USB submenu of
Kconfig thus making the whole of it readable on 600x800 terminals.
(Otherwise, the line was too big and disappeared into nowhere.)
Signed-off-by: Borislav Petkov <petkov@uni-muenster.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
This one is a tiny patch adding one more device to the list. Please
apply. :)
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/net/pegasus.h | 2 ++
1 file changed, 2 insertions(+)
We would like to add a PID for the Pyramid Appliance Display, which works
on USB via FTDI_SIO.
Signed-off-by: Thomas Riewe <thomasr@pyramid.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ftdi_sio.c | 1 +
drivers/usb/serial/ftdi_sio.h | 3 +++
2 files changed, 4 insertions(+)
Also has the nice benefit of making sparc alignment issues go away.
Thanks to David Miller for pointing out the problems here.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hub.c | 22 ++++++++++++----------
drivers/usb/core/hub.h | 2 +-
2 files changed, 13 insertions(+), 11 deletions(-)
This patch (as566) converts the File-Storage gadget over to the kthread
API. The new code doesn't use kthread_stop because the control thread
needs to terminate asynchronously when it receives a signal.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/file_storage.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
This patch (as570) changes some comments in the uhci-hcd header file and
removes an unused declaration (something I forgot to erase in an earlier
patch).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/uhci-hcd.h | 91 +++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 42 deletions(-)
Because there is no bulk_interrupt_message() routine and no
USBDEVFS_INTERRUPT ioctl, people have been forced to abuse the
usb_bulk_message() routine and USBDEVFS_BULK by using them for interrupt
transfers as well as bulk transfers.
This patch (as567) formalizes this practice and adds code to
usb_bulk_message() for detecting when the target is really an interrupt
endpoint. If it is, the routine submits an interrupt URB (using the
default interval) instead of a bulk URB. In theory this should help HCDs
that don't like it when people try to mix transfer types, queuing both
periodic and non-periodic types for the same endpoint.
Not fully tested -- I don't have any programs that use USBDEVFS_BULK for
interrupt transfers -- but it compiles okay and normal bulk messages work
as well as before.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/message.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
Reject URBs to _all_ devices when their host controllers are suspended;
even root hub registers will be unavailable. Also, don't reject urbs
to root hubs in other cases; the only upstream link is through that
controller (on PCI or whatever SOC bus is in use).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.c | 28 ++++++++++++----------------
drivers/usb/core/urb.c | 3 ++-
2 files changed, 14 insertions(+), 17 deletions(-)
The way we're looking at USB suspend lately doesn't expect drivers to
call usb_suspend_device() or usb_resume_device() directly; that'll
be implicit when no interfaces are in use.
This patch removes those APIs from visibility outside usbcore.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
drivers/usb/core/hub.c | 12 ++++--------
drivers/usb/core/usb.h | 4 ++++
include/linux/usb.h | 5 -----
3 files changed, 8 insertions(+), 13 deletions(-)
This makes the isp116x driver stop using usb_suspend_device() and
usb_resume_device() ... usbcore now calls to the root hub methods,
removing the need for this. It also switches from keventd to khubd
for remote wakeup. (Compile tested.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/isp116x-hcd.c | 29 ++++-------------------------
drivers/usb/host/isp116x.h | 1 -
2 files changed, 4 insertions(+), 26 deletions(-)
The PCI "early usb handoff" quirk logic didn't work like "ohci-hcd" ...
This patch makes it do so by:
- Resetting the controller after kicking BIOS off, matching the
normal "chip in hardware reset" startup mode;
- Reporting any BIOS that borks this simple handoff; it's likely
got a few other surprises for us too.
- Ignoring that handoff on HPPA;
The diagnostic string is mostly shared with EHCI, saving a few bytes.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/pci-quirks.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
This simplifies the OHCI root hub suspend logic:
- Uses new usbcore root hub calls to make autosuspend work again:
* Uses a newish usbcore root hub wakeup mechanism,
making requests to khubd not keventd.
* Uses an even newer sibling suspend hook.
- Expect someone always made usbcore call ohci_hub_suspend() before bus
glue fires; and that ohci_hub_resume() is only called after that bus
glue ran. Previously, only CONFIG_USB_SUSPEND promised those things.
(Includes updates to PCI and OMAP bus glue.)
- Handle a not-noticed-before special case during resume from one of
the swsusp snapshots when using "usb-handoff": the controller isn't
left in RESET state. (A bug to fix in the usb-handoff code...)
Also cleans up a minor debug printk glitch, and switches an mdelay over
to an msleep (how did that stick around for so long?).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ohci-dbg.c | 4 ----
drivers/usb/host/ohci-hcd.c | 2 +-
drivers/usb/host/ohci-hub.c | 42 ++++++++++++------------------------------
drivers/usb/host/ohci-mem.c | 1 -
drivers/usb/host/ohci-omap.c | 36 ++++++++++++------------------------
drivers/usb/host/ohci-pci.c | 40 ++++++++--------------------------------
drivers/usb/host/ohci.h | 1 -
7 files changed, 33 insertions(+), 93 deletions(-)
This updates the PCI glue to address the new and simplified usbcore suspend
semantics, where CONFIG_USB_SUSPEND becomes irrelevant to HCDs because
hcd->hub_suspend() will always be called.
- Removes now-unneeded recursion support
- Go back to ignoring faults reported by the wakeup calls; we expect them
to fail sometimes, and that's just fine.
The PCI HCDs will need simple changes to catch up to this, like being able
to ignore the setting of CONFIG_USB_SUSPEND.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd-pci.c | 106 +++++++++++++++++++++------------------------
drivers/usb/core/hcd.h | 6 +-
2 files changed, 53 insertions(+), 59 deletions(-)
This patch associates hub suspend and resume logic (including for root hubs)
with CONFIG_PM -- instead of CONFIG_USB_SUSPEND as before -- thereby unifying
two troublesome versions of suspend logic into just one. It'll be easier to
keep things right from now on.
- Now usbcore _always_ calls hcd->hub_suspend as needed, instead of
only when USB_SUSPEND is enabled:
* Those root hub methods are now called from hub suspend/resume;
no more skipping between layers during device suspend/resume;
* It now handles cases allowed by sysfs or autosuspended root hubs,
by forcing the hub interface to resume too.
- All devices, including virtual root hubs, now get the same treatment
on their resume paths ... including re-activating all their interfaces.
Plus it gets rid of those stub copies of usb_{suspend,resume}_device(), and
updates the Kconfig to match the new definition of USB_SUSPEND: it provides
(a) selective suspend, downstream from hubs; and (b) remote wakeup, upstream
from any device configuration which supports it.
This calls for minor followup patches for most HCDs (and their PCI glue).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/Kconfig | 11 ++-
drivers/usb/core/hub.c | 163 +++++++++++++++++++++++++----------------------
2 files changed, 97 insertions(+), 77 deletions(-)
This patch collects various small updates related to root hubs, to shrink
later patches which build on them.
- For root hub suspend/resume support:
* Make the existing usb_hcd_resume_root_hub() routine respect pmcore
locking, exporting and using the dpm_runtime_resume() method.
* Add a new usb_hcd_suspend_root_hub() to pair with that routine.
(Essential to make OHCI autosuspend behave again...)
* HC_SUSPENDED by itself only refers to the root hub's downstream ports.
So let HCDs see root hub URBs unless the parent device is suspended.
- Remove an assertion we no longer need (and now, also don't want).
- Generic suspend/resume updates to work better with swsusp.
* Ignore the FREEZE vs SUSPEND distinction for hardware; trying to
use it breaks the swsusp snapshots it's supposed to help (sigh).
* On resume, mark devices as resumed right away, but then
do nothing else if the device is marked NOTATTACHED.
These changes shouldn't be very noticable by themselves.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/power/runtime.c | 1
drivers/usb/core/hcd.c | 64 ++++++++++++++++++++++++++++++++++++++-----
drivers/usb/core/hcd.h | 1
drivers/usb/core/hub.c | 45 ++++++++++++++++++++++++------
drivers/usb/core/usb.c | 20 +++++++++----
drivers/usb/core/usb.h | 1
6 files changed, 111 insertions(+), 21 deletions(-)
This cleans up a small recent FIXME, ensuring that all the HCDs provide
root hub suspend/resume methods. It also wraps the calls to those root
suspend routines just like on the PCI "USB_SUSPEND not defined" cases,
so non-PCI bus glue won't be as tempted to behave very differently.
Several of the SOC based OHCI drivers forgot to list those methods;
the patch also adds those missing declarations.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.c | 42 +++++++++++++++++++++++++---------------
drivers/usb/host/ohci-au1xxx.c | 5 ++++
drivers/usb/host/ohci-lh7a404.c | 5 ++++
drivers/usb/host/ohci-pxa27x.c | 1
drivers/usb/host/ohci-s3c2410.c | 1
drivers/usb/host/ohci-sa1111.c | 1
6 files changed, 40 insertions(+), 15 deletions(-)
This splits BIOS and PCI specific support out of ehci-hcd.c into
ehci-pci.c. It follows the model already used in the OHCI driver
so support for non-PCI EHCI controllers can be more easily added.
Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-hcd.c | 543 ++++++--------------------------------------
drivers/usb/host/ehci-pci.c | 414 +++++++++++++++++++++++++++++++++
drivers/usb/host/ehci.h | 1
3 files changed, 492 insertions(+), 466 deletions(-)
This patch (as563) splits the physical and logical framelist arrays in
uhci-hcd into two separate pieces. This will allow slightly better memory
utilization, since each piece is no larger than a single page whereas
before the whole thing was a little bigger than two pages. It also allows
the logical array to be allocated in non-DMA-coherent memory.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch (as562) removes from the uhci-hcd driver a few unused fields
and some unnecessary tests against NULL and assignments to NULL. In fact
it wasn't until fairly recently that the tests became unnecessary.
Before last winter it was possible that the driver's stop() routine would
get called even if the start() routine returned an error, but now that
can't happen. Hence there's no longer any need to check for partial
initialization.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This simplifies some of the PM-related #ifdeffing by recognizing
that USB_SUSPEND depends on PM. Also, OHCI drivers were often
testing for USB_SUSPEND when they should have tested just PM.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.c | 2 ++
drivers/usb/host/ohci-hcd.c | 2 +-
drivers/usb/host/ohci-hub.c | 4 ++--
drivers/usb/host/ohci-omap.c | 2 +-
drivers/usb/host/ohci-pci.c | 2 +-
drivers/usb/host/ohci-ppc-soc.c | 4 ++--
drivers/usb/host/ohci-pxa27x.c | 2 +-
drivers/usb/host/ohci-s3c2410.c | 3 +--
drivers/usb/host/ohci-sa1111.c | 2 +-
9 files changed, 12 insertions(+), 11 deletions(-)
This gets rid of some inconsistently duplicated logic to resume interfaces.
Similar code was in both finish_port_resume() and in usb_generic_resume().
Now there is just one copy of that code, accessed regardless of whether
CONFIG_USB_SUSPEND is enabled. Fault handling is also more consistent.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch removes the extra usb_suspend_device() parameter. The original
reason to pass that parameter was so that this routine could suspend any
active children. A previous patch removed that functionality ... leaving
no reason to pass the parameter. A close analogy is pci_set_power_state,
which doesn't need a pm_message_t either.
On the internal code path that comes through the driver model, the parameter
is now used to distinguish cases where USB devices need to "freeze" but not
suspend. It also checks for an error case that's accessible through sysfs:
attempting to suspend a device before its interfaces (or for hubs, ports).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hub.c | 34 +++++++++++++++++++++-------------
drivers/usb/core/usb.c | 23 +++++++++++++++++++++--
drivers/usb/host/ehci-hcd.c | 2 +-
drivers/usb/host/isp116x-hcd.c | 2 +-
drivers/usb/host/ohci-pci.c | 2 +-
include/linux/usb.h | 2 +-
6 files changed, 46 insertions(+), 19 deletions(-)
This patch removes some recursion in the CONFIG_USB_SUSPEND logic, which
suspended children (of devices or hubs) that weren't already suspended.
When it sees such cases, suspend now just fails cleanly.
That logic was not needed during system-wide sleep state transitions; and
given the current notions of how to manage selective suspend transitions,
we don't want it there either. Where it was particularly handy was coping
with various limitations of the sysfs "echo -n N > power/state" support.
(These include assuming that "N" is always meaningful to the driver; and
that drivers can only transition to state N from state zero.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This updates the handling of power state for USB interfaces.
- Formalizes an existing invariant: interface "power state" is a boolean:
ON when I/O is allowed, and FREEZE otherwise. It does so by defining
some inlined helpers, then using them.
- Adds a useful invariant: the only interfaces marked active are those
bound to non-suspended drivers. Later patches build on this invariant.
- Simplifies the interface driver API (and removes some error paths) by
removing the requirement that they record power state changes during
suspend and resume callbacks. Now usbcore does that.
A few drivers were simplified to address that last change.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hub.c | 33 +++++++++------------
drivers/usb/core/message.c | 1
drivers/usb/core/usb.c | 65 +++++++++++++++++++++++++++++++++----------
drivers/usb/core/usb.h | 18 +++++++++++
drivers/usb/input/hid-core.c | 2 -
drivers/usb/misc/usbtest.c | 10 ------
drivers/usb/net/pegasus.c | 2 -
drivers/usb/net/usbnet.c | 2 -
8 files changed, 85 insertions(+), 48 deletions(-)
This moves the PCI quirk handling for USB host controllers from the
PCI directory to the USB directory. Follow-on patches will need to:
(a) merge these copies with the originals in the HCD reset methods.
they don't wholly agree, despite doing the very same thing; and
(b) eventually change it so "usb-handoff" is the default, to help
get more robust USB/BIOS/input/... interactions.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/Makefile | 2
drivers/pci/quirks.c | 253 ---------------------------------------
drivers/usb/Makefile | 1
drivers/usb/host/Makefile | 5
drivers/usb/host/pci-quirks.c | 272 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 280 insertions(+), 253 deletions(-)
This patch adds endpoint information for both devices and interfaces to
sysfs. Previously it was only possible to get the endpoint information
from usbfs, and never possible to get any information on endpoint 0.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/sysfs.c | 195 ++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/usb.h | 4
2 files changed, 197 insertions(+), 2 deletions(-)
This patch enables direct kernel support for the Artemis
and ATIK astronomical based USB CCD cameras.
Since all communications with this camera are done via an
FTDI 245BM chip, it was only needed to specify the
ProductID and VendorID of all three devices.
In what tests are concerned, data was transfered from and
to the FTDI at the chips Top speed (360KB/s).
Signed-off-by: Rui Santos <rsantos@grupopie.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ftdi_sio.c | 3 +++
drivers/usb/serial/ftdi_sio.h | 13 +++++++++++++
2 files changed, 16 insertions(+)
This tweaks the EHCI reboot notifier to also halt the EHCI controller, and
makes that halt code force IRQs off. Both should always have been done.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-hcd.c | 8 ++++++++
1 file changed, 8 insertions(+)
In PM v1, all devices were called at SUSPEND_DISABLE level. Then
all devices were called at SUSPEND_SAVE_STATE level, and finally
SUSPEND_POWER_DOWN level. However, with PM v2, to maintain
compatibility for platform devices, I arranged for the PM v2
suspend/resume callbacks to call the old PM v1 suspend/resume
callbacks three times with each level in order so that existing
drivers continued to work.
Since this is obsolete infrastructure which is no longer necessary,
we can remove it. Here's an (untested) patch to do exactly that.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The previous patch adding the ability to nest struct class_device
changed the paramaters to the call class_device_create(). This patch
fixes up all in-kernel users of the function.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch teaches "usb_device" about the new driver model wakeup support:
- It updates device wakeup capabilities when entering a configuration
with the WAKEUP attribute;
- During suspend processing it consults the policy bit to see
whether it should enable wakeup for that device. (This resolves
a FIXME to not assume the answer is always "yes"; some devices
lie about supporting remote wakeup.)
Support for root hubs and the HCDs is separate (and more complex).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Patch from Ian Campbell
The sparse warning initially surfaced in sound/arm/pxa2xx-ac97.c
because it was using u32 * variables to hold the unsigned long *
register addresses.
I submitted an ALSA patch for this http://thread.gmane.org/gmane.linux.alsa.devel/27804 issue and it was suggested that it might be preferable to change the register
definitions to use u32.
Most other subarches seem to use u32 for their register type, at least
the ones which use a __REG macro (like the PXA) do. Nico indicated in
the thread above that he wouldn't mind this patch.
Changing the type required fixes for opposite warnings in the pxa2xx usb
gadget code but that was the only new warning introduced on defconfig
or lubbock, mainstone and our own PXA255 boards.
Signed-off-by: Ian Campbell <icampbell@arcom.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
During the development of an USB device I found a bug in the handling of
Highspeed HID devices in the kernel.
What happened?
Highspeed HID devices are correctly recognized and enumerated by the
kernel. But even if usbhid kernel module is loaded, no HID reports are
received by the kernel.
The output of the hardware USB analyzer told me that the host doesn't
even poll for interrupt IN transfers (even the "interrupt in" USB
transfer are polled by the host).
After some debugging in hid-core.c I've found the reason.
In case of a highspeed device, the endpoint interval is re-calculated in
driver/usb/input/hid-core.c:
line 1669:
/* handle potential highspeed HID correctly */
interval = endpoint->bInterval;
if (dev->speed == USB_SPEED_HIGH)
interval = 1 << (interval - 1);
Basically this calculation is correct (refer to USB 2.0 spec, 9.6.6).
This new calculated value of "interval" is used as input for
usb_fill_int_urb:
line 1685:
usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0,
hid_irq_in, hid, interval);
Unfortunately the same calculation as above is done a second time in
usb_fill_int_urb in the file include/linux/usb.h:
line 933:
if (dev->speed == USB_SPEED_HIGH)
urb->interval = 1 << (interval - 1);
else
urb->interval = interval;
This means, that if the endpoint descriptor (of a high speed device)
specifies e.g. bInterval = 7, the urb->interval gets the value:
hid-core.c: interval = 1 << (7-1) = 0x40 = 64
urb->interval = 1 << (interval -1) = 1 << (63) = integer overflow
Because of this the value of urb->interval is sometimes negative and is
rejected in core/urb.c:
line 353:
/* too small? */
if (urb->interval <= 0)
return -EINVAL;
The conclusion is, that the recalculaton of the interval (which is
necessary for highspeed) should not be made twice, because this is
simply wrong. ;-)
Re-calculation in usb_fill_int_urb makes more sense, because it is the
most general approach. So it would make sense to remove it from
hid-core.c.
Because in hid-core.c the interval variable is only used for calling
usb_fill_int_urb, it is no problem to remove the highspeed
re-calculation in this file.
Signed-off-by: Christian Krause <chkr@plauener.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>