Commit graph

4294 commits

Author SHA1 Message Date
Andreas Wetzel
99e934e6f1 rtwn/usb: add product ID for Asus USB N10 Nano Rev. B1
According to information found on the internet the following products
use exactly the same hardware but probably different USB IDs:
- Edimax EW-7811Un V2 (v2)
- Edimax EW-7811GLN 2.0A (v2)
I am not adding them as I cannot verify.

PR:		254280

(cherry picked from commit cd6f0b4769)
2021-12-13 08:35:49 +02:00
Alexander Motin
1fb199ffa6 xhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.
MFC after:	2 weeks

(cherry picked from commit cfb0e4d76c)
2021-12-12 22:16:28 -05:00
Alexander Motin
155748c1e7 xhci: Add PCI IDs from recent Intel CPUs.
MFC after:	2 weeks

(cherry picked from commit 83d7b2f335)
2021-12-11 00:17:16 -05:00
Mitchell Horne
06dc4eab74 ucom: s/sio/ucom/
Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33278

(cherry picked from commit e43d081f35)
2021-12-10 14:31:20 -04:00
Elyes HAOUAS
27fceea98c Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
(cherry picked from commit 9097ac9af4)
2021-12-06 08:55:55 -07:00
Hans Petter Selasky
9e89269ee7 usb/u3g: Add support for Quectel EM05.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/565
Sponsored by:	NVIDIA Networking

(cherry picked from commit 0229172a65)
2021-12-02 15:51:46 +01:00
Bjoern A. Zeeb
6acb9d5f95 net80211/drivers: improve ieee80211_rx_stats for band
While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9a6695532b)
2021-11-19 00:01:25 +00:00
Alexander Motin
1e5dc6aa18 Add some of Intel Alder Lake device IDs.
MFC after:	1 week

(cherry picked from commit dc238358f9)
2021-11-12 23:02:46 -05:00
Hans Petter Selasky
f8b998c730 usb(4): Fix for use after free in combination with EVDEV_SUPPORT.
When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by:	pho@
Sponsored by:	NVIDIA Networking

(cherry picked from commit aad0c65d6b)
2021-11-02 09:37:25 +01:00
Ian Lepore
b1cca74367 Fix busdma resource leak on usb device detach.
When a usb device is detached, usb_pc_dmamap_destroy() called
bus_dmamap_destroy() while the map was still loaded. That's harmless on x86
architectures, but on all other platforms it causes bus_dmamap_destroy() to
return EBUSY and leak away any memory resources (including bounce buffers)
associated with the mapping, as well as any allocated map structure itself.

This change introduces a new is_loaded flag to the usb_page_cache struct to
track whether a map is loaded or not. If the map is loaded,
bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking
away resources.

Differential Revision:	https://reviews.freebsd.org/D32208

(cherry picked from commit dc91a9715f)
2021-10-06 09:36:02 -06:00
Gordon Bergling
7172006900 smsc(4): Fix a typo in a comment
- s/setings/settings/

(cherry picked from commit 9599d8141f)
2021-10-06 08:21:05 +02:00
Kornel Duleba
28df957acb if_cdce: Add support for setting RX filtering
We can now set promisc and allmulti modes.
Filtering of given multicast addresses is not supported.
Changing the mode is done by sending a command described in:
"USB CDC Subclass Specification for Ethernet Devices v1.2, section 6.2.4".
This means that at least in theory this feature should work with all
modems that are using this driver.

This fixes Huawei E3372h-320 running new firmware in "HiLink" mode.
Previously it would reset a few seconds after its mode was changed
with "usb_modeswitch".
Setting RX filter to default value at the end of attach function
fixed that.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D31766
MFC after:		2 weeks
Reviewed by:		hps

(cherry picked from commit f0c393f781)
2021-09-28 09:03:48 +02:00
John-Mark Gurney
87e560496f ued may be NULL here which will cause a panic... reproducable by
simply doing a usbconfig reset on a device which doesn't reset itself
properly...

(cherry picked from commit 3d5104182c)
2021-09-28 09:03:48 +02:00
John-Mark Gurney
973fb85188 Add support for link status, media and VLAN MTU (if supported) to if_cdce...
This makes it more usable in that dhclient will autolaunch from devd
now when cdce devices are plugged in..  It also sets the baudrate, but
this isn't exported via tools, and CDCE doesn't have a good way to
specify the media type, so there isn't a good way to tell userland
what the speed is currently...

Reviewed by:		hps
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D30625

(cherry picked from commit b43d600c83)
2021-09-28 09:03:48 +02:00
Kornel Duleba
fea962297f umodem: Add Huawei E3372h-320 device id
After switching the dongle to the Huawei alternate mode(modem mode)
with usb_modeswitch the serial interfaces had all of their ids set to
0xFF.
After modifying umodem to work with that it attached successfully and
I've managed to configure device with standard AT commands to get
internet connection.

(cherry picked from commit 28d5498268)
2021-09-28 09:03:48 +02:00
Hans Petter Selasky
e4cbb47700 Cleanup unused USB enums.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-09-22 14:59:31 +02:00
Vladimir Kondratyev
3f03cc9a8e wmt(4): Adapt to recent KPI changes
(cherry picked from commit 527b6d60f8)
2021-09-22 02:36:18 +03:00
Vladimir Kondratyev
139144a7ae wsp(4): Add evdev support.
Reviewed by:	hselasky
Tested by:	Greg V, Constantin Furst<constantin_AT_fuersten_DOT_info>
PR:		252236
Differential revision:	https://reviews.freebsd.org/D31653

(cherry picked from commit 8d73071c47)
2021-09-08 03:01:07 +03:00
Vladimir Kondratyev
d780fe9df0 wsp(4): Compact parameter structure.
(cherry picked from commit 250ab00407)
2021-09-08 03:00:47 +03:00
Vladimir Kondratyev
5a5bab49a0 atp(4), wsp(4): Return correct priority from probe() method;
(cherry picked from commit 9fa1201d60)
2021-09-08 03:00:27 +03:00
Gordon Bergling
aa9d47d9de Fix a common typo in man pages and src comments
- s/desciptor/descriptor/

(cherry picked from commit b1603638e3)
2021-09-02 08:13:48 +02:00
Gordon Bergling
f296898fb7 Fix a common typo in source code comments
- s/aligment/alignment/

(cherry picked from commit a1581cd735)
2021-08-19 09:18:35 +02:00
Hans Petter Selasky
47c5e288ee Narrow down the probe range for if_ure(4) compatible devices
to only match the first vendor specific interface, if any.

PR:		253374
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit dab84426a6)
2021-07-10 21:17:29 +02:00
Hans Petter Selasky
77f7133bd5 Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4).
Submitted by:	fbbz@synack.eu
PR:		253374
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d4cf41a99b)
2021-07-10 21:17:26 +02:00
Vladimir Kondratyev
a4a738ba75 ums(4): Do not stop USB xfers on FIFO close when evdev is still active
This fixes lose of evdev events after moused has been killed.

While here use bitwise operations for UMS_EVDEV_OPENED flag.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30342

(cherry picked from commit 05ab03a317)
2021-06-14 00:59:18 +03:00
Vladimir Kondratyev
927742783f ums(4): Start USB xfers on opening of evdev node unconditionally.
This fixes inability to start USB xfers in a case when FIFO has been
already open()-ed but no read() or poll() calls has been issued yet.

MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30343

(cherry picked from commit 47791339f0)
2021-06-14 00:58:44 +03:00
Vladimir Kondratyev
a303f4b1c1 usbhid(4): Add second set of USB transfers to work in polled mode.
The second set of USB transfer is requested by hkbd(4) and
should improve HID keyboard handling in kdb and panic contexts.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30486

(cherry picked from commit 9aa0e5af75)
2021-06-14 00:57:37 +03:00
Vladimir Kondratyev
4458105f06 usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len()
Which happens when USB transfer setup is failed.

PR:		254974
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30485

(cherry picked from commit e889a462d8)
2021-06-14 00:57:31 +03:00
Dmitry Chagin
923cd7e05a rtwn_usb(4): Add a USB ID for the TP-Link Archer T2U v3.
PR:		256203
Submitted by:	Steve Kargl sgk at troutmask.apl.washington.edu

(cherry picked from commit 434c46c006)
2021-06-10 09:14:22 +03:00
Dmitry Chagin
195f47fdb6 run(4): add support for DLINK DWA-130 rev F1 wireless adaptor.
PR:		256092
Submitted by:	Francois Briere <purplefiasco at gmail.com>

(cherry picked from commit 8746bc9187)
2021-06-06 14:23:43 +03:00
Hans Petter Selasky
ad9d0df7c6 Propagate down USB explore error codes, so that failures to enumerate USB HUBs
behind USB HUBs are detected and the USB reset counter logic will kick in
preventing enumeration of continuously failing ports.

Submitted by:	phk@
Tested by:	bz@
PR:		237666
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit e5ff940a81)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
ae9aba942b Update usb_timings_sysctl_handler() to accept any value for timings between
0 milliseconds and 2 seconds inclusivly. Some style fixes while at it.

The USB specification has minimum values and maximum values,
and not only minimum values.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 00e501d720)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
5bbf7afe30 Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which
says it should be max 10 milliseconds.

This may fix some USB enumeration issues:
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_IOERROR, ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,

Found by:	Zhichao1.Li@dell.com
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 70ffaaa69c)
2021-06-02 13:25:19 +02:00
Hans Petter Selasky
9f98b3ea74 Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by
detaching the ifnet before the miibus.

PR:		252608
Suggested by:	jhb@
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4eac63af23)
2021-06-02 13:25:19 +02:00
Dmitry Chagin
9394c3fcdb run(4): add support for ASUS USB-N14 wireless adaptor.
PR:		255759
Submitted by:	john.lmurdoch at gmail.com

(cherry picked from commit d6fd321ef6)
2021-06-01 13:01:53 +03:00
Hans Petter Selasky
a122a5ebde Add more USB quirks for Garmin devices.
Sort the Garmin products while at it.

PR:		254664
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 28af0c4814)
2021-05-10 16:11:19 +02:00
Hans Petter Selasky
0d1e6e9413 Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Since then, the FreeBSD USB stack has got proper USB RNDIS support.

PR:		254345
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d2c8714064)
2021-05-10 16:11:19 +02:00
Hans Petter Selasky
74ef3f740d Add more USB quirks for Kingston devices.
PR:		253855
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 47bc8fc9ae)
2021-05-10 16:11:19 +02:00
Hans Petter Selasky
9312bcb2e9 if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
similarly to the Linux driver, by a tunable read only sysctl.

Submitted by:	Oleg Sidorkin <osidorkin@gmail.com>
PR:		254884
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 5a3426f453)
2021-05-10 16:11:19 +02:00
Alexander Motin
a4bea2f2a6 Refactor CTL datamove KPI.
- Make frontends call unified CTL core method ctl_datamove_done()
to report move completion.  It allows to reduce code duplication
in differerent backends by accounting DMA time in common code.
 - Add to ctl_datamove_done() and be_move_done() callback samethr
argument, reporting whether the callback is called in the same
context as ctl_datamove().  It allows for some cases like iSCSI
write with immediate data or camsim frontend write save one context
switch, since we know that the context is sleepable.
 - Remove data_move_done() methods from struct ctl_backend_driver,
unused since forever.

MFC after:	 1 month

(cherry picked from commit 2c7dc6bae9)
2021-03-14 22:34:08 -04:00
Vladimir Kondratyev
e7211ca03a ukbd: Fix handling of keyboard ErrorRollOver reports
Ignore fantom keyboard state reports entirelly rather than ignore
RollOver states for each key separatelly.  Latter results in spurious
release/push pairs of events on each fantom keyboard state report.

Reported by:	Jan Martin Mikkelsen <janm_AT_transactionware_DOT_com>
Submitted by:	Jan Martin Mikkelsen (initial version)
PR:		253249
MFC after:	1 week

(cherry picked from commit 032d315387)
2021-02-24 02:41:49 +03:00
Vladimir Kondratyev
b62f6dfaed hid: Replace USBHID_ENABLED kernel config option with loader tunable
usbhid(4) is disabled by default to avoid conflicts with existing USB HID
drivers. To enable it place following lines to /boot/loader.conf:

hw.usb.usbhid.enable=1
usbhid_load="YES"

Suggested by:	jhb
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D28124
2021-01-14 23:04:47 +03:00
Hans Petter Selasky
6e5baec33c Fix for use-after-free in if_ure(4) driver.
When detaching the if_ure(4) driver, the TX active USB transfer array may
point to freed USB transfers. Given that the number of USB transfers is
very low, simply start all transfers every time there is a packet to
keep safe from use-after-free.

PR: 252608
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-12 17:57:58 +01:00
Vladimir Kondratyev
9be6b22da9 hidraw(4): Add HIDRAW_MAKE_UHID_ALIAS kernel option
which installs /dev/uhid# alias to hidraw character device for
compatibility with some existing uhid(4) users like Firefox.
As side effect it renames traditional uhid(4) driver to hidraw
to make possible using of common unit number allocator.

Requested by:	Greg V <greg_unrelenting.technology>
Reviewed by:	hselasky (as part of D27992)
2021-01-08 02:18:44 +03:00
Vladimir Kondratyev
9477390796 hid: Import hidraw(4) - driver for access to raw HID device data
This driver provides raw access to HID devices through uhid(4)-compatible
interface and is based on pre-8.x uhid(4) code. Unlike uhid(4) it does
not take devices in to monopoly ownership and allows parallel access
from other drivers.

hidraw supports Linux's hidraw-compatible interface as well.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27992
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
01f2e864f7 hid: Import usbhid - USB transport backend for HID subsystem.
This change implements hid_if.m methods for HID-over-USB protocol [1].

Also, this change adds USBHID_ENABLED kernel option which changes
device_probe() priority and adds/removes PnP records to prefer usbhid
over ums, ukbd, wmt and other USB HID device drivers and vice-versa.

The module is based on uhid(4) driver.  It is disabled by default for
now due to conflicts with existing USB HID drivers.

[1] https://www.usb.org/sites/default/files/hid1_11.pdf

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27893
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
eead9017d2 hid: Chase for HID function name changes in existing USB HID drivers
Also hide shim code added in a previous commit under COMPAT_USBHID12.

Note: it is enough to add -DCOMPAT_USBHID12 to CFLAGS to compile old
code with new HID subsystem, but it is not enough to link it at runtime.
HID dependency has to be added explicitly with MODULE_DEPEND macro.

Reviewed by:	manu, hselasky (as part of D27887)
2021-01-08 02:18:42 +03:00
Vladimir Kondratyev
1975878673 hid: Import functions and constants required by new subsystem
This does an import of quirk stubs, debugging macros from USB code and
numerous usage constants used by dependent drivers.

Besides, this change renames some functions to get a better matching
with userland library and NetBSD/OpenBSD HID code. Namely:

- Old hid_report_size() renamed to hid_report_size_max()
- New hid_report_size() calculates size of given report rather than
  maximum size of all reports.
- hid_get_data_unsigned() renamed to hid_get_udata()
- hid_put_data_unsigned() renamed to hid_put_udata()

Compat shim functions are provided in usbhid.h to make possible compile
of legacy code unmodified after this change.

Reviewed by:	manu, hselasky
Differential revision:	https://reviews.freebsd.org/D27887
2021-01-08 02:18:42 +03:00
Vladimir Kondratyev
67de2db262 Factor-out hardware-independent part of USB HID support to new module
It will be used by the upcoming HID-over-i2C implementation.  Should be
no-op, except hid.ko module dependency is to be added to affected drivers.

Reviewed by:	hselasky, manu
Differential revision:	https://reviews.freebsd.org/D27867
2021-01-08 02:18:42 +03:00
Vladimir Kondratyev
5af73ad51b evdev: Remove useless "initial value" parameter from evdev_support_abs()
It can not be used for setting of state of multitouch events.
If necessary, use evdev_push_event() instead of it.
2021-01-08 02:18:41 +03:00