History log of /netbsd-current/sys/dev/usb/uhidev.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.95 04-Feb-2024 mrg

update my email address.


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base
# 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


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.81 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.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


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.81 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.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.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.81 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.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.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.81 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.81 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.80 24-Apr-2021 thorpej

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?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

branches: 1.75.2;
remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.79 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.


Revision tags: thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.78 14-Mar-2020 christos

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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.78 14-Mar-2020 christos

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


Revision tags: ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.76 06-Dec-2019 maxv

localify


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.75 05-May-2019 mrg

remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.75 05-May-2019 mrg

remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.73 10-Dec-2017 bouyer

branches: 1.73.2;
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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.74 15-Nov-2018 jakllsch

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.73 10-Dec-2017 bouyer

branches: 1.73.2;
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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.73 10-Dec-2017 bouyer

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.


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.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.


Revision tags: nick-nhusb-base-20170825
# 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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.70 01-Jun-2017 chs

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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.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."


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.70 01-Jun-2017 chs

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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.70 01-Jun-2017 chs

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.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

branches: 1.68.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.


Revision tags: nick-nhusb-base-20161204
# 1.69 04-Dec-2016 skrll

Whitespace


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.68 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.64 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base netbsd-7-base tls-maxphys-base
# 1.61 10-Aug-2014 tls

branches: 1.61.2; 1.61.4;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 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@


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.49 29-Jan-2011 tsutsui

kern/44483: Support for WACOM Graphire2 ET-0405A-U graphics tablet.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 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.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base mjf-devfs2-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.40 28-Apr-2008 martin

branches: 1.40.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 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().


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base matt-armv6-base
# 1.38 11-Dec-2007 jmcneill

Register with pmf


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.37 01-Dec-2007 jmcneill

branches: 1.37.2; 1.37.4; 1.37.6;
aprintify, on behalf of xtraeme


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 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!


Revision tags: itohy-usb1-base ad-audiomp-base post-newlock2-merge newlock2-nbase newlock2-base
# 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).


Revision tags: yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base rpaulo-netinet-merge-pcb-base
# 1.32 12-Jun-2006 christos

branches: 1.32.6; 1.32.10;
Don't allocate >1K on the stack.


Revision tags: simonb-timcounters-final yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base yamt-readahead-base3 ktrace-lwp-base
# 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.


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base
# 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.


Revision tags: yamt-vop-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 27-Feb-2005 perry

branches: 1.24.2;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.23 07-Feb-2005 augustss

Never deliver HID data to subdrivers if the length is wrong.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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*)


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.11 08-Nov-2002 kristerw

Removed unused global variable "int repproto".


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 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.


Revision tags: kqueue-base
# 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(!).


Revision tags: gehenna-devsw-base
# 1.6 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 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.