Home | History | Annotate | Download | only in usb
History log of /src/sys/dev/usb/uhid.c
RevisionDateAuthorComments
 1.129  04-Feb-2024  mrg update my email address.
 1.128  31-Jul-2023  christos Don't call versioned stuff "old". Follow the naming convention for versioning
and name them after the last version of the OS they appeared on.
 1.127  28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.126  24-Sep-2022  riastradh uhid(4): Don't wake waiters on changing sc_open.

This is only a diagnostic measure, not part of semantics.

Can probably safely eliminate the diagnostic measure at this point
now.
 1.125  31-Mar-2022  christos simplify.
 1.124  29-Mar-2022  riastradh uhid(4): Make sure error is initialized in uhidkqfilter.
 1.123  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.122  28-Mar-2022  riastradh uhidev(9): Get the device and interface through attach args.

This way uhidev drivers don't need access to uhidev_softc itself for
it.
 1.121  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.120  28-Mar-2022  riastradh uhid(4): Use d_cfdriver/devtounit/cancel to avoid open/detach races.

- Split uhidclose into separate uhidcancel and uhidclose parts.
uhidcancel interrupts pending I/O operations (open, read, write,
ioctl, &c.); uhidclose doesn't run until all I/O operations are
done.

- Handle case where, owing to revoke(2), uhidcancel/uhidclose run
concurrently with a uhidopen that hasn't yet noticed that there
isn't actually a device.

- Handle case where, owing to revoke(2), uhidread might be cancelled
by mere revoke, not by detach, so it has to wake up when the device
is closing, not (just) when dying (but dying will lead to closing
so no need to check for dying).

- Omit needless reference-counting goo. vdevgone takes care of this
for us by cancelling all I/O operations with uhidcancel, waiting
for I/O operations to drain, closing the device, and waiting until
it is closed if that is already happening concurrently.

- Name the closed/changing/open states rather than using 0/1/2.

- Omit needless sc_dying.
 1.119  26-Sep-2021  thorpej Use seltrue_filtops rather than rolling our own with filt_seltrue.
 1.118  26-Sep-2021  thorpej Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89
 1.117  18-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.116  30-Nov-2020  riastradh uhid(4): Omit needless softint indirection.

USB xfer callbacks already run in softint context at IPL_SOFTSERIAL,
and I see no reason why the call to psignal must happen instead at
the lower priority of IPL_SOFTCLOCK, so let's avoid using up the
scarce resource of softints for something that doesn't need 'em.

While here, use atomic_store_relaxed to update sc->sc_async and
atomic_load_relaxed to optimisitcally test it without acquiring
proc_lock.
 1.115  29-Nov-2020  riastradh 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.114  23-May-2020  ad branches: 1.114.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.113  04-Mar-2020  christos Add ioctls to get and set raw mode.
 1.112  02-Mar-2020  christos Add fido constants, and turn hid "raw" mode for fido devices.
 1.111  01-Jan-2020  maxv Fix buffer overflows. Also add missing mutex_exit.
 1.110  01-Dec-2019  maxv minor adjustments, to avoid warnings on debug builds
 1.109  01-Dec-2019  maxv localify
 1.108  05-May-2019  mrg branches: 1.108.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h
 1.107  23-Mar-2019  mrg use sc_lock not sc_access_lock to check UHIDEV_OPEN.

fixes a soft hang when usbhidaction has a uhid open and bzflag
tries to open it as well.

XXX: pullup-7, pullup-8 (where i saw this originally.)
 1.106  01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.105  07-Feb-2019  skrll Remove (mostly useless) usb_detach_{broadcast,wait} and replace with
cv_{broadcast,timedwait}

Really should loop on conditon.
 1.104  29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.103  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.102  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.101  10-Dec-2017  bouyer branches: 1.101.2; 1.101.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.100  25-Oct-2017  maya Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};
 1.99  11-Mar-2017  maya branches: 1.99.6;
memcpy of overlapping arguments is UB. use memmove.
CID 1299071

ok riastradh
 1.98  07-Jul-2016  msaitoh branches: 1.98.2; 1.98.4;
KNF. Remove extra spaces. No functional change.
 1.97  09-May-2016  mlelstv kmem_alloc doesn't support allocating 0 bytes.
 1.96  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.95  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.94  20-Mar-2015  mrg 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.93  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.92  25-Jul-2014  dholland branches: 1.92.2; 1.92.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.91  02-Jul-2014  christos remember to call deregister.
 1.90  16-Mar-2014  dholland branches: 1.90.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.89  05-Jan-2013  christos branches: 1.89.2;
- need opt_usb.h if depending on USB_DEBUG
- remove trailing whitespace
- add missing KERNEL_RCSID
 1.88  10-Jun-2012  mrg branches: 1.88.2;
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.87  14-May-2012  erh Implement USB_GET_DEVICE_DESC for uhid devices so there's a way to get the
product and vendor information.
 1.86  06-Mar-2012  mrg pull down from usbmp branch:

- rename usb_detach_{wake,waitup}() to usb_detach_{wake,waitup}old()
- use some c99 struct .initialisers
 1.85  24-Feb-2012  mrg remove any remnants of freebsd/openbsd code.
 1.84  03-Nov-2010  dyoung branches: 1.84.8; 1.84.12;
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.83  06-Dec-2009  dyoung branches: 1.83.2; 1.83.4;
Simplify device-activation hooks.
 1.82  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.81  28-Apr-2008  martin branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses
 1.80  24-Apr-2008  ad branches: 1.80.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.79  01-Mar-2008  rmind branches: 1.79.2;
Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
 1.78  12-Feb-2008  drochner branches: 1.78.2; 1.78.6;
add NULL power handler, so that this device doesn't block suspension
 1.77  05-Dec-2007  pooka Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
 1.76  04-Mar-2007  christos branches: 1.76.14; 1.76.16; 1.76.22; 1.76.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.75  26-Feb-2007  drochner branches: 1.75.4;
The manpage promises not to touch the device on USB_GET_DEVICEINFO.
Make it so.
 1.74  09-Feb-2007  ad branches: 1.74.2;
Merge newlock2 to head.
 1.73  03-Dec-2006  pavel Restore compatibility of USB_DEVICEINFO ioctl and reads from /dev/usb with
NetBSD 3.x. Patch from Stephan Thesing provided in
http://mail-index.netbsd.org/current-users/2006/03/21/0002.html, with some
modifications by me.
See also
http://mail-index.netbsd.org/current-users/2006/08/29/0017.html

The code is conditionally compiled depending on COMPAT_30.

Also fix a leak of struct usb_event in usbread() introduced while converting
on-stack variables to dynamic allocation.

Reviewed by martin@.
 1.72  16-Nov-2006  christos branches: 1.72.2;
__unused removal on arguments; approved by core.
 1.71  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.70  03-Sep-2006  christos branches: 1.70.2; 1.70.4;
- add missing initializer
- remove stray semicolon that prevented an ioctl from working.
 1.69  28-Mar-2006  thorpej Use device_unit().
 1.68  11-Dec-2005  christos branches: 1.68.4; 1.68.6; 1.68.8; 1.68.10; 1.68.12;
merge ktrace-lwp.
 1.67  28-Nov-2005  augustss Add a new match level, UMATCH_HIGHEST.
 1.66  23-Nov-2005  tron Make this compile if UHID_DEBUG is not defined.
 1.65  23-Nov-2005  augustss 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.64  21-Jun-2005  ws branches: 1.64.2; 1.64.8;
PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
 1.63  02-Mar-2005  mycroft Copyright maintenance.
 1.62  23-Jun-2004  mycroft branches: 1.62.4; 1.62.6;
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.
 1.61  08-May-2004  jdolecek add support for USB_GET_DEVICEINFO and USB_GET_STRING_DESC ioctls,
with same meaning as for ugen(4)
 1.60  21-Sep-2003  jdolecek branches: 1.60.2;
cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
the owner of descriptor, according to appropriate sematics
of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
 1.59  29-Jun-2003  fvdl branches: 1.59.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.58  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.57  11-Mar-2003  augustss Update URLs for the HID spec.

(Committed at 36000 feet above the Atlantic on board LH418 using
a broadband satellite connection.)
 1.56  26-Nov-2002  christos si_ -> sel_
 1.55  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.54  23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.53  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.52  11-Jul-2002  augustss Get rid of trailing white space.
 1.51  17-Mar-2002  augustss branches: 1.51.4;
Whitespace fixes.
 1.50  20-Feb-2002  christos Prefix structure members to protect them against clashes with eg. c++ keywords.
Suggested by Alfred Perlstein, from FreeBSD, ok'd by augustss
 1.49  02-Jan-2002  augustss Some more usb_proc_ptr changes.
Also some minor stylistic changes.
 1.48  31-Dec-2001  augustss Make a typedef for struct proc to make portingeasier.
 1.47  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.46  13-Nov-2001  lukem add RCSIDs
 1.45  26-Oct-2001  augustss s/usbd_alloc_report_desc/usbd_read_report_desc/
 1.44  15-Sep-2001  yamt branches: 1.44.2;
correct debug messages.
 1.43  15-Aug-2001  augustss branches: 1.43.2;
If there was a vendor+product locator match return a higher match value.
Rationale, if you have a device (e.g., a mouse) with a more specific
driver but want to recognize it with the more generic driver you can
do that by supplying vendor and product locators for the generic one.
 1.42  29-Dec-2000  augustss branches: 1.42.2; 1.42.4;
Supply our own report descriptor (from Nick Hibma) for the Wacom Graphire.
The descriptor it reports is broken.
XXX Not tested, because I don't have the device.
 1.41  29-Dec-2000  augustss Update many URLs.
 1.40  10-Oct-2000  augustss Don't free unallocated pointer in detach (can happen if detach happens
before attach has finished).
 1.39  01-Jun-2000  augustss Bring the coding style into the 80s, i.e., get rid of __P and use
ANSI prototypes and declarations.
 1.38  27-Apr-2000  augustss branches: 1.38.2;
Change my email address.
 1.37  14-Apr-2000  augustss Support for SIGIO.
 1.36  27-Mar-2000  augustss Change (almost) all static to Static. The symbol `Static' can then be defined
to `' or `static' depending on if you want to debug or not.
 1.35  19-Mar-2000  augustss Add ioctl USB_SET_REPORT for uhid. This will allow manipulating the
feature items.
 1.34  29-Feb-2000  augustss Distinguish between device and interface classes.
(I finally found a document that said that they were different.)
 1.33  22-Feb-2000  augustss Better debug info.
 1.32  02-Feb-2000  augustss Generate usb events on attach and detach.
 1.31  19-Jan-2000  augustss Add an argument to usbd_open_pipe_intr() to specify the polling interval
for an interrupt pipe in case we don't what what the descriptor suggests.
 1.30  16-Jan-2000  augustss Avoid freeing already free data when attach fails.
 1.29  18-Dec-1999  augustss Make these files compile on 64 bit archs.
 1.28  18-Nov-1999  augustss Cosmetic changes and some small improvements. From FreeBSD and Nick Hibma.
 1.27  12-Nov-1999  augustss A number of stylistic changes to increase readability (many suggested
by Nick Hibma):
use NULL not 0
declare all local definitions static
rename s/usbd_request/usbd_xfer/ s/reqh/xfer/
rename s/r/err/
use implicit test for no err
KNF
 1.26  13-Oct-1999  augustss branches: 1.26.2; 1.26.4;
Merge in a large batch of changes from Nick Hibma <hibma@skylink.it> so
the USB stack compiles on FreeBSD again.
 1.25  12-Oct-1999  augustss Add an event mechanism so that a userland process can watch devices come
and go.
 1.24  05-Sep-1999  augustss branches: 1.24.2;
Change the way the `struct device' base part of all driver softc are
declared and accessed to make it more portable. Idea from Nick Hibma, FreeBSD.
No functional changes.
 1.23  04-Sep-1999  augustss Change the way the direction is extracted from the endpoint descriptor.
No functional changes to the drivers. From Nick Hibma, FreeBSD.
 1.22  28-Aug-1999  augustss Change some 'struct device' to 'bdevice'. From FreeBSD.
 1.21  23-Aug-1999  augustss Make sure to mark the device as dying already in the (de)activate routine.
This avoids access to it before the detach routine has blown it away.
 1.20  17-Aug-1999  augustss Make some small changes to make it compile on OpenBSD.
 1.19  14-Aug-1999  augustss Some changes from FreeBSD (no functional differences).
 1.18  30-Jun-1999  augustss Totally redo the way device detach is done. It now uses a kernel event
thread and the config detach method.
Squish a number of space leaks on detach.
 1.17  09-May-1999  augustss Handle exclusive open bit differently.
 1.16  21-Apr-1999  augustss Use the right buffer in immediate mode.
 1.15  10-Jan-1999  augustss branches: 1.15.4;
Update/add URLs to relevant USB specs.
 1.14  08-Jan-1999  augustss Various little fixes from the FreeBSD version.
 1.13  07-Jan-1999  augustss Fix some FreeBSD compiler warnings.
 1.12  26-Dec-1998  augustss Merge changes to make the USB stack work with FreeBSD. The original
diffs from Nick Hibma <n_hibma@freebsd.org>, but with substantial
changes from me.
XXX Not tested on FreeBSD yet.
 1.11  10-Dec-1998  augustss Take care of some lines > 80 chars.
 1.10  09-Dec-1998  augustss Improvement to the ugen driver.
Better error checking.
Some code rearrengment.
 1.9  03-Dec-1998  augustss Handle the case where the device does not support GET_PEPORT better.
 1.8  02-Dec-1998  augustss Even shorter printfs at attach.
 1.7  02-Dec-1998  augustss Avoid wrapping lines in attach printfs.
 1.6  25-Nov-1998  augustss Make the copyright header conform to the NetBSD template.
 1.5  21-Nov-1998  augustss Fix some typos.
 1.4  20-Aug-1998  veego Add some braces to stop the new egcs warnings.
 1.3  01-Aug-1998  augustss Abort interrupt pipe on disconnect.
 1.2  13-Jul-1998  augustss Add some useful HID ioctl()s.
 1.1  12-Jul-1998  augustss Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers
 1.15.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.15.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.24.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.26.4.1  15-Nov-1999  fvdl Sync with -current
 1.26.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.26.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.38.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.42.4.9  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.42.4.8  02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.42.4.7  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.42.4.6  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.42.4.5  16-Mar-2002  jdolecek Catch up with -current.
 1.42.4.4  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.4.3  08-Sep-2001  thorpej Use the seltrue filter as appropriate (or, rather, as the "poll"
entry points of these drivers indicate).
 1.42.4.2  08-Sep-2001  thorpej Add kqueue support.
 1.42.4.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.42.2.12  11-Dec-2002  thorpej Sync with HEAD.
 1.42.2.11  11-Nov-2002  nathanw Catch up to -current
 1.42.2.10  18-Oct-2002  nathanw Catch up to -current.
 1.42.2.9  17-Sep-2002  nathanw Catch up to -current.
 1.42.2.8  01-Aug-2002  nathanw Catch up to -current.
 1.42.2.7  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.42.2.6  28-Feb-2002  nathanw Catch up to -current.
 1.42.2.5  11-Jan-2002  nathanw More catchup.
 1.42.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.42.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.42.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.42.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.43.2.3  01-Oct-2001  fvdl Catch up with -current.
 1.43.2.2  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.43.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.44.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.51.4.2  15-Jul-2002  gehenna catch up with -current.
 1.51.4.1  16-May-2002  gehenna Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
 1.59.2.7  11-Dec-2005  christos Sync with head.
 1.59.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.59.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.59.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.59.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.59.2.2  03-Aug-2004  skrll Sync with HEAD
 1.59.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.60.2.2  02-Jul-2004  he Pull up revision 1.62 (requested by mycroft in ticket #572):
Several fixes mostly related to USB:
o Add a general workaround for devices returning incorrect
lengths in string descriptors, so that we don't need
separate quirk entries for these.
 1.60.2.1  11-May-2004  tron Pull up revision 1.61 (requested by jdolecek in ticket #289):
add support for USB_GET_DEVICEINFO and USB_GET_STRING_DESC ioctls,
with same meaning as for ugen(4)
 1.62.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.62.4.1  29-Apr-2005  kent sync with -current
 1.64.8.1  29-Nov-2005  yamt sync with head.
 1.64.2.7  17-Mar-2008  yamt sync with head.
 1.64.2.6  27-Feb-2008  yamt sync with head.
 1.64.2.5  07-Dec-2007  yamt sync with head
 1.64.2.4  03-Sep-2007  yamt sync with head.
 1.64.2.3  26-Feb-2007  yamt sync with head.
 1.64.2.2  30-Dec-2006  yamt sync with head.
 1.64.2.1  21-Jun-2006  yamt sync with head.
 1.68.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.68.10.1  19-Apr-2006  elad sync with head.
 1.68.8.2  14-Sep-2006  yamt sync with head.
 1.68.8.1  01-Apr-2006  yamt sync with head.
 1.68.6.1  22-Apr-2006  simonb Sync with head.
 1.68.4.1  09-Sep-2006  rpaulo sync with head
 1.70.4.2  10-Dec-2006  yamt sync with head.
 1.70.4.1  22-Oct-2006  yamt sync with head
 1.70.2.3  19-Jan-2007  ad Acquire proclist_mutex before sending signals.
 1.70.2.2  12-Jan-2007  ad Sync with head.
 1.70.2.1  18-Nov-2006  ad Sync with head.
 1.72.2.1  06-Apr-2007  bouyer Pull up following revision(s) (requested by pavel in ticket #556):
sys/dev/usb/ugen.c: revision 1.89
sys/dev/usb/usb.c: revisions 1.92, 1.93
sys/dev/usb/usb_subr.c: revision 1.139, 1.140
sys/dev/usb/usb.h: revision 1.75
sys/dev/usb/usbdi.h: revisions 1.71, 1.72
sys/dev/usb/usbdi.c: revision 1.115, 1.116
sys/dev/usb/uhid.c: revision 1.73
Restore compatibility of USB_DEVICEINFO ioctl and reads from /dev/usb with
NetBSD 3.x. The code is conditionally compiled depending on COMPAT_30.
 1.74.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.74.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.75.4.2  17-Jun-2007  itohy Pullup 1.76 in a different way.
 1.75.4.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.76.24.1  08-Dec-2007  ad Sync with head.
 1.76.22.2  18-Feb-2008  mjf Sync with HEAD.
 1.76.22.1  08-Dec-2007  mjf Sync with HEAD.
 1.76.16.2  23-Mar-2008  matt sync with HEAD
 1.76.16.1  09-Jan-2008  matt sync with HEAD
 1.76.14.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.78.6.4  02-Jun-2008  mjf Sync with HEAD.
 1.78.6.3  06-Apr-2008  mjf - after some discussion with agc@ i agreed it would be a good idea to move
device_unregister_* to device_deregister_* to be more like the pmf(9)
functions, especially since a lot of the time the function calls are next
to each other.

- add device_register_name() support for dk(4).
 1.78.6.2  05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.78.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.78.2.1  24-Mar-2008  keiichi sync with head.
 1.79.2.2  04-Jun-2008  yamt sync with head
 1.79.2.1  18-May-2008  yamt sync with head.
 1.80.2.3  11-Mar-2010  yamt sync with head
 1.80.2.2  04-May-2009  yamt sync with head.
 1.80.2.1  16-May-2008  yamt sync with head.
 1.81.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.83.4.1  05-Mar-2011  rmind sync with head
 1.83.2.1  06-Nov-2010  uebayasi Sync with HEAD.
 1.84.12.5  02-Jun-2012  mrg sync to latest -current.
 1.84.12.4  06-Mar-2012  mrg sync to -current
 1.84.12.3  26-Feb-2012  mrg rename usb_detach_waitcv() to usb_detach_wait()
 1.84.12.2  25-Feb-2012  mrg mark D_MPSAFE:
- spl -> mutex
- convert to SMP usb_detach_wait/wakeup()
- add a IPL_NONE access lock, used in most devsw entry points
 1.84.12.1  24-Feb-2012  mrg sync to -current.
 1.84.8.5  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.84.8.4  23-Jan-2013  yamt sync with head
 1.84.8.3  30-Oct-2012  yamt sync with head
 1.84.8.2  23-May-2012  yamt sync with head.
 1.84.8.1  17-Apr-2012  yamt sync with head
 1.88.2.3  03-Dec-2017  jdolecek update from HEAD
 1.88.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.88.2.1  25-Feb-2013  tls resync with head
 1.89.2.1  18-May-2014  rmind sync with head
 1.90.2.1  10-Aug-2014  tls Rebase.
 1.92.4.12  28-Aug-2017  skrll Sync with HEAD
 1.92.4.11  27-Oct-2016  skrll Retire usb_detach_{wait,broadcast} and simply use condvar(9) instead
 1.92.4.10  09-Jul-2016  skrll Sync with HEAD
 1.92.4.9  29-May-2016  skrll Sync with HEAD
 1.92.4.8  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.92.4.7  29-Sep-2015  skrll sizeof KNF
 1.92.4.6  06-Apr-2015  skrll Sync with HEAD
 1.92.4.5  06-Dec-2014  skrll KNF. Remove argument name from function declarations.

No functional change.
 1.92.4.4  05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.92.4.3  03-Dec-2014  skrll Replace malloc(9) with kmem(9)
 1.92.4.2  30-Nov-2014  skrll Whitespace
 1.92.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.92.2.2  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.92.2.1  21-Mar-2015  snj branches: 1.92.2.1.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.92.2.1.4.2  26-Jan-2017  skrll Sync with HEAD/nhusb
 1.92.2.1.4.1  06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.98.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.98.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.99.6.1  02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #1480):

sys/dev/usb/uthum.c: revision 1.18
sys/dev/usb/ucycom.c: revision 1.49
sys/dev/usb/uhid.c: revision 1.111

Fix buffer overflows. sc_{o,f}len are controlled by the USB device. By
crafting the former the device can leak stack data. By crafting the latter
the device can overwrite the stack. The combination of the two means the
device can ROP the kernel and obtain code execution (demonstrated with an
actual exploit over vHCI).

Truncate the lengths to the size of the buffers, and also drop sc_ilen
since it is unused. Patch tested with vHCI+kASan.

-

Fix buffer overflows. Also add missing mutex_exit.

-

Fix buffer overflows: validate the lengths at attach time, given that they
are apparently not supposed to be variable. Drop sc_ilen since it is
unused.
 1.101.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.101.4.1  10-Jun-2019  christos Sync with HEAD
 1.101.2.9  22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.101.2.8  18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.101.2.7  14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.101.2.6  13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.101.2.5  29-Sep-2018  pgoyette In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).
 1.101.2.4  18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.101.2.3  18-Sep-2018  pgoyette Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.

Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
 1.101.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.101.2.1  29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.108.2.3  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.108.2.2  15-Jul-2020  martin Pull up following revision(s) (requested by riastradh in ticket #1010):

sys/dev/usb/uhid.c: revision 1.112
sys/dev/usb/uhid.c: revision 1.113
sys/dev/hid/hid.h: revision 1.4
sys/dev/hid/hid.h: revision 1.5
sys/dev/usb/usbhid.h: revision 1.19

Add fido constants, and turn hid "raw" mode for fido devices.

Add ioctls to get and set raw mode.

Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.108.2.1  02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #595):

sys/dev/usb/uthum.c: revision 1.18
sys/dev/usb/ucycom.c: revision 1.49
sys/dev/usb/uhid.c: revision 1.111

Fix buffer overflows. sc_{o,f}len are controlled by the USB device. By
crafting the former the device can leak stack data. By crafting the latter
the device can overwrite the stack. The combination of the two means the
device can ROP the kernel and obtain code execution (demonstrated with an
actual exploit over vHCI).

Truncate the lengths to the size of the buffers, and also drop sc_ilen
since it is unused. Patch tested with vHCI+kASan.

-

Fix buffer overflows. Also add missing mutex_exit.

-

Fix buffer overflows: validate the lengths at attach time, given that they
are apparently not supposed to be variable. Drop sc_ilen since it is
unused.
 1.114.2.2  03-Jan-2021  thorpej Sync w/ HEAD.
 1.114.2.1  14-Dec-2020  thorpej Sync w/ HEAD.

RSS XML Feed