This patch implements a USB serial port driver for the Winchiphead
CH341 USB-RS232 Converter. This chip also implements an IEEE 1284
parallel port, I2C and SPI, but that is not supported by the driver.
Signed-off-by: Frank A Kingswood <frank@kingswood-consulting.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Simon Arlott [Tue, 25 Sep 2007 19:20:10 +0000 (20:20 +0100)]
USB: cxacru: Use appropriate logging for errors
When an error occurs, existing logging uses dbg() so the cause of a
problem is hard to determine. Error conditions shouldn't only be
properly reported with debugging enabled.
A side effect of this change is that when an uninitialised device is
started, a log message similar to the following is sent:
cxacru 5-2:1.0: receive of cm 0x90 failed (-104)
This is normal - the device did not respond so firmware will be loaded.
This patch adds an additional device ID to the cp2101 USB serial
driver. This device is a Gemalto Prox-PU or CU contactless card reader
(ISO14443-A/B and Mifare). The reader is a standard Gemalto serial
proximity reader using the Gemalto Block Protocol (see reader's
documentation) bundled with a built-in CP2102 for serial/USB
conversion.
Alan Stern [Fri, 21 Sep 2007 20:57:54 +0000 (16:57 -0400)]
USB: remove USB_QUIRK_NO_AUTOSUSPEND
This patch (as995) cleans up the remains of the former NO_AUTOSUSPEND
quirk. Since autosuspend is disabled by default, we will let
userspace worry about which devices can safely be suspended. Thus the
lengthy series of quirk entries is no longer needed, and neither is
the quirk ID. I suppose someone might eventually run across a hub
that can't be suspended; let's ignore the possibility for now.
The patch also cleans up the hasty way in which autosuspend gets
disabled. Setting udev->autosuspend_delay to -1 wasn't quite right,
because the value is always supposed to be a multiple of HZ. It's
better to leave the delay value alone and set autosuspend_disabled,
which is what the quirk routine used to do.
Alan Stern [Thu, 20 Sep 2007 16:37:50 +0000 (12:37 -0400)]
USB: don't propagate FREEZE or PRETHAW suspends
This patch (as992) fixes a recently-added bug. During a FREEZE or
PRETHAW suspend notification, non-root devices don't actually get
suspended. So we shouldn't tell their parent hubs that they did.
(This code path used to be skipped over, until the FREEZE/PRETHAW test
got moved out of usb_suspend_both() into generic_suspend().)
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 18 Sep 2007 14:09:32 +0000 (10:09 -0400)]
USB: unusual_devs update for Nokia 6131
This patch (as991) updates the unusual_devs entry for the Nokia 6131
phone. As reported by Juan Ignacio Cherrutti, there's new firmware
available but it still has the same old transfer-size limit.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch (jx001) fixes a variable assignment mistake in hub driver.
limited_power should be set to 0 if the hub is self-powered,and 1 if
the hub is bus-powered.
However, the effect of the code was exactly opposite to the spec's
statement for the Local Power Source field. The spec says, this field
is 1 meaning Local power supply lost while this field is 0 indicating
Local power supply good.(This statement is very confusing.)
So this patch switchs the 0 and 1.
Signed-off-by: Jason Xiao <jidong.xiao@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Adrian Bunk [Tue, 11 Sep 2007 17:10:21 +0000 (19:10 +0200)]
USB: always visit drivers/usb/misc/
Currently, every driver under drivers/usb/misc/ also has to be listed in
drivers/usb/Makefile. This has been forgotten more than once, and this
patch changes drivers/usb/Makefile to simply always visit
drivers/usb/misc/ when building the USB code.
Mark Gross [Mon, 24 Sep 2007 16:28:14 +0000 (09:28 -0700)]
USB: usb-skeleton leaking locks on open
This weekend I was hacking around with a trivial USB driver for talking
to the boot load firmware of a USB Bit Whacker. It's running the
MicroChip Pic18 boot loader firmware and I'm putting together a flash
program for writing new FW to the thing.
Anyway in my use of the usb-skeleton.c as my starting point I discovered
my test program was getting hung up after attempting to write a buffer.
The application and driver where hung in a way that required me to
reboot to get it to clean up so I could try again.
It turned out the code path through skel_open can grap the driver's
io_mutex lock and forget to release it.
The following patch fixes the problem for me.
Signed-off-by: Mark Gross <mgross@linux.intel.com> Cc: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 10 Sep 2007 15:34:26 +0000 (11:34 -0400)]
USB: flush outstanding URBs when suspending
This patch (as989) makes usbcore flush all outstanding URBs for each
device as the device is suspended. This will be true even when
CONFIG_USB_SUSPEND is not enabled.
In addition, an extra can_submit flag is added to the usb_device
structure. That flag will be turned off whenever a suspend request
has been received for the device, even if the device isn't actually
suspended because CONFIG_USB_SUSPEND isn't set.
It's no longer necessary to check for the device state being equal to
USB_STATE_SUSPENDED during URB submission; that check can be replaced
by a check of the can_submit flag. This also permits us to remove
some questionable references to the deprecated power.power_state field.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 10 Sep 2007 15:33:05 +0000 (11:33 -0400)]
USB: break apart flush_endpoint and disable_endpoint
This patch (as988) breaks usb_hcd_endpoint_disable() apart into two
routines. The first, usb_hcd_flush_endpoint() does the -ESHUTDOWN
unlinking of all URBs in the endpoint's queue and waits for them to
complete. The second, usb_hcd_disable_endpoint() -- renamed for
better grammatical style -- merely calls the HCD's endpoint_disable
method. The changeover is easy because the routine currently has only
one caller.
This separation of function will be exploited in the following patch:
When a device is suspended, the core will be able to cancel all
outstanding URBs for that device while leaving the HCD's
endpoint-related data structures intact for later.
As an added benefit, HCDs no longer need to check for existing URBs in
their endpoint_disable methods. It is now guaranteed that there will
be none.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 10 Sep 2007 15:31:43 +0000 (11:31 -0400)]
USB: move decision to ignore FREEZE events
This patch (as987) changes the way FREEZE and PRETHAW suspend events
are handled in usbcore. The decision about whether or not to ignore
them for non-root devices is pushed down into the USB-device driver,
instead of being made in the core code.
This is appropriate, since devices exported to a virtualized guest or
over a network may indeed need to handle these types of suspend, even
though normal devices don't.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/sisusbvga/sisusb.c: In function sisusb_open
drivers/usb/misc/sisusbvga/sisusb.c:2444: warning: sisusb is used uninitialized in this function
is a genuine bug (which will cause oops). We cannot use "sisusb" in
error path for (!interface), because sisusb will itself be derived
from "interface" later.
Oliver Neukum [Fri, 17 Aug 2007 12:01:38 +0000 (14:01 +0200)]
USB: fix errornous assumption in the usb serial framework revealed by iuu_phoenix
the iuu_phoenix driver submits another URB from a completion handler.
This dictates a certain order of calls to usb_kill_urb() in kill_traffic().
As other drivers may do it the other way round, we need to use both
orders in kill_traffic().
This patch does so and should be merged before iuu_phoenix is merged.
Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 4 Sep 2007 13:53:24 +0000 (09:53 -0400)]
USB: fix location of statement label in dummy-hcd
This patch (as984) fixes a rather elementary mistake in dummy_hcd.
The new statement label should come before the spin_unlock_irqrestore,
not after it.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 24 Aug 2007 19:42:39 +0000 (15:42 -0400)]
USB: get rid of urb->lock
Now that urb->status isn't used, urb->lock doesn't protect anything.
This patch (as980) removes it and replaces it with a private mutex in
the one remaining place it was still used: usb_kill_urb.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 24 Aug 2007 19:42:24 +0000 (15:42 -0400)]
USB: Eliminate urb->status usage!
This patch (as979) removes the last vestiges of urb->status from the
host controller drivers and the root-hub emulator. Now the field
doesn't get set until just before the URB's completion routine is
called.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> CC: Tony Olech <tony.olech@elandigitalsystems.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 24 Aug 2007 19:40:47 +0000 (15:40 -0400)]
USB: reorganize urb->status use in sl811-hcd
This patch (as976) reorganizes the way sl811-hcd sets urb->status. It
now keeps the information in a local variable until the last moment.
The patch also improves the handling of faults during the status stage
of a control transfer, since it no longer needs to retain the error
information from the earlier stages.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jesper Juhl [Fri, 24 Aug 2007 00:35:14 +0000 (02:35 +0200)]
usb: avoid redundant cast of kmalloc() return value in OTi-6858 driver
In drivers/usb/serial/oti6858.c::pl2303_buf_alloc() the return value
of kmalloc() is being cast to "struct pl2303_buf *", but that need
not be done here since kmalloc() returns "void *".
USB: usbmon doc update - mention new wildcard ('0') bus
Update usbmon documentation, mentioning the "zero" (wildcard) bus.
Possibly, in my first hunk, the 'either ... or ...' should be rephrased a bit to
be expressed better.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roman Kagan [Fri, 24 Aug 2007 16:22:52 +0000 (20:22 +0400)]
usb-serial: show port number in sysfs
Some usb-serial devices (e.g. certain Edgeport models) have more than
one serial port on the same USB device/interface.
Currently the only way to distinguish these ports in userspace is by
their minor device number: the driver makes them consecutive and in
stable order.
However, for the purpose of stable naming with udev this is
insufficient: when udev handles the ADD event for one of the ports it
doesn't know what minor number the other one has.
To make stable naming easier, export the port number via sysfs.
Alan Stern [Fri, 24 Aug 2007 20:27:50 +0000 (16:27 -0400)]
USB: less-restrictive command checking in g-file-storage
This patch (as983) makes a test for minimum-length command sizes in
g_file_storage less restrictive. It doesn't matter because commands
with bad lengths will be detected later on anyway, and doing it like
this makes the driver interoperable with certain buggy hosts such as
the JVC HiFi (reported by Samuel Hangouet).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Cox [Wed, 22 Aug 2007 22:09:16 +0000 (23:09 +0100)]
USB: kobil_sct: Rework driver
No hardware but this driver is currently totally broken so we can't make
it much worse. Remove all tbe broken invalid termios handling and replace
it with a proper set_termios method.
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 22 Aug 2007 17:08:40 +0000 (13:08 -0400)]
USB: avoid the donelist after an error in ohci-hcd
This patch (as972) changes ohci-hcd so that after an error occurs, the
remaining TDs for the URB will be skipped over entirely instead of
going through the donelist. This enables the driver to give back the
URB as soon as the error is detected, avoiding the need to store the
error status in urb->status.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 22 Aug 2007 17:06:53 +0000 (13:06 -0400)]
USB: fix mistake in usb_hcd_giveback_urb
This patch (as971) fixes a small mistake: The URB's completion status
needs to be adjusted before the URB is passed to usmon_urb_complete(),
not afterward.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Andrew M. Bishop [Tue, 21 Aug 2007 18:08:56 +0000 (19:08 +0100)]
USB: ftdi_sio: Handle FT232RL devices like FT232BM devices
Handle the FT232RL device type in exactly the same way as FT232BM
devices (FT232RL detection was added around kernel 2.6.20 but not code
for handling it).
Signed-off-by: Andrew M. Bishop <amb@gedanken.demon.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 21 Aug 2007 19:40:36 +0000 (15:40 -0400)]
USB: add urb->unlinked field
This patch (as970) adds a new urb->unlinked field, which is used to
store the status of unlinked URBs since we can't use urb->status for
that purpose any more. To help simplify the HCDs, usbcore will check
urb->unlinked before calling the completion handler; if the value is
set it will automatically override the status reported by the HCD.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> CC: Tony Olech <tony.olech@elandigitalsystems.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 21 Aug 2007 19:39:21 +0000 (15:39 -0400)]
USB: centralize -EREMOTEIO handling
This patch (as969) continues the ongoing changes to the way HCDs
report URB statuses. The programming interface has been simplified by
making usbcore responsible for clearing urb->hcpriv and for setting
-EREMOTEIO status when an URB with the URB_SHORT_NOT_OK flag ends up
as a short transfer.
By moving the work out of the HCDs, this removes a fair amount of
repeated code.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> CC: Tony Olech <tony.olech@elandigitalsystems.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 21 Aug 2007 19:37:50 +0000 (15:37 -0400)]
USB: remove Iso status value in uhci-hcd
This patch (968) changes the way uhci-hcd reports status for
Isochronous URBs. Until now urb->status has been set to the last
detected error code. But other HCDs don't do this; they leave the
status set to 0 and report errors only in the individual iso packet
descriptors. So this patch removes the extra computation and makes
uhci-hcd behave like the others.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Marcelo Tosatti [Tue, 21 Aug 2007 01:13:27 +0000 (18:13 -0700)]
USB: EHCI restart speedup
It is not necessary to powerdown the ports on ehci_pci_reinit() when the
chip reset already did that. Removing this saves 20ms during restart
after poweroff paths (which OLPC uses a lot).
To ensure driver startup then behaves consistently, force a reset during
driver startup. (Not doing this was an accident of some previous changes
to the init sequence.)
Make the corresponding change in the PS3 support. It's not clear what
ehci-fsl should do here; it has similar code to the PS3.
Ueagle-atm driver load DSP firmware in function, which is running from
common workqueue. In some (error) circumstances loading firmware may
sleep for long periods (even 60 seconds, depending on timeout). This
block keyboard driver, which also use common workqueue. To fix problem
use custom workqueue in ueagle-atm.
UEAGLE: Allow user to choose input interface alternate setting
Let's user control how much USB bus bandwidth will be reserved by
ueagle-atm device. This make possible to share bus with other devices
when ueagle-atm driver works in isochronous mode.
Support for Devolo and Elsa chipsets. These chipsets have no information
about ADSL annex (line type) encoded in USB descriptors. Driver try to
get this information from USB VID and PID or it can be explicitly set by
the user through module parameter. Thanks to Johann Hanne, whose make
most of this patch.
Add support to newest chipset of eagle family. It is compatible with
older chipsets at USB level. However DSP firmware and CMVs
(Configuration and Management Variables) have different format of data
and are sent/received by different way.
Alan Stern [Thu, 16 Aug 2007 20:17:49 +0000 (16:17 -0400)]
USB: remove unnecessary tests in isp116x and sl811
This patch (as962) cleans up some code I forgot to remove earlier in
the isp116x and sl811 HCDs. There is no longer any need to check for
unlink-during-submit; it can't happen since the endpoint queues are
now under the protection of the HCD-private spinlock.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Tue, 14 Aug 2007 20:19:16 +0000 (13:19 -0700)]
usblp: Fix a double kfree
If submit fails, slab hits a BUG() because of a double kfree.
The today's lesson is, you cannot just slap USB_FREE_BUFFER on code
without adjusting the error paths.
The patch is made bigger by opportunistic refactoring.
Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Tue, 14 Aug 2007 07:37:51 +0000 (00:37 -0700)]
usbmon: Drop DMA mapping for setup packet
Setup packet must be visible in virtual space. There's absolutely no
good reason to implement any kind of zero-copy transfer of 8 bytes, and
the documentation in usb.h is explicit about it. So, drop DMA remapping.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Tue, 14 Aug 2007 07:33:40 +0000 (00:33 -0700)]
usbmon: Update pipe removal to suit my taste
This is a set of small updates to Alan's work to make the code more to
my liking. Mostly premature optimizations, but also direction of control
transfers in the binary interface was always out.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Tue, 14 Aug 2007 05:54:29 +0000 (22:54 -0700)]
usblp: Cosmetics
This is a small bunch of cosmetic fixes:
- Timeout is not a write timeout anymore, rename
- Condition in poll was confusingly backwards, invert and simplify
- The comment log gave a wrong impression of version 0.13, terminate it.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Tue, 14 Aug 2007 05:50:13 +0000 (22:50 -0700)]
usblp: mutex in usblp_check_status
Add a mutex to protect the ->statusbuf. Not really an issue, because CUPS
is single-threaded when it talks to the printer, but I feel safer this way.
This should be deadlock-free, but I kept this as a separate patch in case
someone ends running a git bisect.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 8 Aug 2007 15:59:18 +0000 (11:59 -0400)]
USB: don't touch sysfs stuff when altsetting is unchanged
This patch (as955) prevents the interface-related sysfs files and
endpoint pseudo-devices from being deleted and recreated when a call
to usb_set_interface() specifies the current altsetting. Since the
altsetting doesn't get changed, there's no need to do anything.
Furthermore, avoiding changes to the endpoint devices will be
necessary in the future. This code is called from usb_reset_device(),
which gets invoked for reset-resume processing, but upcoming changes
to the PM and driver cores will make it impossible to register devices
while a suspend/resume transition is in progress. Since we don't need
to re-register those endpoint devices anyhow, it's best to skip the
whole thing.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 8 Aug 2007 15:48:02 +0000 (11:48 -0400)]
USB: make HCDs responsible for managing endpoint queues
This patch (as954) implements a suggestion of David Brownell's. Now
the host controller drivers are responsible for linking and unlinking
URBs to/from their endpoint queues. This eliminates the possiblity of
strange situations where usbcore thinks an URB is linked but the HCD
thinks it isn't. It also means HCDs no longer have to check for URBs
being dequeued before they were fully enqueued.
In addition to the core changes, this requires changing every host
controller driver and the root-hub URB handler. For the most part the
required changes are fairly small; drivers have to call
usb_hcd_link_urb_to_ep() in their urb_enqueue method,
usb_hcd_check_unlink_urb() in their urb_dequeue method, and
usb_hcd_unlink_urb_from_ep() before giving URBs back. A few HCDs make
matters more complicated by the way they split up the flow of control.
In addition some method interfaces get changed. The endpoint argument
for urb_enqueue is now redundant so it is removed. The unlink status
is required by usb_hcd_check_unlink_urb(), so it has been added to
urb_dequeue.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> CC: Tony Olech <tony.olech@elandigitalsystems.com> CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
These USB API functions will do the full authorization/deauthorization
to be used for a device. When authorized we effectively allow a
configuration to be set. Reverse that when deauthorized.
Effectively this means that we have to clean all the configuration
descriptors on deauthorize and reload them when we authorized. We could
do without throwing them out for wired devices, but for wireless, we can
read them only after authenticating, and thus, when authorizing an
authenticated device we would need to read them. So to simplify, always
release them on deauthorize(), re-read them on authorize().
Also fix leak reported by Ragner Magalhaes; in usb_deauthorize_device(),
bNumConfigurations was being set to zero before the for loop, and thus
the different raw descriptors where never being freed.
usb: split usb_new_device for clarity and refactoring
This patch takes hub.c:usb_new_device() and splits it in three parts:
- The actual actions of adding a new device (quirk detection,
announcement and autoresume tracking)
- Actual discovery and probing of the configuration and interfaces
(split into __usb_configure_device())
- Configuration of the On-the-go parameters (split into
__usb_configure_device_otg()).
The fundamental reasons for doing this split are clarity (smaller
functions are easier to maintain) and to allow part of the code to be
reused when authorizing devices to connect.
When a device is authorized connection, we need to run through the
hoops we didn't run when it was connected but not authorized, which is
basically parsing the configurations and probing
them. usb_configure_device() will do that for us.
If called and the device is not authorized to be used, then we won't
choose a configuration (as they are not a concept that exists for an
unauthorized device). However, the device is added to the system.
usb: add the concept of default authorization to USB hosts
This introduces /sys/bus/devices/usb*/authorized_default; it dictates
what is going to be the default authorization state for devices
connected to the host. User space can set that using the sysfs file.
We hook to the root hub instead of to the device controller as it is
quite easy to get to it in sysfs from the device structure (device
5-4.3 is usb5) vs. backtracking to the controller device.
By default it is set to be 'authorized' (!0) for normal, wired USB
devices and 'unauthorized' (0) for Wireless USB devices.
As suggested by Adrian Bunk, make authorized_default static
This just modifies 'struct usb_device' to contain the 'authorized'
bit. It also adds a 'wusb' bit. This is needed because nonauthorized
(and thus non-authenticated) wusb devices will fail certain kind of
simple requests (such as string descriptors). By knowing the device is
WUSB, we just avoid them.
David Brownell [Thu, 2 Aug 2007 07:00:38 +0000 (00:00 -0700)]
USB: gadget: ethernet gadget cleanups, shrinkage
Clean up the ethernet gadget, using newer APIs and conventions:
- gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal
- Remove many now-needless #includes
- Use the VERBOSE_DEBUG convention
- Minor whitespace fixes.
- Fix a warning from "sparse".
Surprisingly, this saved about 2K of code (16%) on a fullspeed-only
ARMv4 platform. I'm bit puzzled by that (it's so much!), but approve
of the result.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell [Thu, 2 Aug 2007 06:58:22 +0000 (23:58 -0700)]
USB: gadget: gadget_is_{dualspeed,otg} predicates and cleanup
This adds two small inlines to the gadget stack, which will
often evaluate to compile-time constants. That can help
shrink object code and remove #ifdeffery.
- gadget_is_dualspeed(), currently always a compile-time
constant (depending on which controller is selected).
- gadget_is_otg(), usually a compile time "false", but this
is a runtime test if the platform enables OTG (since it's
reasonable to populate boards with different USB sockets).
It also updates two peripheral controller drivers to use these:
- fsl_usb2_udc, mostly OTG-related bugfixes: non-OTG devices
must follow the rules about drawing VBUS power, and OTG ones
need to reject invalid SET_FEATURE requests.
- omap_udc, just scrubbing a bit of #ifdeffery.
And also gadgetfs, which lost some #ifdefs and moved to a more
standard handling of DEBUG and VERBOSE_DEBUG.
The main benefits come from patches which will follow.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Nico Erfurth [Thu, 2 Aug 2007 20:25:20 +0000 (22:25 +0200)]
USB: Add drivers/usb/misc/iowarrior.c to the Makefile
This patch adds the new iowarrior module to the Makefile in drivers/usb.
Currently the module isn't build unless another driver from usb/misc is
selected.
Alan Stern [Thu, 2 Aug 2007 19:06:54 +0000 (15:06 -0400)]
USB: separate out endpoint queue management and DMA mapping routines
This patch (as953) separates out three key portions from
usb_hcd_submit_urb(), usb_hcd_unlink_urb(), and usb_hcd_giveback_urb()
and puts them in separate functions of their own. In the next patch,
these functions will be called directly by host controller drivers
while holding their private spinlocks, which will remove the
possibility of some unpleasant races.
The code responsible for mapping and unmapping DMA buffers is also
placed into a couple of separate subroutines, for the sake of
cleanliness and consistency.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>