summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_subr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Return an error if getting the config descriptor failed.jsg2015-03-231-1/+3
| | | | | | Avoids a NULL dereference encountered with a device I have. ok mpi@
* Always clear a port reset feature after setting it, or at least try to.mpi2014-12-211-18/+17
| | | | | | Otherwise we might leave a port in an unwanted state. Found while investigating timeout issues on xhci(4).
* yet more mallocarray() changes.doug2014-12-131-4/+5
| | | | ok tedu@ deraadt@
* More malloc() -> mallocarray() in the kernel.doug2014-12-091-4/+4
| | | | ok deraadt@ tedu@
* Remove USB locators. They are currently unused and this wont change duempi2014-11-101-45/+4
| | | | to the way USB buses are discovered.
* Remove the port status argument from usbd_reset_port(). We don't dompi2014-11-011-21/+18
| | | | | anything with it and it simplifies this mess in order to implement warm reset.
* Use usbd_set_port_feature() instead of rerolling it.mpi2014-11-011-15/+3
|
* Do not re-establish the default pipe twice for every controller. Movempi2014-10-051-24/+4
| | | | | | this hack in the drivers that need it. Tested by many, thanks! ok pirofti@, kettenis@
* Check that the speed of a new device does not exceed its parent's speedmpi2014-10-011-12/+1
| | | | | | | | | prior to calling usbd_new_device(). This will let us set the specified default Max Packet Size before opening the control pipe and reduces spaghetti! ok stsp@
* Do not allocate space for the whole structure when we just want to storempi2014-08-101-3/+2
| | | | a pointer, found by clang.
* Do not store the whole USB hub descriptor in the "struct usbd_hub"mpi2014-08-091-5/+4
| | | | to help integrating super speed hubs that use a different descriptor.
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-17/+17
| | | | after discussions with beck deraadt kettenis.
* Remove incorrect comment about how autoconf(9) works and documentmpi2014-07-121-16/+3
| | | | | that usbd_detach() should only be called by the thread doing USB bus exploration to prevent attach/detach races.
* Only detach the USB device you disconnected, fix a regression reportedmpi2014-07-121-3/+7
| | | | | | | by guenther@. While here set the dying flag of the disconnected device so that most of the DVACT_ACTIVATE handlers can go.
* Always assign the device address found by the USB stack even if itmpi2014-07-101-4/+8
| | | | | | | | | | | | | | does not match the hardware address. This change only matters for xHCI buses where the controller assigns device addresses. But it is the simplest way to comply with the stack requirement of assigning the first `logical' address to the root hub device. Device addresses are not much used anyway and a cleanup will follow to avoid possible confusions. This makes usbdevs(8) correctly report devices connected to xhci(4).
* autoconf(9) is your friend and it knows you more than you think. Itmpi2014-07-091-51/+28
| | | | | | | | | even knows your children! So let him handle the seperation correctly. Do not rewrite your own custom config_detach_children(9) and as a bonus start removing the usbd_port tentacles from the stack. ok pirofti@, yuo@, miod@, deraadt@
* Adds an optional bus function to set the address of a new device andmpi2014-07-091-18/+30
| | | | | | | | | explicitly set it when required. Right now xhci(4) does not need such function because it assigns addresses when the first pipe of a device is opened. ok yuo@, pirofti@
* Pass M_ZERO to malloc(9) when allocating usbd pipes to make sure tompi2014-03-081-9/+4
| | | | | | initialize the per-controller part. ok deraadt@, kettenis@
* Print the wrong device descriptor's bMaxPacketSize before correcting itmpi2014-03-071-3/+3
| | | | for USB2 devices.
* Make sure to close the default pipe before re-opening it when we wantmpi2014-02-091-3/+3
| | | | | to update the address and packet length, fixes a memory leak introduced in revision 1.96.
* Do not allow to unconfigure a device by setting the configurationmpi2014-02-091-4/+1
| | | | | | | | number 0, leaving its descriptors pointing to NULL. There's a lot of code in our stack that assumes that the various descriptors are always valid and changing this would be too much work for the moment. Fix an issue reported by Thomas Pfaff, thanks!
* Remove a hack to update the address and packet length for every devicempi2014-01-151-2/+19
| | | | | | | | | request and instead re-open the default pipe with updated values when attaching a new device, adapted from FreeBSD r162977. This fixes a problem where the controller could have cached the previous values and would fail to get the device descriptor, leaving the device unrecognized with a message like: "device problem, disabling port n".
* Kill matchlvl usage throughout the usb stack.pirofti2013-11-191-13/+1
| | | | | | Allows us to move forward on cleaning. Okay mpi@
* Remove a layer of abstraction for fetching a configuration descriptor.mpi2013-11-021-7/+10
|
* Unswap address and configuration value arguments in a debug printf.mpi2013-08-211-3/+3
|
* Remove bogus and useless refcounting of usbd pipes that could lead tompi2013-08-131-2/+1
| | | | | | | memory leaks and abort the pipe if requests are still pending because most of our drivers don't do anything if usbd_close_pipe() fails. ok miod@
* These functions should only used in the usb-autoconf glue, do not exposempi2013-08-081-1/+4
| | | | them.
* Use the same functions to abort and close the control pipe of a devicempi2013-08-081-14/+5
| | | | | as for every other pipes instead of having another function calling the host controller method.
* Get rid of various 'typedef struct' definitions and use plain structuremglocker2013-04-151-39/+40
| | | | | | | | | definitions instead. We don't change usb.h for now to stay compatible with userland. Tested by mpi@ on macppc and myself on i386. ok mpi@
* Merge usbd_get_device_desc() into the only function using them.mpi2013-04-101-2/+3
| | | | ok mglocker@
* Merge usb_devinfo* helper functions into usbd_print(), nothing else usempi2013-04-101-20/+5
| | | | | | them. ok ratchov@, mglocker@
* There's no need for usbd_get_config_desc_full() so just call usbd_get_desc()mpi2013-04-091-2/+2
| | | | | | | directly this also makes it easier to understand which function actually generates IO. ok mglocker@
* Make ugen_get_cdesc() a generic function by renaming it to usbd_get_cdesc()mglocker2013-04-011-1/+35
| | | | | | and move it to usb_subr.c. OK mpi@
* proc.h is way too much header for usb to handle.tedu2013-03-281-2/+1
|
* No need for two similar functions to free/remove USB device descriptors.mpi2013-03-161-26/+16
|
* Set the usb(4) unit number as bus number. This fixes a possiblempi2012-05-151-2/+2
| | | | | | | conflict where machines with two controllers with the same unit number (i.e. ehci0 and uhci0) would have reported to buses 0. ok miod@
* Remove usb_event_cookie_t type and instances of it found in various structs;miod2012-01-081-5/+1
| | | | leftover from the "usb event" stuff removal. Diff from Tobias Ulmer.
* garbage collect "usb events". without /dev/usb there is no way to accessjakemsr2011-01-251-4/+1
| | | | | | them from userland, and nothing in the kernel uses them. ok krw@, miod@
* * instead of NULLing pointers to interface descriptors in the uaa, markjakemsr2011-01-161-23/+34
| | | | | | | | | | | | | interfaces as being claimed in the usbd_device's copy of the interface descriptors * allow ugen(4) to be attached if there are unused interfaces in a configuration that has had drivers attached * make ugen(4) aware that it may be sharing a device with (an)other driver(s), and if so: * do not let ugen(4) change the configuration * do not let ugen(4) access the already claimed interfaces discussed with deraadt and miod
* * add 'udi_serial' to struct usb_device_info.jakemsr2011-01-151-1/+5
| | | | | | | * fill 'udi_serial' with the serial number in usbd_fill_deviceinfo(). * add compatability ioctl/struct so old binaries continue to work. discussed with deraadt and miod
* - use nitems()jasper2010-12-171-2/+2
| | | | ok jakemsr@
* don't delay if the device is dyingjakemsr2010-12-151-1/+4
| | | | ok krw@
* call config_deactivate() before config_detach() when detaching devices.jakemsr2010-12-061-1/+5
|
* tsleep on a static and private handle, since our goal is to not bederaadt2010-09-241-2/+5
| | | | | | | woken up by a wakeup, but only by the actual timeout expiry. On architectures which share a kva upage area between processes, we would not want an accidental wakeup (too short). discussed with various
* cap device's speed to the parent's one if higher. from FreeBSD.fgsch2009-01-141-1/+12
| | | | krw@ miod@ ok.
* change a device descriptor get logic during the enumeration process.yuo2008-11-241-7/+37
| | | | | | | | | | | | Some device could not handle the device descriptor request with short bLength (less than the device descriptor size(18 byte)). To handle such kind of devices, add complemental request loop to current logic. (memo: and I also found a device which can not response to any device descriptor request. It always returns only 8 byte-length head of the descriptor for 1st query. This is the reason why the device descriptor loop of this usb subsystem start with 8-byte length query.)
* revert part of rev. 1.65 where we set the address earlier. this seemsfgsch2008-08-031-24/+16
| | | | to cause issues as per netbsd pr/39023. deraadt@ yuo@ ok.
* When getting the string descriptors, fetch 2 bytes (size and type) first,fgsch2008-07-281-3/+3
| | | | | | | | and then the whole string based on the returned size, not just one byte. The Lexar card reader kindly loaned by Denis Doroshenko (denis dot doroshenko at gmail.com) it's happy now, and after further inspection it's what other OSs do. Discussed with yuo@. krw@ yuo@ ok.
* add usb2.0 to usb1.1(ohci/uchi) handover request to usb subsystem.yuo2008-06-291-1/+51
| | | | | | | | | | | add new quirk entry for uvideo which is required isoc transfer. Some usb2.0 devices use isochronous transfer but current usb subsystem does not support isoc transfer in ehci(usb2.0) bus. This patch introduce new psuedo usb hub request UHF_PORT_DISOWN_TO_1_1 to handover the device to ehci to usb1.1 bus(ohci or uhci). ok mglocker@ deraadt@ fgsch@
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@