summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_subr.c
Commit message (Collapse)AuthorAgeFilesLines
* Empty vendor string overrides knowndevssanpei2004-01-181-0/+4
| | | | | | | | | | | | | | | | | ubd_devinfo_vp() is getting an empty string from its usbd_get_string() call on the vendor, instead of NULL. This means usb_knowndevs in not consulted. Add lines between grabbing those char *s and the USBVERBOSE ifdef to set vendor to NULL if it is the empty string (similarly for product). This causes vendor to be filled-out, although the product name read overrules usb_knowndevs (this appears to be a conscience decision made by the NetBSD folks): PR: kern/56097 Submitted by: Hal Burch <hburch@lumeta.com> MFC after: 1 week
* Try a port reset if initial contact to a device failed.ticso2003-09-011-1/+4
| | | | tested by: Lee Damon <nomad@castle.org>
* Use __FBSDID().obrien2003-08-241-1/+3
| | | | Also some minor style cleanups.
* Update to reflect the NetBSD patches that are already included.joe2003-07-141-1/+6
|
* WARNING: white space diffjmg2003-07-041-21/+21
| | | | | | This code reduces the number of trailing white space to be more in line w/ NetBSD. I don't regenerate usbdevs, saving that for when it really changes.
* Some USB devices are not prepared to deal with a single byte stringjoe2003-01-141-2/+8
| | | | | | | | | | | descriptor request, which usbd_get_string_desc() uses to get the length of a descriptor. One device for instance returns a full 8 byte long packet instead which confuses the rest of the stack and leads to the USB port being reset. The fix is to instead request two bytes, but not to complain if we only get one. Submitted by: kan MFC after: 3 days
* Retry to get full device descriptor, this let my slow CD Tower device work.davidxu2003-01-081-1/+7
|
* Set the ivars _after_ checking that the bdev was correctly created insteadn_hibma2002-06-171-2/+2
| | | | of before.
* Add a power exceeded debug message.joe2002-04-251-1/+2
| | | | Update the $NetBSD$ ident to match reality.
* MFNetBSD:joe2002-04-251-2/+2
| | | | | | revision 1.96 date: 2001/11/22 21:59:33; author: augustss; state: Exp; lines: +3 -3 Correct a comment.
* MFNetBSD:joe2002-04-251-5/+38
| | | | | | revision 1.95 date: 2001/11/20 16:09:01; author: augustss; state: Exp; lines: +39 -6 Sanity check max packet lengths.
* MFNetBSD:joe2002-04-251-2/+9
| | | | | | revision 1.94 date: 2001/11/20 13:50:07; author: augustss; state: Exp; lines: +16 -9 Update for new speed handling.
* MFNetBSD: hid.c (1.22), uhci.c (1.150), usb_subr.c (1.97)joe2002-04-071-2/+1
| | | | | date: 2002/01/14 13:23:37; author: tsutsui; Call malloc(9) with M_ZERO flag instead of memset() after malloc().
* MFNetBSD: uhub.c (1.54), usb_subr.c (1.92)joe2002-04-071-1/+4
| | | | | date: 2001/11/16 01:57:47; author: augustss; Handle devices that disappear during reset gracefully.
* MFNetBSD: usb_subr.c (1.90), usbdi.c (1.83), usbdivar.h (1.65)joe2002-04-071-2/+1
| | | | | date: 2001/11/10 17:11:38; author: augustss; state: Exp; lines: +1 -2 Get rid of unused abort_handle.
* MFNetBSD:joe2002-04-021-1/+2
| | | | | | revision 1.89 date: 2001/11/10 17:10:42; author: augustss; state: Exp; lines: +2 -1 Abort any xfers on the control pipe before closing it on detach.
* MFNetBSD: usb_port.h (1.45 partial), usb_subr.c (1.88)joe2002-04-021-7/+1
| | | | | date: 2001/11/10 16:53:32; author: augustss; Small portability improvement.
* MFNetBSD: usb_subr.c (1.87), usbdi.h (1.53)joe2002-04-021-1/+13
| | | | | | date: 2001/08/15 00:04:59; author: augustss; Add a little infrastructure so that individual drivers can easily check if thee was a vendor+product locator match.
* MFNetBSD:joe2002-04-011-2/+1
| | | | | | | revision 1.86 date: 2001/05/16 04:50:11; author: lukem; state: Exp; lines: +1 -2 delint: remove unnecessary assignment to same objection (hidden in #define)
* constifyjoe2002-04-011-1/+1
|
* Update $NetBSD$ idents to better reflect reality.joe2002-04-011-1/+1
|
* Merge from NetBSD:joe2002-04-011-14/+38
| | | | | | | | revision 1.81 date: 2000/10/24 15:01:26; author: augustss; lines: +36 -10 Add a hack to try and figure out if the TI UTUSB41 hub is bus powered despite claiming to be self powered (it's important to know so that the power budget can be met).
* Merge from NetBSD: revision 1.72joe2002-04-011-7/+4
| | | | | | | | | Part of this got merged in a previous commit, but not all. revision 1.72 date: 2000/04/14 14:13:56; author: augustss; state: Exp; lines: +34 -27 Make attach of ugen work as it should so product&vendor locators can be used.
* Merge from NetBSD:joe2002-04-011-1/+1
| | | | | | usb.c rev 1.43, usb_port.h rev 1.26, usb_subr.c rev 1.71 Some OpenBSD portability fixes.
* Huge merge from NetBSD:joe2002-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usbdi.c (1.61): =================================================================== revision 1.61 date: 2000/01/31 20:13:07; author: augustss; lines: +20 -4 Change the way the HC done method is invoked a little. =================================================================== usbdi.c (1.65): =================================================================== revision 1.65 date: 2000/03/08 15:34:10; author: augustss; lines: +4 -2 Get the status right when a polled transfer times out. =================================================================== ohci.c (1.79), uhci.c (1.89), uhcivar.h (1.24), usb_port.h (1.22), usbdivar.h (1.48): =================================================================== date: 2000/03/23 07:01:46; author: thorpej; New callout mechanism with two major improvements over the old timeout()/untimeout() API: - Clients supply callout handle storage, thus eliminating problems of resource allocation. - Insertion and removal of callouts is constant time, important as this facility is used quite a lot in the kernel. The old timeout()/untimeout() API has been removed from the kernel. =================================================================== uhci.c (1.80), usbdi.c (1.66): =================================================================== date: 2000/03/23 18:59:10; author: thorpej; Shake out some bugs from the callout changes. =================================================================== ohci.c (1.80), uhci.c (1.91), uhcivar.h (1.25), usb_port.h (1.23), usbdi.c (1.67), usbdivar.h (1.49): =================================================================== date: 2000/03/24 22:03:30; author: augustss; Some cleanup and renaming of the callouts used in USB drivers. =================================================================== uhci.c (1.92), uhcivar.h (1.26): =================================================================== date: 2000/03/24 22:57:58; author: augustss; Two major changes: Make each xfer have its own intr_info. This is necessary if we want to queue multiple xfers on an endpoint. This should get rid of the (mostly harmless) DIAGNOSTICs about intr_infos (not) being done. Change (again!) how xfers are aborted. Aborting a TD is a nightmare on the braindead UHCI controller. (Unless you stop the HC, thereby losing isoc traffic.) Hopefully I got it right this time. =================================================================== usbdivar.h (1.50): =================================================================== revision 1.50 date: 2000/03/25 00:10:19; author: augustss; lines: +4 -2 GC an unsued field and add some DIAGNOSTIC in xfer. =================================================================== ums.c: Use the callout functions instead of the timeout ones. uhci.c (1.93): =================================================================== revision 1.93 date: 2000/03/25 00:11:21; author: augustss; lines: +26 -1 Add more DIAGNOSTIC when aborting isoc. =================================================================== uhci.c (1.94), usbdivar.h (1.51): =================================================================== date: 2000/03/25 07:13:05; author: augustss; More DIAGNOSTIC. Initialize a callout handle I forgot. =================================================================== uhci.c (1.95): =================================================================== revision 1.95 date: 2000/03/25 07:23:12; author: augustss; Exp; lines: +24 -7 Improve uhci_dump_ii(). =================================================================== ohci.c (1.81), uhci.c (1.96), uhcivar.h (1.27), usb_subr.c (1.68), usbdi.c (1.68), usbdivar.h (1.52): =================================================================== date: 2000/03/25 18:02:33; author: augustss; Rename and move around callout handles to make it more sane. Add some DIAGNOSTIC. Fix buglet in isoc abort on UHCI. =================================================================== uhci.c (1.98): =================================================================== revision 1.98 date: 2000/03/27 07:39:48; author: augustss; lines: +12 -4 Make it compile without DIAGNOSTIC. =================================================================== uhci.c (1.99): =================================================================== revision 1.99 date: 2000/03/27 08:01:09; author: augustss; lines: +1 -5 Remove some debug nonsense. =================================================================== uhci.c (1.100): =================================================================== revision 1.100 date: 2000/03/27 09:41:36; author: augustss; lines: +13 -3 Don't mess with QH in bulk abort for the moment. =================================================================== uhci.c (1.102): =================================================================== revision 1.102 date: 2000/03/27 22:42:57; author: augustss; lines: +66 -26 Be a little more careful when aborting. Preallocate some TDs for large buffers. =================================================================== uhci.c (1.103): =================================================================== date: 2000/03/28 09:47:10; author: augustss; lines: +11 -1 Another patch for xfer abort... XXX The current xfer queueing and aborting semantics should really XXX be changed. It cannot be implemented in a sane way on UHCI. XXX One day when I have lots of time I'll redesign it... =================================================================== uhci.c (1.104): Correct a debug message. uhci.c (1.105): Be more defensive in a DIAGNOSTIC test. uhci.c (1.106): =================================================================== revision 1.106 date: 2000/03/29 01:49:13; author: augustss; lines: +14 -309 *SIGH* Revert back to the old method of aborting xfers. I had tested the new stuff for two months now, but as soon as I commited it the problems started to appear. Murphy, no doubt... =================================================================== usb_subr.c (1.70), usbdi.c (1.71), usbdivar.h (1.53): =================================================================== revision 1.70 date: 2000/03/29 01:45:20; author: augustss; lines: +2 -1 Do not accept new xfers for queuing while a pipe is aborting. ===================================================================
* Prefix structure members to protect them against clashes with eg.alfred2002-02-201-21/+21
| | | | | | | | | c++ keywords. This keeps us in sync with NetBSD because they actually committed my delta first. Ok'd by: lennard
* Merge from NetBSD:joe2002-02-161-7/+7
| | | | | | Pave the way for USB2, by replacing 'lowspeed' with 'speed', so that it can take the values USB_SPEED_LOW, USB_SPEED_FULL or in time USB_SPEED_HIGH.
* Merge from NetBSD.joe2002-01-281-3/+4
| | | | | | | | | | | | | | | | | | | | uhub.c: revision 1.37 usb.4: revision 1.30 usb.c: revision 1.38 usb.h: revision 1.40 usb_port.h: revision 1.21 usb_subr.c: revision 1.65 usbdi.h: revision 1.40 Split the attach/detach events up into device, driver and controller attach and detach events. The commit message from NetBSD was: date: 2000/02/02 07:34:00; author: augustss; state: Exp; Change the USB event mechanism to include more information about devices and drivers. Partly from FreeBSD. Also rework usbd to take these new event types into account.
* Sync usb.h with NetBSD, apart from usb_device_info.speed, whichjoe2002-01-021-5/+5
| | | | | requires logic changes. For now leave it as usb_device_info.lowspeed. It will get addressed when the usb.c code is sync'd.
* Pull in the most recent version of usb_quirks.h and propagate the necessaryn_hibma2001-07-051-170/+118
| | | | | | changes to the various files. Also, pull in most of the current usb_subr.c file.
* Undo previous commit. <machine/clock.h> is needed for the prototypen_hibma2000-10-161-0/+1
| | | | for DELAY().
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* From NetBSD:n_hibma2000-08-131-22/+49
| | | | | | | | | | | | | | Make it possible to move a device to its unconfigured state by using config #0. Add some comments. Change error reporting in port reset function. usbd_devinfo_vp(): search the know devs array also if the device doesn't return product description (e.g. Kye's Genius NetScroll mouse returns vendor, but not product); the strings returned by device are still preferred to those in the array, though
* Remove __P prototypes to reduce diffs between the NetBSD and FreeBSDn_hibma2000-07-171-9/+9
| | | | versions.
* Change Lennart's e-mail address.n_hibma2000-05-141-1/+1
|
* OpenBSD has a broken debugger that does not grok static. Use an_hibma2000-04-031-12/+12
| | | | | | #define Static static that the OpenBSD folks can define it to be empty if they like.
* Don't use tsleep when cold booting. It is called before bus->use_pollingn_hibma2000-02-061-1/+1
| | | | | | | | | | is initialised by usb_init. This might solve problems with some controllers not being initiliased properly, because a delay was effectively a tsleep that returned immediately. Approved by: jhk
* More USB ethernet tweaks:wpaul2000-01-201-25/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the following improvements: o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP quirk. This allows drivers to specify busy waiting only for certain transfers (namely control transfers for reading/writing registers and stuff). o New USBD_FORCE_SHORT_XFER flag can be used to deal with devices like the ADMtek Pegasus that sense the end of bulk OUT transfers in a special way (if a transfer is exactly a multiple of 64 bytes in size, you need to send an extra empty packet to terminate the transfer). o usbd_open_pipe_intr() now accepts an interval argument which can be used to change the rate at which the interrupt callback routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the value specified in the device's config data, but drivers can override it if needed. - Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions. - Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all control transfers. We no longer force the non-tsleep hack for bulk transfers since these are done asynchronously anyway. - Removed quirk entry fiddling from if_aue and if_kue since we don't need it anymore now that we have the USBD_NO_TSLEEP flag. - Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to usbd_open_pipe_intr(). - Add a flag to the softc struct in the ethernet drivers to indicate when a device has been detached, and use this flag to perform tests to prevent the drivers from trying to do control transfers if this is the case. This is necessary because calling if_detach() with INET6 enabled will eventually result in a call to the driver's ioctl() routine to delete the multicast groups on the interface, which will result in attempts to perform control transfers. (It's possible this also happens even without INET6 support enabled.) This is pointless since we know that if the detach method has been called, the hardware has been unplugged. - Changed watchdog timeout routines to just call the driver init routines to initialize the device states without trying to close and re-open the pipes. This is partly because we don't want to frob things at interrupt context, but also because this doesn't seem to work right and I don't want to panic the system just because a USB device may have stopped responding. - Fix aue_rxeof() to be a little smarter about detecting when a double transfer is needed. Unfortunately, the design of the chip makes it hard to get this exactly right. Hopefully, this will go away once either Nick or Lennart finds the bug in the uhci driver that makes this ugly hack necessary. - Also sync usbdevs with NetBSD.
* Remove the 'ivars' arguement to device_add_child() andmdodd1999-12-031-3/+5
| | | | | | | | | | | | | | | | device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function. This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc. Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree. Reviewed by: peter, dfr
* Add devnames, the device names the drivers attached to for usbd.n_hibma1999-11-281-14/+42
| | | | | 0 -> NULL changes. Add realloc (for OpenBSD)
* Addition of new fields to the usb_devinfo struct to enable the newn_hibma1999-11-211-3/+9
| | | | | | | | | | | | | | | | | | and shiny usbd daemon to handle events. usb_port.h: - Add a macro to retrieve the unit number from a USBBASEDEVICE usb.h, usb_subr.c: - Add fields to the device_info struct. usb_subr.c: - Fill in the new fields. - Remove the notification of the event up a bit to make sure all the information is still available to fill the usb_devinfo struct. This requires recompilation of usbdevs (src/usr.sbin/usbdevs) and the ezdownload/ezupload (ports/misc/ezload) utilities in any case.
* Synchronisation with NetBSD as of 1999/11/16:n_hibma1999-11-171-122/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleaning up the code: - Declare many functions static - Change variable names to make them more self explanatory - Change usbd_request_handle -> usbd_xfer_handle - Syntactical changes - Remove some unused code - Other KNF changes Interrupt context handling - Change delay to usbd_delay_ms were possible (takes polling mode into account) - Change detection mechanism for interrupt context Add support for pre-allocation DMA-able memory by device driver Add preliminary support for isochronous to the UHCI driver (not for OHCI yet). usb.c, uhci.c, ohci.c - Initial attempt at detachable USB host controllers - Handle the use_polling flag with a lttle more care and only set it if we are cold booting. usb.c, uhci.c ohci.c, usbdi.c usbdi_util.c usb_subr.c - Make sure an aborted pipe is marked as not running. - Start queued request in the right order. - Insert some more DIAGNOSTIC sanity checks. - Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN. usb.c, usb_subr.c - Add an event mechanism so that a userland process can watch devices come and go. ohci.c - Handle the case when a USB transfer is so long that it crosses two page (4K) boundaries. OHCI cannot do that with a single TD so we make a chain. ulpt.c - Use a bigger buffer when transferring data. - Pre-allocate the DMA buffer. This makes the driver slightly more efficient. - Comment out the GET_DEVICE_ID code, because for some unknown reason it causes printing to fail sometimes. usb.h - Add a macro to extract the isoc type. - Add a macro to check whether the routine has been entered after splusb and if not, complain. usbdi.c - Fix a glitch in dequeueing and aborting requests on interrupt pipes. - Add a flag in the request to determine if the data copying is done by the driver or the usbdi layer.
* remove superfluous header includen_hibma1999-11-081-1/+1
| | | | Submitted-By: phk
* Major synchronisation with the NetBSD USB stack:n_hibma1999-10-071-266/+335
| | | | | | | | | | | - Some cleanup and improvements in the uhci and ohci drivers - Support for plugging and unplugging devices improved - Now available is bulk transport over OHCI controllers - Resume and suspend have been temporarily been disabled again. Proper support for it is available in the uhci.c and ohci.c files but I have not yet spent the brain cycles to use it. - OpenBSD now uses the USB stack as well - Add FreeBSD tags
* Add comments, change variable names to make them consistent (r -> err,n_hibma1999-07-251-116/+125
| | | | timo_handle -> timeout_handle, p -> pipe, *pipe -> *rpipe, etc.)
* Only print the device name once, during attach (device_quiet)n_hibma1999-06-211-0/+2
|
* Enable attachment of multiple drivers to a single device.n_hibma1999-05-301-11/+16
|
* Remove feature creep: STAILQ_REMOVE_HEAD_UNTIL added it for conveniencen_hibma1999-04-201-0/+4
| | | | but we can do without it.
* 1) Add Rockfire vendor and gamepad product (MAEKAWA Masahide)n_hibma1999-04-191-1/+38
| | | | | | 2) Sort the list again (Roger Hardiman) 3) Reinstate a piece of code to look for a name for a device if none is found in the device itself.
* 1) Make debugging more selective.n_hibma1999-04-111-95/+24
| | | | | | | 2) create function usbd_errstr which turns a usbd_status into a sensible error message 3) Change the printf in DPRINTF to logprintf which is a define for log(KERN_DEBUG, x)
OpenPOWER on IntegriCloud