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>
Increased use of scatter-gather by usb-storage driver after 2.6.13 has
exposed a buggy codepath in isp116x-hcd, which was probably never
visited before: bug happened only for those urbs, for which
URB_SHORT_NOT_OK was set AND short transfer occurred.
The fix attached was tested in 2 ways: (a) it fixed failing
initialization of a flash drive with an embedded hub; (b) the fix was
tested with 'usbtest' against a modified g_zero driver (on top of
net2280), which generated short bulk IN transfers of various lengths
including multiples and non-multiples of max_packet_length.
Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Kernel version 2.6.13 introduced a regression in the generic USB
serial converter driver (usbserial.o, drivers/usb/serial/generic.c).
The bug manifests, as far as I can tell, whenever you attempt to write
to the device -- the write will never complete (write() returns 0, or
blocks).
Signed-off-by: Randall Nortman <oss@wonderclown.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
All the same issues - we can't just save the pointer to the thread, we
must save the pid/uid/euid combination.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
If a process issues an URB from userspace and (starts to) terminate
before the URB comes back, we run into the issue described above. This
is because the urb saves a pointer to "current" when it is posted to the
device, but there's no guarantee that this pointer is still valid
afterwards.
In fact, there are three separate issues:
1) the pointer to "current" can become invalid, since the task could be
completely gone when the URB completion comes back from the device.
2) Even if the saved task pointer is still pointing to a valid task_struct,
task_struct->sighand could have gone meanwhile.
3) Even if the process is perfectly fine, permissions may have changed,
and we can no longer send it a signal.
So what we do instead, is to save the PID and uid's of the process, and
introduce a new kill_proc_info_as_uid() function.
Signed-off-by: Harald Welte <laforge@gnumonks.org>
[ Fixed up types and added symbol exports ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
the free_irq() in USB suspend breaks resume on some setups where USB
(ohci/ehci) shares the interrupt with an other device.
Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
A bunch of create_proc_dir_entry() calls creating directories had crept
in since the last sweep; converted to proc_mkdir().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
It's pointless to include mach-types.h if you're not going to use
anything from it. These references were removed as a result of:
grep -lr 'asm/mach-types\.h' . | xargs grep -L 'machine_is_\|MACH_TYPE_\|MACHINE_START\|machine_type'
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Since asm/hardware.h's only reason for existing is to include
asm/arch/hardware.h, it's completely pointless to include both.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
USB: Add device id's for Novatel Wireless CDMA wireless PC card.
The Novatel CDMA card behaves the same as the AirPrime by providing
a USB serial port.
Signed-off-by: David Hollis <dhollis@davehollis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The card sometimes sends >2000 bytes in one single chunk. Ouch.
Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Addresses some small bugs in the pegasus ethernet-over-USB driver.
Specifically, malformed long packets from the adapter could cause a kernel
panic; the interrupt interval calculation was inappropriate for high-speed
devices; the return code from read_mii_word was tested incorrectly; and
failure to unlink outstanding URBs before freeing them could lead to kernel
panics when unloading the driver.
Signed-off-by: Kevin Vigor <kevin@realmsys.com>
Cc: Petko Manolov <petkan@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Three minor sl811-hcd fixes:
- Elminate memory leak on one (rare) disable/shutdown path.
- For periodic transfers that don't need to be scheduled, update
urb->start_frame to represent the transfer phase correctly.
- Report the (single) port as removable, by default.
Since no drivers yet use start_frame or that part of the hub descriptor,
only that leak is likely to ever matter.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/host/sl811-hcd.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
This patch fixes several types in the PXA25x udc driver and hence fixes
several compiler warnings.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
I'm using a 2 port USB RS232 dongle to connect to a serial-IR cradle for
a bar code reader). Detecting the baudrate of the serial-IR involves
keeping DTR low while changing baudrate.
This works using normal 16550A serial ports as well as the FTDI driver
version 1.4.0 (Linux 2.6.8) but stopped working with the change to
"ensure RTS and DTR are raised when changing baudrate" introduced in
version 1.4.1 (Linux 2.6.9).
The attached patch fixes this, so RTS and DTR is only raised when
changing baudrate iff the previous baudrate was B0.
Signed-off-by: Peter Favrholdt <pfavr@how.dk>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Added support for HUAWEI E600 and Audiovox AirCard
User reports say that these devices work without driver modification.
Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
add the helper and use it instead of open coding the klist_node_attached() check
(which is a layering violation IMHO)
idea by Alan Stern.
Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ftdi_sio: I messed up the baud_base for custom baud rate support in
2.6.13. The attached one-liner patch fixes it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern sent me this patch. It goes on top of the patch the adds
mon_dmapeek:
http://ftp.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/gregkh-04-usb/usb-usbmon-dma-areas.patch
Please be warned about ordering requirements or the build may fail.
Actually, mon_dmapeek is generic enough to support SETUP packets too.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch fixes the long standing schedule with interrupts off problem
of the uss720 driver. The problem is caused by the parport layer calling
the save and restore methods within a write_lock_irqsave guarded region.
The fix is to issue the control transaction requests required by save
and restore asynchronously.
Signed-off-by: Thomas Sailer, <sailer@ife.ee.ethz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern wrote:
> If the device sometimes reports the correct values, then you should
> include NEED_OVERRIDE flag to prevent messages about unnecessary
> overrides showing up in the system log. Also, if bInterfaceSubclass
> is correct and only bInterfaceProtocol is wrong, then the entry should
> say US_SC_DEVICE instead of US_SC_SCSI.
Fair points, thanks.
When connected over USB2, this device reports a nonsense
bInterfaceProtocol value 6 and doesn't work with usb-storage. When
connected over USB1, the device reports the correct bInterfaceProtocol
value 0x50 (bulk) and works with no problems.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch adds entries for several USB floppies that need
the US_FL_SINGLE_LUN flag. These were reported by
Sebastian Kapfer <sebastian_kapfer@gmx.net> and Olaf Hering
<olh@suse.de>, with rediffing and cleaning from me.
Reported-by: Sebastian Kapfer <sebastian_kapfer@gmx.net>
Reported-by: Olaf Hering <olh@suse.de>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The stick replies to the door lock commands with a check condition (e.g.
FAIL status in a normal bulk CSW), but the subsequent REQUEST SENSE
returns all-zero sense. The situation is documented in our Bugzilla,
including usbmon traces.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=162559
The error is purely cosmetic, data integrity is not in danger.
But I thought we might as well do it. It looks nicer that way.
I discussed this with Phil and he told me to submit directly.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is patch as550 from Alan Stern.
Apparently someone changed the SCSI core so that it no longer holds the
host lock when doing a device or bus reset. usb-storage was updated at
the time, but the change was done carelessly. Some of the code depends
on that lock being held.
This patch reintroduces the host lock where needed and tries to clarify
the comments explaining why the lock is necessary. It also moves the
code that clears the TIMED_OUT and ABORTING bitflags so that it executes
as soon as the timed-out command has completed (and while the host lock
is held).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This appears to help some folk, please merge.
This patch relaxes reset timings. There are some reports that it
helps make enumeration work better on some high speed devices.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch adds the product ID and vendor ID for a Nokia CA-42 USB cable
to the list of devices handled by the pl2303 driver. The patch is
against 2.6.13.
Signed-off-by: Robert Spanton <rds204@zepler.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Now that it's in use on other boards, a bug in the original code needs fixing.
There is no need for the PXA27x OHCI to set usb power during init, since
the hub driver in usbcore handles that. Those platform-specific power
control functions are also incorrect, and should therefore be removed.
Add a check to clear the OTG pin hold bit until such times OTG is
properly implemented.
Signed-Off-By: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Some OHCI implementations have differences in the way the NDP register
(in roothub_a) reports the number of ports present. This patch allows the
platform specific code to optionally supply the number of ports. The
driver just reads the value at init (if not supplied) instead of reading
it every time its needed (except for an AMD756 bug workaround).
It also sets the value correctly for the ARM pxa27x architecture.
Signed-Off-By: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Evidently there are some boards which care a lot about this, but
as a rule it's been hard to notice.
OHCI_INTR_RD wasn't always cleared in the ohci irq handler. On some
systems this means certain remote wakeup scenarios could seem to hang
(in an interrupt storm, RD never clearing).
From: "William Morrow" <William.Morrow@amd.com>
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
this patch fixes an "Invalid argument" error returned by a write to an
endpoint-file after reopening it in the gadgetfs module in the kernel
2.6.12.
This was testet only with dummy_hcd module!
Signed-off-by: Pavol Kurina <kurina@gmx.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Routine cases like handoff-to-companion shouldn't trigger diagnostics.
This gets rid of some recently added log spamming. It's routine for
hub_port_wait_reset() to return -ENOTCONN to indicate handoff from
highspeed hubs to companions, so an error message is incorrect.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
NVidia reports (via Mark Overby) that some of their EHCI controllers
don't like certain data structure addresses beyond the 2GB mark.
He provided an earlier version of this patch.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
One change may improve some S1 or S3 resume cases, and the other
seems mostly to explain some strange state "lsusb" would show.
Two fixes:
- On resume, don't think about resuming any unpowered port, or
resetting any port with OWNER set to the OHCI/UHCI companion.
This will make some S1 and S3 resume scenarios work better.
- PORT_CSC was not being cleared correctly in ehci_hub_status_data.
This was visible at least through current versions of "lsusb",
and might have caused some other hub related strangeness.
The fix addresses all three write-to-clear bits, using the same
approach that UHCI happens to use: a mask of bits that are
cleared in most writes to that port status register.
Original patch seems to have been from from William.Morrow@amd.com
and this version (from David) finishes the write-to-clear changes.
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Three new device IDs for CP2101 USB to UART Bridge
Signed-off-by: Craig Shelley <craig@microtron.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch (as558) removes from the UHCI driver a kernel timer used for
checking Full Speed Bandwidth Reclamation (FSBR). The checking can be
done during normal root-hub polling; it doesn't need a separate timer.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch (as549) introduces two small changes in the HCD glue layer.
The first simply removes a redundant test. The second allows root-hub
polling to continue for a single iteration after a host controller dies;
this is needed for the patch that follows.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is a driver for the USB touchpad which can be found on post-February 2005
Apple PowerBooks.
This driver is derived from Johannes Berg's appletrackpad driver [1],
but it has been improved in some areas:
* appletouch is a full kernel driver, no userspace program is necessary
* appletouch can be interfaced with the synaptics X11 driver[2], in order
to have touchpad acceleration, scrolling, two/three finger tap, etc.
This driver has been tested by the readers of the 'debian-powerpc' mailing
list for a few weeks now and I believe it is now ready for inclusion into the
mainline kernel.
Credits go to Johannes Berg for reverse-engineering the touchpad protocol,
Frank Arnold for further improvements, and Alex Harper for some additional
information about the inner workings of the touchpad sensors.
Signed-off-by: Stelian Pop <stelian@popies.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
here is a new and extended version of the sisusbvga (previously: sisusb)
driver. The patch is against 2.6.13 and updates the driver to version 0.0.8.
Additions include complete VGA/EGA text console support and a build-in
display mode infrastructure for userland applications that don't know
about the graphics internals.
Fixes include some BE/LE issues and a get/put_dev bug in the previous
version.
Other changes include a change of the module name from "sisusb" to
"sisusbvga". The previous one was too generic IMHO.
Please note that the patch also affects the Makefile in
drivers/video/console as the driver requires the VGA 8x16 font in case
the text console part is selected.
Heavily tested, as usual. Please apply.
One thing though: I already prepared for removal of the "mode" field and
the changed "name" field in the usb_class_driver structure. This will
perhaps need some refinement depending on whether you/Linus merge the
respective core changes before or after 2.6.14.
Signed-off-by: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch does a full cleanup of 'NULL checks before vfree', and a partial
cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in
that I only did the files that also had vfree calls in them. The patch
also gets rid of some redundant (void *) casts of pointers being passed to
[vk]free, and a some tiny whitespace corrections also crept in.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Clean up timer initialization by introducing DEFINE_TIMER a'la
DEFINE_SPINLOCK. Build and boot-tested on x86. A similar patch has been
been in the -RT tree for some time.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch aggregates all modifications in the -mm tree and adds
complete ringtone support.
The following features are supported:
- keyboard full support
- LCD full support
- LED full support
- dialtone full support
- ringtone full support
- audio playback via generic usb audio diver
- audio record via generic usb audio diver
For driver documentation see: Documentation/input/yealink.txt
For vendor documentation see: http://yealink.com
Signed-off-by: Henk <Henk.Vergonet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
As sugested by Alan Stern here are a few code cleanups for onetouch.c:
-Check number of endpoints before directly referencing intf->endpoint[2]
-Use defined constants instead of magic numbers
-Revmove the non-ascii characters from copyright notice
-Make registration and deregistration messages more similar
Signed-off-by: Nick Sillik <n.sillik@temple.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>