Home | History | Annotate | Download | only in usb
History log of /src/sys/dev/usb/uhidev.c
RevisionDateAuthorComments
 1.95  04-Feb-2024  mrg update my email address.
 1.94  04-Nov-2022  jmcneill Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR# 57031
 1.93  28-Mar-2022  riastradh uhidev(9): Assert uhidev is open when writing.

(Maybe we could have uhidevs that are output-only, in which case a
driver could, in principle, want to issue writes without getting any
input report interrupts. But we can cross that bridge when we come
to it.)
 1.92  28-Mar-2022  riastradh uhidev(9): Define UHIDEV_MAXREPID = 255.

Report ids are limited by the HID spec to a single byte.

- Clamp max report id in report descriptor to this.

- Prune dead refcnt-overflow error branches. Assert instead.
 1.91  28-Mar-2022  riastradh uhidev(9): Omit needless sc_dying.
 1.90  28-Mar-2022  riastradh uhidev(9): Make uhidev state opaque.

This makes the API simpler and clearer and gives us more latitude to
fix bugs in the state management without breaking the ABI.

XXX kernel ABI change to signature of uhidev_get_report_desc and
uhidev_open, and to struct uhidev_attach_arg, requires bump for
uhidev driver modules
 1.89  28-Mar-2022  riastradh uhidev(9): Fix race between uhidev_close and uhidev_intr.

uhidev_intr currently relies on the kernel lock to serialize access
to struct uhidev::sc_state, but if the driver's sc_intr function
sleeps (which it may do, even though this runs is softint context --
it may sleep on an adaptive lock), uhidev_close might return while
the driver's sc_intr function is still in flight.

This avoids that race, and makes progress toward MP-safe uhidev.
 1.88  28-Mar-2022  riastradh uhidev(9): Refactor error branch to use one label.

No functional change intended.
 1.87  28-Mar-2022  riastradh uhidev(9): Make some private functions static and fix comment.

No functional change.
 1.86  28-Mar-2022  riastradh uhidev(9): Make uhidev_stop work reliably.
 1.85  28-Mar-2022  riastradh uhidev(9): Move struct uhidev_softc into uhidev.c.

No longer part of any ABI for uhidev modules.
 1.84  28-Mar-2022  riastradh uhidev(9): New uhidev_write_async.

Like uhidev_write but issues the transfer asynchronously with a
callback.

Use it in ucycom(4).

Also, clear endpoint stalls asynchronously -- can't do them
synchronously in xfer callbacks which run at softint and therefore
can't wait in cv_wait as usbd_do_request does.
 1.83  28-Mar-2022  riastradh uhidev(9): Partially fix uhidev_write aborting.

In my previous change, I intended to make uhidev_stop abort any
pending write -- but I forgot to initialize sc->sc_writereportid, so
it never did anything.

This changes the API and ABI of uhidev_write so it takes the struct
uhidev pointer, rather than the struct uhidev_softc pointer; this way
uhidev_write knows what the report id of the client is, so it can
arrange to have uhidev_stop abort only this one.

XXX Except it still doesn't actually work because we do this
unlocked, ugh, so the write might complete before we abort anything.
To be fixed some more in a later change.

XXX kernel ABI change to uhidev_write signature, used by uhidev
driver modules, requires bump
 1.82  09-Feb-2022  jakllsch Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.
 1.81  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.80  24-Apr-2021  thorpej branches: 1.80.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.79  29-Nov-2020  riastradh branches: 1.79.2;
usb: Overhaul uhid(4) and uhidev(4) locking.

- uhidev API rules:

1. Call uhidev_open when you want exclusive use of a report id.
After it succeeds, you will get interrupts.

2. Call uhidev_close when done with exclusive use of a report id.
After it returns, you will no longer get interrupts.

=> uhidev_open/close do not nest.

3. uhidev_write no longer requires the caller to have exclusive
access -- if there is a write in progress, it will block
interruptibly until done. This way drivers for individual
report ids need not work separately to coordinate their writes.

4. You must uhidev_stop to abort any pending writes on the same
report id. (uhidev_stop no longer does anything else -- to
ensure no more interrupts, just use uhidev_close.)

- Fix uhidev_open/close locking -- uhidev now has an interruptible
config lock held only on first open and last close by any report id
in the device, to serialize the transition between zero and nonzero
numbers of references which requires opening/closing pipes and
allocating/freeing buffers.

- Make /dev/uhidN selnotify(POLLHUP) when the device is yanked.

- Factor uhid device lookup and reference counting and dying
detection and so on into uhid_enter/exit.

- Nix struct uhid_softc::sc_access_lock. This served no purpose but
to confuse me when trying to understand the logic of this beast
(and to ensure uhidev_write exclusion, but it was uninterruptible,
which is wrong for something that implements userland operations,
and didn't actually work because uhidev_write did nothing to
coordinate between different report ids).

- Fix locking in select/poll.

- Use atomics to manage UHID_IMMED to keep it simple. (sc_lock would
be fine too but it makes the code more verbose.)

- Omit needless UHID_ASLP -- cv_broadcast already has this
micro-optimization.


With these changes, my Pinebook survives

for i in `jot 100`; do
echo '###' $i
for j in `jot 16`; do
usbhidctl -rf /dev/uhid$j >/dev/null &
done
wait
done

while plugging and unplugging uhid(4) devices (U2F keys), and the U2F
keys still work as U2F keys.


ok nick, mrg

XXX pullup-9
XXX pullup-8?


Note on ABI and pullups: This changes the layout of struct
uhidev_softc, but with the sole exception of ucycom(4) -- which at
the moment is completely broken and unusable -- the only members that
USB HID drivers use are sc_udev and sc_iface, which haven't changed.
The layout of struct uhidev, which is allocated by each USB HID
driver in its own softc structure, is unchanged.
 1.78  14-Mar-2020  christos branches: 1.78.4;
revert the 0x% -> %# change for fixed width formats pointed out by uwe.
 1.77  13-Mar-2020  christos PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log
 1.76  06-Dec-2019  maxv localify
 1.75  05-May-2019  mrg branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h
 1.74  15-Nov-2018  jakllsch Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.
 1.73  10-Dec-2017  bouyer branches: 1.73.2; 1.73.4;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.72  02-Sep-2017  ryoon Support some Wacom pen tablets:

* Graphire (pen)
* Graphire2 (pen)
* Intuos2 A4 (pen)
* Intuos Art (pen, no finger touch)

Remove report descriptor override workaround for
Graphire and Graphire2.
 1.71  13-Aug-2017  jakllsch Always try to set USB HID devices into Report Protocol. (Unless the
device is known to be quirky.)

Some of the most-widely-compatible methods of implementing USB Keyboard
NKRO depend on this Request to function as designed.

Issuing this Request is recommended by the HID 1.11 spec (7.2.6):

... "the host should not make any assumptions about the device's state
and should set the desired protocol whenever initializing a device."
 1.70  01-Jun-2017  chs branches: 1.70.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.69  04-Dec-2016  skrll Whitespace
 1.68  07-Jul-2016  msaitoh branches: 1.68.2;
KNF. Remove extra spaces. No functional change.
 1.67  30-Apr-2016  jakllsch Make #if 0 code that sets the protocol mode compilable.
 1.66  27-Apr-2016  jakllsch Pull in opt_usb.h in _KERNEL_OPT case for various *_DEBUG options.
Makes various driver-specific debugging options work again.

XXX more to fix in dev/usb
 1.65  23-Apr-2016  skrll Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.64  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.63  07-Mar-2015  mrg properly protect uhid's sc_q member with sc_lock. should fix PR#49728.
while here, remove D_MPSAFE from uhid* and all uhid users, as it really
needs all the callers to be safe and they're not.

XXX: pullup-7
 1.62  08-Feb-2015  jmcneill Add Xbox One controller support. Report descriptor from https://github.com/lloeki/xbox_one_controller
 1.61  10-Aug-2014  tls branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.
 1.60  17-Jun-2014  skrll PR/48908: Cannot open /dev/uhid? when another report id at the same uhidev
was already opened.

Restore the sc reference counting lost in usbmp merge.
 1.59  26-Dec-2013  christos branches: 1.59.2;
from "Just a Normal Person", make sure that we set things to NULL after
we free them.
 1.58  05-Oct-2013  skrll Trailing whitespace.
 1.57  26-Sep-2013  skrll Remove usbd_do_request_async. It's callback was calling usbd_free_xfer
from softint context.

Adjust callers appropriately

- usbd_clear_endpoint_stall_async is already triggered via a
usb_task, so simply call usbd_do_request.

- uhidev_set_report_async had one caller in ukbd_set_leds.
Convert this usage to use usb_task as well.

Discussed with mrg@
 1.56  10-Jun-2012  mrg branches: 1.56.2; 1.56.4;
merge the jmcneill-usbmp branch. many thanks to jared for the
initial work, and every one else who has tested things for me.
this is largely my fault at this point :-)

the main changes are something like:

- usbd_bus_methods{} gains a get_lock() to enable the
host controller to provide a lock for the USB code.
if the lock isn't provided, old-style protection is
(partially) applied.

- ehci/ohci/uhci have been converted to the new
interfaces, including mutex/cv/etc conversion.

- usbdivar.h contains a discussion about locking and
what locks are held for which method calls. more
to come for usbdi(9) here.

- audio drivers (uaudio, umidi, auvitek) have been
properly SMPified now that USB is ready.

- scsi drivers have been modified to take the kernel
lock explicitly before calling into scsi code.

- usb pipes are associated with a lock, that is the
same as the controller lock. (this could be split
up further in the future.)

- several usbfoo_locked() or usbfoo_unlocked()
functions have been added to the usbdi(9) to
enable functionality with or without the USB
lock (per controller) already being held.

the TODO.usbmp file has specific details on what is left to
do, including what device-specific changes should be done now
that the whole framework is ready.
 1.55  02-Feb-2012  tls Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.54  23-Dec-2011  jakllsch Revert previous due to active usbmp branch(es).
 1.53  22-Dec-2011  jakllsch Adjust-away inconsistent and trailing whitespace.
 1.52  25-Oct-2011  aymeric branches: 1.52.2; 1.52.6;
enable Sony's Six Axis and DualShock 3 USB controllers
 1.51  30-Jul-2011  jmcneill add support for game controllers in "XInput" mode, they are basically
HID devices without a report descriptor
 1.50  20-Jul-2011  ryoon Fix PR kern/42570

* Graphire uses the descriptor as same as Graphire 3.
This is confirmed by USB analysis on Windows.
That is done with Wacom's official device driver and USB Snoopy.

* Old rev. 1.1 descriptor supports stylus only, probably 4D mouse
is not supported. Graphire 3's one probably supports 4D mouse.

* Graphire also needs 0x0202 sending.
 1.49  29-Jan-2011  tsutsui kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.
 1.48  03-Nov-2010  dyoung branches: 1.48.2; 1.48.4;
Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),
USB_MATCH(), et cetera. These files produce the same assembly
(according to objdump -d) before and after the change
 1.47  12-Jan-2010  jakllsch branches: 1.47.2; 1.47.4;
Adjust report descriptor for Logitech USB Receiver M/N C-BT44 to
more closely match what is in the report. (This corrects the
off-by-one usages of most of the gray multimedia keys on a EX110
wireless keyboard so they can sensibly be used with libusbhid(3),
usbhidctl(1) and usbhidaction(1).)

This device also uses officially reserved usages (in the approximate
range of 0x1000 to 0x1100) in the Consumer usage page, but these
are out of the logical range the device reports as being valid.
 1.46  30-Dec-2009  jakllsch The Dell DRAC5 gives us a zero-length report immediately following
a normal report. Thus, ignore zero-length reports. Move some related
report size insanity checking into the UHIDEV_DEBUG case.

Should fix PR/39911.
 1.45  12-Nov-2009  dyoung Simplify activation hooks. (sc_dying must die!)
 1.44  06-Nov-2009  rafal Fix kern/41737 -- add quirks to make MS Wireless Laser Mouse 6000 work.
 1.43  23-Sep-2009  plunky fix up USB drivers printing of autoconf information

1. expand the USB_ATTACH_SETUP macro (requested by jmcneill)

2. reorder the attach function so that the first thing it does is print
newlines.

3. after this, we can call usbd_devinfo_alloc(), which polls the device
allowing a context switch, and aprint_normal() the device information.

this avoids problems where autoconf messages are getting mixed up.
 1.42  26-May-2008  drochner branches: 1.42.8; 1.42.16;
Fix a dereference if a softc pointer which can legally be zero, leading
to a crash reported by Christoph Egger in a followup to PR kern/38528.
For consistency, keep track of the device_t pointer to child devices
rather than the softc. We really shouldn't mess with child's softc data.
 1.41  24-May-2008  cube Split device_t and softc for all USB device drivers, and related cosmetic
changes.

Matthias Drochner kindly reviewed this patch, and tested ums, ubt, uaudio
and ral. I tested umass myself.
 1.40  28-Apr-2008  martin branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses
 1.39  18-Feb-2008  dyoung branches: 1.39.6; 1.39.8; 1.39.10;
Use device_t and its accessor functions.

Register _childdetached methods with drivers that attach children.
Wait to set child references to NULL there, instead of doing that
in the detach method.

Replace many uses of USB_DECLARE_DRIVER() with CFATTACH_DECL2().
 1.38  11-Dec-2007  jmcneill Register with pmf
 1.37  01-Dec-2007  jmcneill branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme
 1.36  03-Oct-2007  veego branches: 1.36.4;
Add support to ignore hid attachments for some devices, right now MGE and
APC UPS devices.
No objections on tech-kern at the end of June 2007
Patch is from PR kern/31884
 1.35  15-Mar-2007  drochner branches: 1.35.8; 1.35.10; 1.35.12;
kill the private submatch function, use the generic one
 1.34  13-Mar-2007  drochner branches: 1.34.2;
Introduce different autoconf interface attributes for USB drivers
matching (and handling) a whole device and those which match an
interface only. This will allow to enforce some rules, eg that
the former don't use interface information for matching or that the
latter don't modify global device state.
The previous way left too much freedom do the drivers which led to
inconsistencies and abuse.
For now, I've not changed locators and submatch rules, this will
happen later.
There should not be any change in behaviour, except in the case of
some drivers which did behave inconsistently:
if_atu, if_axe, uep: matched the configured device in the interface
stage, but did configuration again. I've converted them to match
in the device stage.
ustir, utoppy: matched in the interface stage, but only against
vendor/device information, and used any configuration/interface
without checking. Changed to match in device stage, and added
some simple code to configure and use the first interface.
If you have one of those devices, please test!
 1.33  22-Jan-2007  ghen branches: 1.33.2; 1.33.6; 1.33.8; 1.33.10;
Add ID's for the Graphire3 6x8 (from PR 35111) and Graphire4 4x5 (tested by
myself).
 1.32  12-Jun-2006  christos branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.
 1.31  23-Nov-2005  augustss branches: 1.31.4; 1.31.8; 1.31.14;
Normally a ugen device only attaches if no other driver wants the device.
Add the ability to force ugen to attach with very high priority if "flags 1"
is specified. This can be used with the vendor and product locators to
force ugen to be used for certain devices.
Similarly, uhid only attaches if no other HID driver (ums or ukbd) wants it.
Again, "flags 1" will force uhid to attach anyway.
 1.30  20-Oct-2005  itohy branches: 1.30.4;
If an unknown endpoint is found, ignore it, rather than abort attach.
This change allows to use HID-like devices with additional functions.
 1.29  26-Aug-2005  drochner branches: 1.29.2;
s/locdesc_t/int/g
 1.28  25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.27  19-Jun-2005  augustss branches: 1.27.2;
Add a fix to turn on the Hosiden ParaParaParadide controller. From
Sergey Svishchev in kern/30554.
 1.26  11-May-2005  augustss Don't keep the devinfo string on the stack, instead use malloc/free.
This should cure some rare stack overflows.
 1.25  08-May-2005  skrll Add support for optional interrupt output pipes as described in the
HID specicification version 1.11.

Reviewed by Lennart. Thanks.
 1.24  27-Feb-2005  perry branches: 1.24.2;
nuke trailing whitespace
 1.23  07-Feb-2005  augustss Never deliver HID data to subdrivers if the length is wrong.
 1.22  13-Sep-2004  drochner branches: 1.22.4; 1.22.6;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.21  23-Apr-2004  itojun use bounded string ops (snprintf, strl*)
 1.20  04-Jan-2004  augustss Cosmetic changes.
 1.19  04-Jan-2004  jdolecek make uhid_graphire*_report_descr[] const
 1.18  04-Jan-2004  dsainty Correct buffer selection in uhidev_set_report for non-zero report IDs (rare!)

Spotted by Dave Huang, noted in tech-kern.
 1.17  04-Jan-2004  augustss Support Graphire 4x5. From Dave Huang in kern/23965.
 1.16  25-Oct-2003  christos Fix uninitialized variable warnings.
 1.15  14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.14  11-Mar-2003  augustss branches: 1.14.2;
Update URLs for the HID spec.

(Committed at 36000 feet above the Atlantic on board LH418 using
a broadband satellite connection.)
 1.13  02-Jan-2003  dsainty Knock off some XXX'd code: Use malloc() instead of a fixed length buffer
on the stack.
 1.12  01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.11  08-Nov-2002  kristerw Removed unused global variable "int repproto".
 1.10  09-Oct-2002  fair correct LP64 bug in RND code and close PR 18592
 1.9  08-Oct-2002  dan Add support for uhidev children (eg, ums, ukbd) as rnd entropy
sources.

Multifunction devices, such as keyboards with built-in mice or
scrollwheels on different interfaces and/or repid's are each handled
as a separate entropy source.
 1.8  27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.7  23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.6  11-Jul-2002  augustss Get rid of trailing white space.
 1.5  27-Feb-2002  augustss branches: 1.5.8;
Avoid a race condition spotted by UCHIYAMA Yasushi <uch@vnop.net>.
 1.4  27-Jan-2002  augustss Don't dereference NULL pointer when no device attaches.
 1.3  29-Dec-2001  augustss branches: 1.3.2; 1.3.4;
Make the driver a little less talkative on errors.
 1.2  29-Dec-2001  augustss Be more paranoid about input sizes.
 1.1  28-Dec-2001  augustss Introduce an extra driver level for HID devices, uhidev. This uhidev driver
attaches to the hub, and HID drivers (ums, ukbd, and uhid) attach to
uhidev. The reason for this change is that some HID devices report multiple
components (like a keyboard and a mouse) using the same interface, but with
different report identifiers. The report identifier can be specified with
a locator for the HID drivers.
Furthermore, change the ukbd driver to handle other formats than the boot
protocol.
 1.3.4.6  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.4  16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.3  11-Feb-2002  jdolecek Sync w/ -current.
 1.3.4.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1  29-Dec-2001  thorpej file uhidev.c was added on branch kqueue on 2002-01-10 19:58:58 +0000
 1.3.2.7  03-Jan-2003  thorpej Sync with HEAD.
 1.3.2.6  11-Nov-2002  nathanw Catch up to -current
 1.3.2.5  18-Oct-2002  nathanw Catch up to -current.
 1.3.2.4  01-Aug-2002  nathanw Catch up to -current.
 1.3.2.3  28-Feb-2002  nathanw Catch up to -current.
 1.3.2.2  08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1  29-Dec-2001  nathanw file uhidev.c was added on branch nathanw_sa on 2002-01-08 00:32:10 +0000
 1.5.8.1  15-Jul-2002  gehenna catch up with -current.
 1.14.2.7  11-Dec-2005  christos Sync with head.
 1.14.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4  09-Feb-2005  skrll Sync with HEAD.
 1.14.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1  03-Aug-2004  skrll Sync with HEAD
 1.22.6.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.6.1  12-Feb-2005  yamt sync with head.
 1.22.4.1  29-Apr-2005  kent sync with -current
 1.24.2.1  23-Jan-2007  tron Pull up following revision(s) (requested by ghen in ticket #1654):
sys/dev/usb/usbdevs: revision 1.450
sys/dev/usb/uhidev.c: revision 1.33
sys/dev/usb/ugraphire_rdesc.h: revision 1.5
Add ID's for the Graphire3 6x8 (from PR 35111) and Graphire4 4x5 (tested by
myself).
 1.27.2.7  27-Feb-2008  yamt sync with head.
 1.27.2.6  21-Jan-2008  yamt sync with head
 1.27.2.5  07-Dec-2007  yamt sync with head
 1.27.2.4  27-Oct-2007  yamt sync with head.
 1.27.2.3  03-Sep-2007  yamt sync with head.
 1.27.2.2  26-Feb-2007  yamt sync with head.
 1.27.2.1  21-Jun-2006  yamt sync with head.
 1.29.2.1  26-Oct-2005  yamt sync with head
 1.30.4.1  29-Nov-2005  yamt sync with head.
 1.31.14.1  19-Jun-2006  chap Sync with head.
 1.31.8.1  26-Jun-2006  yamt sync with head.
 1.31.4.1  09-Sep-2006  rpaulo sync with head
 1.32.10.1  23-Jan-2007  tron Pull up following revision(s) (requested by ghen in ticket #384):
sys/dev/usb/usbdevs: revision 1.450
sys/dev/usb/uhidev.c: revision 1.33
sys/dev/usb/ugraphire_rdesc.h: revision 1.5
Add ID's for the Graphire3 6x8 (from PR 35111) and Graphire4 4x5 (tested by
myself).
 1.32.6.1  01-Feb-2007  ad Sync with head.
 1.33.10.3  21-Jun-2007  itohy Pullup 1.35: use generic submatch function
 1.33.10.2  18-Jun-2007  itohy Pullup 1.34 (attach driver per interface) with #ifdef USB_USE_IFATTACH.
 1.33.10.1  22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.33.8.1  11-Jul-2007  mjf Sync with head.
 1.33.6.3  09-Oct-2007  ad Sync with head.
 1.33.6.2  10-Apr-2007  ad Sync with head.
 1.33.6.1  13-Mar-2007  ad Sync with head.
 1.33.2.1  24-Mar-2007  yamt sync with head.
 1.34.2.1  18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.35.12.1  06-Oct-2007  yamt sync with head.
 1.35.10.3  23-Mar-2008  matt sync with HEAD
 1.35.10.2  09-Jan-2008  matt sync with HEAD
 1.35.10.1  06-Nov-2007  matt sync with HEAD
 1.35.8.2  03-Dec-2007  joerg Sync with HEAD.
 1.35.8.1  04-Oct-2007  joerg Sync with HEAD.
 1.36.4.3  18-Feb-2008  mjf Sync with HEAD.
 1.36.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.36.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.37.6.1  13-Dec-2007  bouyer Sync with HEAD
 1.37.4.1  11-Dec-2007  yamt sync with head.
 1.37.2.1  26-Dec-2007  ad Sync with head.
 1.39.10.3  11-Mar-2010  yamt sync with head
 1.39.10.2  04-May-2009  yamt sync with head.
 1.39.10.1  16-May-2008  yamt sync with head.
 1.39.8.2  04-Jun-2008  yamt sync with head
 1.39.8.1  18-May-2008  yamt sync with head.
 1.39.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.40.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.42.16.1  21-Apr-2010  matt sync to netbsd-5
 1.42.8.2  09-Jan-2010  snj Pull up following revision(s) (requested by jakllsch in ticket #1219):
sys/dev/usb/uhidev.c: revision 1.46
The Dell DRAC5 gives us a zero-length report immediately following
a normal report. Thus, ignore zero-length reports. Move some related
report size insanity checking into the UHIDEV_DEBUG case.
Should fix PR/39911.
 1.42.8.1  27-Nov-2009  sborrill Pull up the following revisions(s) (requested by rafal in ticket #1162):
sys/dev/usb/uhidev.c: revision 1.44
sys/dev/usb/ums.c: revision 1.75
sys/dev/usb/usbdevs: revision 1.536

Fix kern/41737. Add quirks to make MS Wireless Laser Mouse 6000 work.
 1.47.4.1  05-Mar-2011  rmind sync with head
 1.47.2.1  06-Nov-2010  uebayasi Sync with HEAD.
 1.48.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.48.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.52.6.3  25-Feb-2012  mrg copyright maintenence.
 1.52.6.2  23-Feb-2012  mrg - remove redundant sc_refcnt member
- protect sc_state with a mutex
 1.52.6.1  18-Feb-2012  mrg merge to -current.
 1.52.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.52.2.2  30-Oct-2012  yamt sync with head
 1.52.2.1  17-Apr-2012  yamt sync with head
 1.56.4.1  18-May-2014  rmind sync with head
 1.56.2.2  03-Dec-2017  jdolecek update from HEAD
 1.56.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.2.2  10-Aug-2014  tls Rebase.
 1.59.2.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.61.4.15  28-Aug-2017  skrll Sync with HEAD
 1.61.4.14  05-Dec-2016  skrll Sync with HEAD
 1.61.4.13  09-Jul-2016  skrll Sync with HEAD
 1.61.4.12  29-May-2016  skrll Sync with HEAD
 1.61.4.11  28-Dec-2015  skrll Use IPL_SOFTUSB instead of IPL_USB appropriately. Transfer completions
are executed as a softint and so this is the priority level required.
 1.61.4.10  06-Oct-2015  skrll Move from usbd_{alloc,free}_xfer and usbd_{alloc,free}_buffer to
usbd_{create,destroy}_xfer. The API change will allow future changes
to HCDs to simplify the transfer resource allocation and activation.

Several devices tested including ucom, umass, smsc, uvideo, and uaudio.
 1.61.4.9  29-Sep-2015  skrll sizeof KNF
 1.61.4.8  06-Jun-2015  skrll Sync with HEAD
 1.61.4.7  06-Apr-2015  skrll Sync with HEAD
 1.61.4.6  21-Mar-2015  skrll Add prefixes to attach_arg structure member names. No functional change.
 1.61.4.5  19-Mar-2015  skrll Do the same as OpenBSD and get rid of the *_handle typedefs and use
plain structures insteads
 1.61.4.4  05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.61.4.3  03-Dec-2014  skrll Replace malloc(9) with kmem(9)
 1.61.4.2  01-Dec-2014  skrll Remove the lbl argument from usbd_{bulk,intr}_transfer.
 1.61.4.1  30-Nov-2014  skrll Use C99 types. u_int{8,16,32,64}_t to uint{8,16,32,64}_t.

No functional change.
 1.61.2.4  13-Oct-2017  snj Pull up following revision(s) (requested by jakllsch in ticket #1503):
sys/dev/usb/uhidev.c: revision 1.71
sys/dev/usb/ukbd.c: revision 1.137-1.138
Fix memory leak in report parsing error paths.
--
Support more varieties of USB keyboard reports.
The previous code asssumed reports would closely match the Bootstrap
Keyboard Protocol. This is no longer always the case, particularly
with higher-end keyboards.
--
Always try to set USB HID devices into Report Protocol. (Unless the
device is known to be quirky.)
Some of the most-widely-compatible methods of implementing USB Keyboard
NKRO depend on this Request to function as designed.
Issuing this Request is recommended by the HID 1.11 spec (7.2.6):
... "the host should not make any assumptions about the device's state
and should set the desired protocol whenever initializing a device."
 1.61.2.3  05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.61.2.2  21-Mar-2015  snj branches: 1.61.2.2.4;
Pull up following revision(s) (requested by mrg in ticket #626):
sys/dev/usb/TODO.usbmp: revision 1.9
sys/dev/usb/uatp.c: revision 1.11
sys/dev/usb/ucycom.c: revision 1.42
sys/dev/usb/uhid.c: revision 1.93, 1.94
sys/dev/usb/uhidev.c: revision 1.63
sys/dev/usb/uhidev.h: revision 1.17
sys/dev/usb/ukbd.c: revision 1.130
sys/dev/usb/uyurex.c: revision 1.10
properly protect uhid's sc_q member with sc_lock. should fix PR#49728.
while here, remove D_MPSAFE from uhid* and all uhid users, as it really
needs all the callers to be safe and they're not.
--
don't take the device lock when stopping the uhidev. that calls
to abort and close pipes, both of which may take an adaptive lock.
fixes a LOCKDEBUG abort see on one particular machine.
 1.61.2.1  11-Feb-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #502):
sys/dev/usb/uhidev.c: revision 1.62
sys/dev/usb/uhidev.h: revision 1.16
sys/dev/usb/x1input_rdesc.h: revision 1.1
Add Xbox One controller support. Report
descriptor from https://github.com/lloeki/xbox_one_controller
 1.61.2.2.4.2  26-Jan-2017  skrll Sync with HEAD/nhusb
 1.61.2.2.4.1  06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.68.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.70.2.1  04-Sep-2017  snj Pull up following revision(s) (requested by jakllsch in ticket #263):
sys/dev/usb/uhidev.c: revision 1.71
sys/dev/usb/ukbd.c: revision 1.137-1.138
Fix memory leak in report parsing error paths.
--
Support more varieties of USB keyboard reports.
The previous code asssumed reports would closely match the Bootstrap
Keyboard Protocol. This is no longer always the case, particularly
with higher-end keyboards.
--
Always try to set USB HID devices into Report Protocol. (Unless the
device is known to be quirky.)
Some of the most-widely-compatible methods of implementing USB Keyboard
NKRO depend on this Request to function as designed.
Issuing this Request is recommended by the HID 1.11 spec (7.2.6):
... "the host should not make any assumptions about the device's state
and should set the desired protocol whenever initializing a device."
 1.73.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.73.4.1  10-Jun-2019  christos Sync with HEAD
 1.73.2.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.75.2.3  05-Nov-2022  martin Pull up following revision(s) (requested by jmcneill in ticket #1550):

sys/dev/usb/uhidev.c: revision 1.94

Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR 57031
 1.75.2.2  16-Feb-2022  martin Pull up following revision(s) (requested by jakllsch in ticket #1428):

sys/dev/usb/uhidev.c: revision 1.82

Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.
 1.75.2.1  04-Feb-2021  martin Pull up following revision(s) (requested by riastradh in ticket #1196):

sys/dev/usb/uhid.c: revision 1.115
sys/dev/usb/uhidev.h: revision 1.21
sys/dev/usb/uhidev.c: revision 1.79
(all via patch)

usb: Overhaul uhid(4) and uhidev(4) locking.

- uhidev API rules:
1. Call uhidev_open when you want exclusive use of a report id.
After it succeeds, you will get interrupts.
2. Call uhidev_close when done with exclusive use of a report id.
After it returns, you will no longer get interrupts.
=> uhidev_open/close do not nest.
3. uhidev_write no longer requires the caller to have exclusive
access -- if there is a write in progress, it will block
interruptibly until done. This way drivers for individual
report ids need not work separately to coordinate their writes.
4. You must uhidev_stop to abort any pending writes on the same
report id. (uhidev_stop no longer does anything else -- to
ensure no more interrupts, just use uhidev_close.)
- Fix uhidev_open/close locking -- uhidev now has an interruptible
config lock held only on first open and last close by any report id
in the device, to serialize the transition between zero and nonzero
numbers of references which requires opening/closing pipes and
allocating/freeing buffers.
- Make /dev/uhidN selnotify(POLLHUP) when the device is yanked.
- Factor uhid device lookup and reference counting and dying
detection and so on into uhid_enter/exit.
- Nix struct uhid_softc::sc_access_lock. This served no purpose but
to confuse me when trying to understand the logic of this beast
(and to ensure uhidev_write exclusion, but it was uninterruptible,
which is wrong for something that implements userland operations,
and didn't actually work because uhidev_write did nothing to
coordinate between different report ids).
- Fix locking in select/poll.
- Use atomics to manage UHID_IMMED to keep it simple. (sc_lock would
be fine too but it makes the code more verbose.)
- Omit needless UHID_ASLP -- cv_broadcast already has this
micro-optimization.

With these changes, my Pinebook survives

for i in `jot 100`; do
echo '###' $i
for j in `jot 16`; do
usbhidctl -rf /dev/uhid$j >/dev/null &
done
wait
done

while plugging and unplugging uhid(4) devices (U2F keys), and the U2F
keys still work as U2F keys.

ok nick, mrg

XXX pullup-9
XXX pullup-8?

Note on ABI and pullups: This changes the layout of struct
uhidev_softc, but with the sole exception of ucycom(4) -- which at
the moment is completely broken and unusable -- the only members that
USB HID drivers use are sc_udev and sc_iface, which haven't changed.
The layout of struct uhidev, which is allocated by each USB HID
driver in its own softc structure, is unchanged.
 1.78.4.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.79.2.2  22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.79.2.1  22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.80.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed