Commit Graph

5609 Commits

Author SHA1 Message Date
nia 984ee03fd6 regen 2021-03-15 07:30:40 +00:00
nia 1fe45e8161 correct usb device id for BELKIN F5D7050E
matches freebsd / openbsd (sources of urtw driver), various online
sources

PR kern/56056
2021-03-15 07:29:26 +00:00
ryo 8b5a03c80a regen 2021-03-09 16:39:18 +00:00
ryo b4aadafec0 Add ASUSTEK AURALED 2021-03-09 16:38:49 +00:00
ryo e939ac6bfc Add CoolerMaster, and AMD SR4 lamplight Control device (Wraith Prism RGB CPU Cooler) 2021-03-09 16:37:23 +00:00
nat 7ed931797f Opps....Remove irrelavent debug code and don't free_m before IFQ_DEQUEUE().
Identified and reported by Patrick Welche and remedy found by Martin Husemann.
2021-03-02 22:21:38 +00:00
gdt 513817ff3f ukbd: GC some 20 year old code (NFC)
Long ago, code was improved to allow detaching keyboards that were the
console, but the old commen and panic() were #if 0'd instead of
removed.
2021-03-02 00:18:22 +00:00
gdt b875ea321e ukbd: Condition probe-time verbosity on USBVERBOSE
Previously, this driver switched on more verbose messages based on
DIAGNOSTIC.  But, the messages weren't about an impossible-to-reach
condition, just extra keys.  Change the condition to USBVERBOSE,
documented as serving this purpose.
2021-03-02 00:01:27 +00:00
mrg a743b48bde note that "enum usbnet_ep un_ed" member is the wrong type, and should
be "uByte un_ed", and fix when we version this next.  noticed by martin@
2021-03-01 22:59:52 +00:00
jakllsch 68918b850b reduce aprint_error(9) abuse 2021-03-01 17:41:00 +00:00
nat 37857f2468 Also free assocated mbufs. 2021-02-26 01:38:44 +00:00
mrg 0f07f15626 fix sparc build: db_expr_t is larger than a pointer. 2021-02-24 01:46:57 +00:00
mrg 850b204abe fix the formating for 'show usbxferlist'. 2021-02-23 08:51:36 +00:00
mrg 110ac605f8 introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0.  idea from rillig@.

all touched ports built, several booted.
2021-02-23 07:13:51 +00:00
mrg 2f7a351b70 fix formatting and db_usb_command_table[] static. idea from rillig@. 2021-02-22 20:45:28 +00:00
mrg 886e97cda5 add ddb commands to inspect usb xfer and xferlist structures. 2021-02-21 23:06:39 +00:00
mrg 605a7c24da replace printf "ERROR<n>" with device_printf() and useful messages. 2021-02-21 23:06:13 +00:00
martin 7676dfd5b6 Add a bunch of USB loader devices for Freescale SoC that should not
attach as HID devices.
2021-02-21 12:36:38 +00:00
mlelstv 3772d427da Expose more descriptor items as device properties. 2021-02-17 06:30:57 +00:00
isaki 0322faf76e Fix my copy-and-paste bug in rev1.160.
This fixes recording sample dropout.
2021-02-15 13:39:18 +00:00
thorpej 844b2803e0 I have a cheap USB optical mouse (CHICONY product 0x0939, also known
as "PixArt USB Optical Mouse") that likes to disconnect after 60 seconds
and then reattach 2 seconds later (ad nauseum) unless it's kept open,
so use the "always open" quirk on that device as well.
2021-02-03 23:26:08 +00:00
thorpej 53bb55a86b Regen for addition of CHICONY optical mouse. 2021-02-03 23:24:07 +00:00
thorpej 984bb647ad Add a CHICONY optical mouse product ID. 2021-02-03 23:23:42 +00:00
yamt d4af37e952 if_urtwn.c: Plug a few leaks
Can be a cause of PR/55968
2021-02-02 10:46:17 +00:00
yamt 081d34a17b if_urtwn: Add a missing newline to an aprint_error_dev message 2021-02-02 00:27:38 +00:00
riastradh dd9425dfa7 urtwn(4): Check for allocation failure in urtwn_tx_beacon.
Candidate fix for PR kern/55968.
2021-02-01 06:59:37 +00:00
nia e94894f235 regen 2021-02-01 04:49:02 +00:00
nia fed6c1129b add another TPLINK RTL8192EU variant
to avoid confusion use TP-Link's names for these variants, matching
FreeBSD
2021-02-01 04:46:33 +00:00
nia bc0af4b276 regen 2021-01-31 18:11:43 +00:00
nia 45262cdc73 urtwn(4): add TPLINK WN821N to the list of USB device ids
reported by kfmut on the unitedbsd forums.
2021-01-31 18:05:38 +00:00
jdolecek 8c601f6c5a fix free_all_endpoints() to not try calling free_pipe() when no endpoints
are allocated; this can happen during config_detach() after attach fails

Reported-by: syzbot+6e8a4c978358ecead03e@syzkaller.appspotmail.com
Reported-by: syzbot+b25ba25b57561144ac6e@syzkaller.appspotmail.com
2021-01-20 22:46:33 +00:00
ryoon 09c03af8ed Add whitespace after comma 2021-01-10 15:50:16 +00:00
ryoon 7d49fb627c Fix a typo in debug message 2021-01-10 13:17:44 +00:00
skrll 4db86d3d06 More converstion from usbd_status to int for function error reporting.
This time it's the turn of usb_allocmem.
2021-01-05 18:00:21 +00:00
skrll a15c9db76d Replace home grown #ifdef DIAGNOSTIC check with ASSERT_SLEEPABLE 2021-01-05 16:15:09 +00:00
jmcneill 588c4b5800 Use USBMALLOC_ZERO to ensure that all DMA memory is zero initialized. 2021-01-02 12:39:33 +00:00
jmcneill af3c884e20 Add USBMALLOC_ZERO flag for requesting zero initialized DMA memory. 2021-01-02 12:39:03 +00:00
jdc 9e86c88a58 During detach, re-use the functions that halt playback and record DMA.
Prevents a panic during shutdown when media is playing.
2020-12-29 08:04:59 +00:00
jym a99a2d70c7 Add WayTech USB to Serial device to quirks routines, in order to prevent
uhid(4) from attaching and leave it to ugen(4) so libusb can query it.

It is used by some UPS peripherals for their management, especially the
ones from Infosec and Megatec.

Tested with Infosec E3 UPS through ups-nut-usb and `blazer_usb' driver
using the following configuration (ups.conf):

        [infosec]
                driver = blazer_usb
                port = auto
                vendorid = 0665
                productid = 5161

Make sure the associated /dev/ugenXXX is accessible to `nut' user if you
use ups-nut.
2020-12-26 22:15:37 +00:00
jym a02c14d579 Regen. 2020-12-26 22:11:20 +00:00
jym 08c7f434ce Add WayTech Development USB to Serial product.
It is used by some UPS devices, notably Infosec and Megatec.

The vendor ID (0x0665) is known differently from various mainstream OSes;
but it is officially registered by USB-IF as `WayTech Development, Inc.'. So
be it.
2020-12-26 22:09:18 +00:00
riastradh 9fd32e5474 usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.
These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT
endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to
pass the struct usbd_xfer object to usbd_close_pipe to free later.

In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints,
up_intrxfer is never initialized, so the assertion cannot be right.
In principle we might even have more than one outstanding interrupt
transfer at a time, rendering the point of the assertion moot anyway.

Found by interrupting a uhidev write to a u2f device.

ok nick
2020-12-22 01:07:23 +00:00
thorpej 1abee2b4f1 Use sel{record,remove}_knote(). 2020-12-18 01:31:49 +00:00
skrll ed48051c9f Another leading space 2020-12-10 20:50:24 +00:00
skrll 2d27dd3df7 Remove leading space that crept in in the last change 2020-12-10 20:48:33 +00:00
skrll 72b9f5a656 Restructure the abort code for TD based transfers (ctrl, bulk, intr).
In PR kern/22646 some TDs can be on the done queue when the abort start
and, if this is the case, they need to processed after the WDH interrupt.
Instead of waiting for WDH we release TDs that have been touched by the
HC and replace them with new ones.  Once WDH happens the floating TDs
will be returned to the free list.

Also addresses the issue seen in PR kern/55835

Thanks to both Andreas Gustafsson and Edgar Fuß for testing.  Apologies to
Andreas Gustafsson for not committing this to HEAD for 4y6m.w
2020-12-09 07:10:01 +00:00
msaitoh 48b6679adf s/ we we / we / 2020-11-30 05:30:56 +00:00
riastradh 92f37f2423 uhid(4): Omit needless softint indirection.
USB xfer callbacks already run in softint context at IPL_SOFTSERIAL,
and I see no reason why the call to psignal must happen instead at
the lower priority of IPL_SOFTCLOCK, so let's avoid using up the
scarce resource of softints for something that doesn't need 'em.

While here, use atomic_store_relaxed to update sc->sc_async and
atomic_load_relaxed to optimisitcally test it without acquiring
proc_lock.
2020-11-30 00:48:35 +00:00
riastradh e56a369d75 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.
2020-11-29 22:54:51 +00:00
mrg 26a9e5e0ac s/USENET/USBNET/ in another place i just happened to find by
typo-ing "UBS" as "USE".
2020-10-28 01:51:45 +00:00