summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_device.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve USB mass storage quirk auto detection.hselasky2011-10-291-1/+2
| | | | MFC after: 3 days
* Refactor auto-quirk solution so that we break as few externalhselasky2011-09-101-6/+16
| | | | | | | | | drivers as possible. PR: usb/160299 Approved by: re (kib) Suggested by: rwatson MFC after: 0 days
* This patch adds automatic detection of USB mass storage deviceshselasky2011-09-021-1/+33
| | | | | | | | | | | | which does not support the no synchronize cache SCSI command. The __FreeBSD_version version macro has been bumped and external kernel modules needs to be recompiled after this patch. Approved by: re (kib) MFC after: 1 week PR: usb/160299
* Use synchronous device destruction instead of asynchronous, so that a newhselasky2011-08-111-32/+47
| | | | | | | | | device having the same name like a previous one is not created before the old one is gone. This fixes some panics due to asserts in the devfs code which were added recently. Approved by: re (kib) MFC after: 1 week
* - Ensure that we get all the required nomatch devd events.hselasky2011-06-241-9/+10
| | | | MFC after: 3 days
* - Move execution of event handlers into the probe and attach function so thathselasky2011-06-241-6/+16
| | | | | | | | | dynamically loaded device drivers get a chance to run their event hooks. - Decouple the USB suspend and resume lock from witness. It produces some false warnings due to reusing the lock name among multiple devices. MFC after: 3 days
* usb: change to one-pass probing of device driversavg2011-05-181-11/+0
| | | | | | | | | | | | | | | | | | | | | This brings USB bus more in line with how newbus is supposed to be used. Also, because of the two-pass probing the following message was produced by devd in default configuration when almost any USB device was connected: Unknown USB device: vendor <> product <> bus <> This should be fixed now. Note that many USB device drivers pass some information from probe method to attach method via ivars. For this to continue working we rely on the fact that the subr_bus code calls probe method of a winning driver again before calling its attach method in the case where multiple drivers claim to support a device. This is done because device description is set in successful probe methods and we want to get a correct device description from a winning driver. So now this logic is re-used for setting ivars too. Reviewed by: hselasky MFC after: 1 month
* Cleanup usb_notify_addq_compat(). It should nothselasky2011-05-081-75/+0
| | | | | | be needed any more. MFC after: 7 days
* Remove unneeded includes of <sys/linker_set.h>. Other headers that usejhb2011-01-111-1/+0
| | | | | | it internally contain nested includes. Reviewed by: bde
* We need to define a cdev variable associated with each USB device,hselasky2010-11-301-0/+4
| | | | | | | | | | | hence existing applications like webcamd are expecting that. This problem was introduced by SVN change 214221 where cdev= was replaced by ugen= by accident. Solve this problem by redefining cdev= in devd notifications. MFC after 3 days. Approved by: thompsa (mentor)
* Bugfix: Move the 'at <location string' to the beginning of the attachn_hibma2010-11-051-4/+3
| | | | | | | | | notification. devd would stop evaluating at 'at' (not '<k>=<v>') and hence prevent 'port=X' (and 'bus=<"on" string>) from making it into the environment for the devd action. Reviewed by: hselasky MFC after: 2 weeks
* Don't terminate the notification with \n. This is done inn_hibma2010-11-041-2/+2
| | | | usb_device.c:devctl_notify_f().
* Add support for setting per-interface PnP information.hselasky2010-10-271-4/+46
| | | | | Submitted by: Nick Hibma Approved by: thompsa (mentor)
* Add possibility to generate devctl notifications regardless of UGEN presence.hselasky2010-10-221-15/+46
| | | | | Submitted by: Nick Hibma Approved by: thompsa (mentor)
* This commit adds full support for USB 3.0 devices in host and devicehselasky2010-10-041-49/+68
| | | | | | | | | | | | | | | | mode in the USB core. The patch mostly consists of updating the USB HUB code to support USB 3.0 HUBs. This patch also add some more USB controller methods to support more active-alike USB controllers like the XHCI which needs to be informed about various device state events. USB 3.0 HUBs are not tested yet, due to lack of hardware, but are believed to work. After this update the initial device descriptor is only read twice when we know that the bMaxPacketSize is too small for a single packet transfer of this descriptor. Approved by: thompsa (mentor)
* Reduce the need to accesss struct usb_device by providing functions to accessthompsa2010-09-021-7/+28
| | | | | | the product, manufacturer and serial strings. Submitted by: Hans Petter Selasky
* Add support for power mode filtering as some USB hardware does not supportthompsa2010-09-021-1/+1
| | | | | | power saving. Submitted by: Hans Petter Selasky
* fix a few cases where a string is passed via format argument instead ofavg2010-06-111-1/+1
| | | | | | | | | | via %s Most of the cases looked harmless, but this is done for the sake of correctness. In one case it even allowed to drop an intermediate buffer. Found by: clang MFC after: 2 week
* If a USB device is suspended and a USB set config request is issued when thethompsa2010-05-121-3/+30
| | | | | | | | | | USB enumeration lock is locked, then the USB stack fails to resume the device because locking the USB enumeration lock is part of the resume procedure. To solve this issue a new lock is introduced which only protects the suspend and resume callbacks, which can be dropped inside the usbd_do_request_flags() function, to allow suspend and resume during so-called enumeration operations. Submitted by: Hans Petter Selasky
* Use a more obvious prefix for the USB control (endpoint 0) transfers ratherthompsa2010-04-221-23/+23
| | | | than default_*.
* Properly name the sxlocks, mutexes and condvars.thompsa2010-04-221-19/+19
|
* Use SX_DUPOK rather than making the string unique.thompsa2010-04-221-2/+2
|
* Also add the usb mode to the devd string as the usb controller can work in boththompsa2010-04-211-0/+4
| | | | | | host or device (gadget) modes. Suggested by: HPS
* Change usb devd events from fake attach to a notify. The ugen device is not athompsa2010-04-211-4/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | proper device_t so it faked the devctl event to appear like one, this is now a notify which allows more information to be passed. We notify for both the device attach/detach and for each usb interface. A devd rule can now match on the interface properties, including composite devices which may have a uvideo interface and also usound and possibly uhid too. An example to match a umass device with a scsi subclass and BBB protocol would be notify 100 { match "system" "USB"; match "subsystem" "INTERFACE"; match "type" "ATTACH"; match "intclass" "0x08"; match "intsubclass" "0x06"; match "intprotocol" "0x50"; action ... }; The old attach devctl event has been retained for the moment to make merging to 8.1 easier. This was never compatible with 7.x or earlier due to the ugen regex change needed. Reviewed by: warner MFC after: 1 week
* Implement USB kernel driver detach from userland.thompsa2010-03-111-1/+0
| | | | Submitted by: Hans Petter Selasky
* Improve u3g device ejecting by providing additional methods for the ejectthompsa2010-01-061-1/+1
| | | | | | | command in the usb_msctest routines, as well as a general tidyup. This now properly ejects the ZTE MF636, Option Gi0322 and Novatel MC950D devices I have on my desk.
* scratch_size was incorrectly passed as language ID when retrieving the languagethompsa2010-01-061-2/+1
| | | | | | | ID table, this broke string retrieval on some devices. Submitted by: Hans Petter Selasky Reported by: Renato Botelho
* Use the EVENTHANDLER system to hook into the usb device configuration andthompsa2009-12-171-76/+75
| | | | | | | perform a function such as ejecting a 3G autoinstaller disk. The eventhandler system properly tracks threads and is safe to unload, remove the setting/clearing of a function pointer in the kernel by u3g(4) which included a tsleep for safety.
* Remove overuse of exclamation marks in kernel printfs, there mere fact athompsa2009-11-261-11/+11
| | | | | | message has been printed is enough to get someones attention. Also remove the line number for DPRINTF/DPRINTFN, it already prints the funtion name and a unique message.
* Improve High Speed slot allocation mechanism by moving the computation to thethompsa2009-11-221-1/+1
| | | | | | endpoint rather than per xfer and provide functions around get/free of resources. Submitted by: Hans Petter Selasky
* Correct buffer sizes used so that they match. The old code could give thethompsa2009-09-281-2/+3
| | | | | | | impression that a overflow situation existed but was not possible. Reported by: kib Submitted by: Hans Petter Selasky
* Add support for USB language selection.thompsa2009-09-281-21/+63
| | | | | | PR: usb/138563 Reported by: Bruce Cran Submitted by: Hans Petter Selasky
* Fix NULL-pointer dereference in usb_endpoint_foreach().thompsa2009-09-281-1/+3
| | | | | PR: usb/138389 Submitted by: Patroklos Argyroudis at census, inc
* MFp4 @ 168387thompsa2009-09-281-17/+13
| | | | | | | | | | | | | | | | - clean up USB detach logic. There seems to be some problems detaching multiple USB HUBs connected in series from the root. - after this patch the rule is: 1) Always use device_detach() on the USB HUB first. 2) Never just device_delete_child() on the USB HUB, because that function will traverse to all the device leaves and free them first, and then the USB stack will free the devices twice which doesn't work very well. - make sure the did DMA delay gets set after the timeout has elapsed to make logic more clear. There is no functional difference. Submitted by: Hans Petter Selasky
* - Patch to allow USB controller to resume operation afteralfred2009-08-241-22/+58
| | | | | | | | | | | | | | | | | | | | | | | being polled. - Remove the need for Giant from the USB HUB driver. - Leave device unconfigured instead of disabling the USB port when Huawei Autoinstall disk detection triggers. This should fix problems that the Huawei device is not detected after Autoinstall eject is issued. - Reported by: Nikolay Antsiferov - Fix memory use after free race for USB character devices. - Reported by: Lucius Windschuh - Factor out the enumeration lock into three functions to make the coming newbus lock conversion more easy. - usbd_enum_lock - usbd_enum_unlock - usbd_enum_is_locked Submitted by: hps
* USB core:alfred2009-07-301-17/+18
| | | | | | | | | | | | | | | - add support for defragging of written device data. - improve handling of alternate settings in device side mode. - correct return value from usbd_get_no_alts() function. - reported by: HPS - P4 ID: 166156, 166168 - report USB device release information to devd and pnpinfo. - reported by: MIHIRA Sanpei Yoshiro - P4 ID: 166221 Submitted by: hps Approved by: re
* Sync to p4thompsa2009-06-271-1/+1
| | | | | | | | | - Add support for devices that handle set and clear stall in hardware. - Add missing get timestamp function - Add more xfer flags Submitted by: Hans Petter Selasky Approved by: re (kib)
* - Make struct usb_xfer opaque so that drivers can not access the internalsthompsa2009-06-231-9/+29
| | | | - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h
* Fix usb2_find_descriptor function name.thompsa2009-06-151-2/+2
|
* s/usb2_/usb_|usbd_/ on all function names for the USB stack.thompsa2009-06-151-200/+200
|
* Remove usb2_cv_* and just use the kernel condvar implementation, it was neededthompsa2009-06-151-5/+5
| | | | | earlier since condition variables didnt work with Giant but this was fixed 10 months ago.
* Rename usb pipes to endpoints as it better represents what they are, and structthompsa2009-06-071-119/+119
| | | | usb_pipe may be used for a different purpose later on.
* s/usb2_/usb_/ on all typedefs for the USB stack.thompsa2009-05-291-15/+15
|
* Free device strings.thompsa2009-05-291-0/+3
| | | | Spotted by: HPS
* s/usb2_/usb_/ on all C structs for the USB stack.thompsa2009-05-281-128/+128
|
* Allocate the usb serial, manufacturer and product strings rather than use charthompsa2009-05-271-95/+45
| | | | arrays in the usb_device struct. This also eliminates USB_HAVE_STRINGS.
* Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.thompsa2009-05-211-1/+1
| | | | Submitted by: Hans Petter Selasky
* Use enums for speed and rev data types.thompsa2009-05-211-4/+4
|
* - rename usb2_mode to usb_mode [1]thompsa2009-05-211-21/+21
| | | | | | - change variable types to use the enum Submitted by: Hans Petter Selasky [1]
* Revert part of r191494 which used the udev state to mark suspending, this needsthompsa2009-05-051-11/+8
| | | | | | | | to be set via two variables (peer_suspended and self_suspended) and can not be merged into one. Submitted by: Hans Petter Selasky Pointy hat: me
OpenPOWER on IntegriCloud