summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_subr.c
Commit message (Collapse)AuthorAgeFilesLines
* Although USBVERBOSE was an option in the config system, usb_subr.c failedimp2005-01-201-0/+2
| | | | to recognize that. Include opt_usb.h to pick it up, rather than usb_port.h.
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Merge recent USB2/EHCI related changes from NetBSD:iedowse2004-11-031-8/+23
| | | | | | | | | | | | | | | | o Reduce the interrupt delay to 2 microframes. o Follow the spec more closely when updating the overlay qTD in the QH. o No need to generate an interrupt at the data part of a control transfer, it's generated by the status transfer. o Make sure to update the data toggle on short transfers. o Turn the printf about needing toggle update into a DPRINTF. o Keep track of what high speed port (if any) a device belongs to so we can set the transaction translator fields for the transfer. o Verbosely refuse to open low/full speed pipes that depend on unimplemented split transaction support. o Fix various typos in comments. Obtained from: NetBSD
* Remove extra */peter2004-09-301-1/+1
| | | | Submitted by: Manfred Antar <null@pozo.com>
* When opening a pipe, usbd_setup_pipe() will do a usbd_clear_endpoint_stall()wpaul2004-09-291-3/+8
| | | | | | | | | | | | | | | | | | | | | | to make sure the pipe is ready. Some devices apparently don't support the clear stall command however. So what happens when you issue such devices a clear stall command? Typically, the command just times out. This, at least, is the behavior I've observed with two devices that I own: a Rio600 mp3 player and a T-Mobile Sidekick II. It used to be that after the timeout expired, the pipe open operation would conclude and you could still access the device, with the only negative effect being a long delay on open. But in the recent past, someone added code to make the timeout a fatal error, thereby breaking the ability to communicate with these devices in any way. I don't know exactly what the right solution is for this problem: presumeably there is some way to determine whether or not a device supports the 'clear stall' command beyond just issuing one and waiting to see if it times out, but I don't know what that is. So for now, I've added a special case to the error checking code so that the timeout is once again non-fatal, thereby letting me use my two devices again.
* Add comments about why we're freeing subdevs (which is completelyimp2004-09-091-8/+11
| | | | | | | | | | redundant at this point and should be retired). Don't free subdevs if we don't attach any devices. This was leaving stale device_t's around. Don't touch the device if it isn't attached since the name isn't meaningful then. Switch from strncpy (properly used) to strlcpy. From a patch submitted by Peter Pentchev
* Tweak the compatibility macros a little so that the device printing isimp2004-08-151-2/+12
| | | | moved into them.
* Next step in making usb more newbus:imp2004-08-141-37/+31
| | | | | | | | | | | | | o reprobe children when a new driver is added to uhub o fix the usbd_probe_and_attach to set the ivars to a malloc'd area, as well as freeing the ivars on child destruction. o Don't delete children that don't attach. Evidentally, the need to do this is a common misconception. o minor formatting foo that may violate style(9) at the moment, but keeps the diffs against my p4 tree smaller. This does not solve the ugen gobbling things up problem, but the fixes I have for that expose bugs in other parts of the tree...
* Add pnpinfo and location information to uhub. We also keep track ofimp2004-06-301-14/+43
| | | | | | the subdevices of uhub better now to accomplish this. Submitted by: Bernd Walter
* MFp4: First batch of dev/usb/usbdevs.h -> usbdevs.h changes.imp2004-06-271-2/+2
|
* MFNetBSD.le2004-06-261-7/+23
| | | | | | | | | | | | | | | | | | | | | | uhid.c (1.61), author: jdolecek add support for USB_GET_DEVICEINFO and USB_GET_STRING_DESC ioctls, with same meaning as for ugen(4) usbdi_util.h (1.29), usb_quirks.c (1.50), uhid.c (1.62), ugen.c (1.68), usb_subr.c (1.114) author: mycroft Yes, some devices return incorrect lengths in their string descriptors. Rather than losing, do what Windows does: just request the maximum size, and allow a shorter response. Obsoletes the need for UQ_NO_STRINGS, and therefore these "quirks" are removed. usb_subr.c (1.116), author: mycroft In the "seemed like a good idea until I found the fatal flaw" department... Attempting to read a maximum-size string descriptor causes my kue device to go completely apeshit. So, go back to the original method, but allow the device to return a shorter string than it claimed. Obtained from: NetBSD
* Refuse to change the configuration index if the device has openiedowse2004-05-291-2/+10
| | | | | | | | | | | | pipes, since open pipes are linked off a usbd_interface structure that is free()'d when the configuration index is changed. Attempting to close or use such pipes later would access freed memory and usually crash the system. The only driver that is known to trigger this problem is if_axe, which is itself at fault, but it is worth detecting the situation to avoid the obscure crashes that result from this type of easily made driver mistakes.
* Do the looping retry trick in the first operation to try to talkjulian2004-04-011-11/+14
| | | | | | with the device, not the second.. Submitted by: ticso@cicely12.cicely.de
* Put the event notification back where it was for freeBSD, after device creation.julian2004-03-201-2/+2
| | | | | | | Since NetBSD doesn't have devfs the order for them doesn't matter.. Reverses one part of 1.60->1.61 NetBSD diff reduction. Obtained from: Not NetBSD
* Diff reduction to NetBSDjulian2004-03-191-22/+35
| | | | | | | Bring over sundry small fixes from NetBSD Obtained from: NetBSD MFC after: 1 week
* Re-enable detach events after adding a bugfix from NetBSDjulian2004-03-191-1/+2
| | | | | | | | that unbreaks them. Submitted by: dillon Obtained from: NetBSD MFC after: 2 days
* 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.
OpenPOWER on IntegriCloud