Commit graph

4597 commits

Author SHA1 Message Date
Nia Alarie
426f4e5e2e if_run: Add sitecom device id
Reviewed by:	thj, adrian
Obtained from:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D49588
2025-04-01 09:00:07 +01:00
Nia Alarie
9f3e7b7597 if_rsu: Add sitecom device id
Approved by:	thj, adrian
Obtained from:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D49588
2025-04-01 08:59:42 +01:00
Adrian Chadd
8b0acd8538 mtw: fix compilation with IEEE80211_SUPPORT_SUPERG enabled
It looks like this was missed during the driver development and
porting.

Differential Revision:	https://reviews.freebsd.org/D49512
Reviewed by:	thj
2025-03-28 11:59:35 -07:00
Adrian Chadd
d342ae6719 uath: add support for GCMP-128 encryption
Explicitly set the software ciphers; add support for GCMP-128.

Locally tested:

* AR5523 11abg NIC, 2/5GHz STA operation, GCMP forced
  in wpa_supplicant.conf

Differential Revision:	https://reviews.freebsd.org/D49370
Reviewed by:	bz
2025-03-26 18:28:47 -07:00
Warner Losh
b0375f78e3 usb-msctest: Be more conservative setting GETMAXLUN quirk
Only set the GETMAXLUN quirk when it causes an error, but don't set it
when it returns 0. Since we reset the device when we set any quirk, only
set this quirk when it generates an error so umass will avoid it. When
the command works, there's no reason for umass to avoid it at all.

MFC After: 1 week
Sponsored by: Netflix
2025-03-16 13:23:25 -06:00
Warner Losh
9ea38ca4a8 umass/quirk: Remove useless quirk for Transcend flash
I have several of these. They all work without these quirks (either the
auto quirk mechanism does the right thing, or a likely
soon-to-be-removed vendor catch-all does the right thing, or no probing
at all does the right hting).

Both PREVENT ALLOW and SYNCHRONIZE CACHE are (a) unimplemented but (b)
return the proper asc/ascq code so da just does the right thing, quirk
or no. This was a left-over from the days where you'd get scary error
messages, but we'd work just fine. Now that the scary error messages are
gone (and only a calm one under bootverbose), this can be deleted.

Sponsored by:		Netflix
2025-03-15 21:47:44 -06:00
Warner Losh
4804a461b5 umass/quirks: Remove nonsensical NO_GETMAXLUN quirks
We only try to do a GETMAXLUN query of BBB devices. If we're forcing the
device to be CBI, then it's not BBB. Delete the quirks from there. Also,
UFI devices are all CBI as well, so remove the quirk from there as well.
Confirmed this isn't needed with three different floppy disk drives I
have.

Sponsored by:		Netflix
2025-03-15 21:45:31 -06:00
John Baldwin
ba6c35f0ca usb: Use bus_detach_children instead of bus_generic_detach
The USB bus performs additional teardown steps in between detaching
child devices and deleting child devices.

Reported by:	phk, thj
Tested by:	phk
Fixes:		e9d3857040 ("Use bus_detach_children instead of bus_generic_detach")
2025-03-12 10:54:49 -04:00
Warner Losh
048d6ca31d umass: Remove some 20-year-old dead code
A REQUEST SENSE CDB was just copied into the cmd buffer, so testing for
INQUIRY will always fail.  Remove the dead code.

This code was added, apparently by mistake in 2003.  8541fbec79
merged changes from NetBSD's umass_scsipi.c 1.8 to address some BBB
bulk-in clear problems. NetBSD had fixed a problem in the
FORCE_SHORT_INQUIRY quirk code they had ported from FreeBSD that FreeBSD
also needed. That merge also included the dead code, which was not in
NetBSD.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49311
2025-03-10 20:33:15 -06:00
Joshua Rogers
b7269d89e5 wsp: Fix whitespaces
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
e381dabcc5 wsp: Rename max_finger_area sysctl to max_finger_diameter
The value of this sysctl is not an area, but a maximum diameter.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
a79397d132 wsp: Handle horizontal scrolling and create tunable for swipe/scroll.
Previously, a two-finger horizontal scroll would result in a forwards/backwards
keyboard event being performed. This patch changes that functionality to be
specified via two new sysctls: horizontal_swipe_finger_count and
scroll_finger_count. The former specifies how many fingers are used to perform
the aforementioned forwards/backwards keyboard event, while the latter specifies
how many fingers are used to perform horizontal scrolling. 0 disables each of
them.

The threshold for scrolling has been coupled into a single tunable:
scr_threshold. This tunable is used for both scrolling and the horizontal swipe.

t_factor and t_invert tunables have been created in the same manner as their
z-axis counterparts.

Horizontal scrolling is disabled by default, as it requires the sysctl
hw.usb.wsp.t_factor to 3 (wsp mode). Horizontal swiping is enabled by default
with a three-finger tap.

Also rewrite much of, and improve, documentation.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
02fb6b1162 wsp: Fix typo in function name.
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Joshua Rogers
d452a02995 wsp: Add hw.usb.wsp.max_scroll_finger_distance for two-finger scrolling
The hw.usb.wsp.max_scroll_finger_distance sysctl may be used to specify
the maximum distance between two fingers which are registered as a z-axis
(vertical scroll with mousepad) movement.

Previously, this was shared with the tunable
hw.usb.wsp.max_double_tap_distance which is used to specify the maximum
distance between two fingers which register as a right-click.

This patch also cleans up and add new information to the manpage for
wsp(4).

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Joshua Rogers
8ceca72751 wsp: Raise the default scr_hor_threshold sysctl.
The previous value caused nearly every horizontal movement to be
classed as a left/right-keyboard button-click.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Warner Losh
ca48e43ba9 usb: Kill left-over cdefs.h includes
These includes were for __FBSD_RCSID() macro. They weren't formatted
like the rest of the tree so weren't trimmed automatically when that
script was run. Trim them now.

MFC After: 1 week
Sponsored by:		Netflix
2025-03-04 14:44:22 -07:00
Adrian Chadd
7067450010 sys: convert ni->ni_txrate references use to the new net80211 API
This just mechanically converts things.

* For linuxkpi, it was just used for display.
* For uath, it was just used for display, as firmware
  doesn't report it up.

Differential Revision:	https://reviews.freebsd.org/D48602
Reviewed by:	bz, thj
2025-02-26 11:29:18 -08:00
Jesper Schmitz Mouridsen
b968644127 mtw: Use correct cmd for radio
Approved by:	adrian, wireless
Differential Revision:	https://reviews.freebsd.org/D49003
2025-02-14 16:20:40 +01:00
John Baldwin
d6cce475cb mtw: Pass the right pointer to the constructed command in mtw_mcu_radio
This was just using random stack garbage before.

Reported by:	GCC -Wunused-but-set-variable
2025-02-12 17:17:00 -05:00
Jose Luis Duran
4b77a9a80c
uath: Avoid a NULL dereference
PR:		284643
Reviewed by:	adrian
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48948
2025-02-12 15:33:26 +00:00
Jesper Schmitz Mouridsen
c14b016242 mt7601U: Importing if_mtw from OpenBSD
Added ht20 mode, based on if_run from FreeBSD, and if_mtw.c
from OpenBSD.

PR: 247545
Approved by:	adrian, wireless
Differential Revision: https://reviews.freebsd.org/D45179
2025-02-03 20:20:52 +01:00
Warner Losh
fdaf7d0fe1 umass: Print quirks with %b
Print the quirks in a more human-readable form. When testing a dozen
different removeable devices, the hex numbers quickly blur...

Sponsored by:		Netflix
2025-02-03 10:25:27 -07:00
Warner Losh
c64b3f32a5 umass: Add comment for ASC/ASCQ 24h/00h INVALID FIELD IN CDB
Add a comment for what this asc/ascq combo means. Very few people have
this memorized.

Sponsored by:		Netflix
2025-01-28 13:08:51 -07:00
FUKAUMI Naoki
dc273058cb ure(4): Add support for ELECOM EDC-QUA3C
ELECOM EDC-QUA3C is a USB3.1 Gen1 Type-A/C 2.5GBASE-T network adapter.
This also works as a cdce(4) device by:

usbconfig -d X.Y set_config 1
  or
usbconfig -d X.Y set_config 2

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>

MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1578
2025-01-24 19:25:11 +00:00
Adrian Chadd
0f1bf1c22a umb: Introduce the USB umb(4) network driver
This includes the port of a driver originally from OpenBSD, later
ported to NetBSD by the author:

* The umb(4) kernel driver
* The umbctl(8) companion tool

This driver supports USB network devices implementing the
Mobile Broadband Interface Model (MBIM), often found in modern
(internal) USB models for 4G/LTE mobile broadband access.

It is currently limited to IPv4.

umbctl has to be used to display or set MBIM cellular modem
interface parameters (4G/LTE).

Differential Revision:  https://reviews.freebsd.org/D48167
Approved by:    adrian, zlei
Sponsored by:   FreeBSD Foundation
PR:             kern/263783
Submitted by:   Pierre Pronchery <khorben@defora.org>
2025-01-20 23:46:15 +00:00
Mitchell Horne
9eb30ef4b7 riscv: enable Allwinner D1 USB drivers
Add the generic USB drivers and FDT glue to the build.

Make small tweaks to the aw_usbphy and aw_musb drivers for the Allwinner
D1.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48126
2025-01-10 13:57:36 -04:00
John Baldwin
11a9117871 Use bus_generic_detach to detach and delete child devices during detach
This is simpler and more robust than individual calls to
device_delete_child.

Differential Revision:	https://reviews.freebsd.org/D47972
2025-01-02 13:25:12 -05:00
John Baldwin
3ddaf8200b Use bus_generic_detach instead of device_delete_children in detach
While here, check for errors from bus_generic_detach and move it to
the start of detach if necessary.

Differential Revision:	https://reviews.freebsd.org/D47969
2025-01-02 13:24:28 -05:00
John Baldwin
160179ea3e Remove now-redundant calls to device_delete_children
Earlier calls to bus_generic_detach now take care of deleting
children.

Differential Revision:	https://reviews.freebsd.org/D47962
2025-01-02 13:22:50 -05:00
John Baldwin
cf416f56eb Use the new bus_generic_detach directly in place of home-grown versions
Differential Revision:	https://reviews.freebsd.org/D47960
2025-01-02 13:22:20 -05:00
Kyle Evans
36a80f4264 usb: serial: make more commands execute synchronously
The termios layer wants some level of guarantee that we've actually
submitted param changes to the hardware when our functions return, so we
need to do a little more waiting to avoid violating those guarantees.

This is especially important as some hardware has some minimum timing
specifications around this stuff, and without being less asynchronous
the software dealing with these devices can't reasonably operate the
hardware without more excessive delays than they should need.

More specifically, we make sure that:
 - The command to start transfers is finished before we toggle DTR/RTS
 - The status_change command finishes before we return, which may change
    some fields in the softc that we need for a subsequent call into
    usb_serial
 - cfg_param finishes before we re-enable transfers, and we ensure that
    RTS is appropriately toggled before we return to userland

This has been observed to fix some flakiness in connecting to some
ESP32 devices.

Tested by:	kenrap from Libera
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D47952
2024-12-10 19:23:41 -06:00
Kyle Evans
729eb176a4 usb: serial: allow the open/close sleep to be interruptible
ucom_queue_command will issue commands for open/close, then wait on them
to be finished.  In the spirit of playing it safe, allow
ucom_queue_command's wait to be interrupted in case the usb process gets
jammed up waiting on the hardware -- we can at least recover the user
thread that initiated it, even if we can't recover the usb process.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D47951
2024-12-10 19:23:10 -06:00
Kyle Evans
51f3d0874f usb: serial: propagate errors from ucom_queue_command()
There's only one error that we can get back right now, but future
changes will add some more cases that we need to watch out for.  Start
by returning errors and propagating them back.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47950
2024-12-10 19:23:10 -06:00
John Baldwin
18250ec6c0 Replace calls to bus_generic_attach with bus_attach_children
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47675
2024-12-06 17:26:16 -05:00
Mark Johnston
ef9ffb8594 kern: Make fileops and filterops tables const where possible
No functional change intended.

MFC after:	1 week
2024-11-26 21:04:21 +00:00
Augustin Cavalier
7dfaf23856 rtwn: Add device ID for TPLink RTL8192CU 2024-11-21 10:40:11 -05:00
Adrian Chadd
842a2c1ad3 uath: flush data/commands to the firmware before changing channel / state
The driver wasn't stable - it would start fine, but during scan
it would eventually hang and no further command endpoint transfers
would complete.

After adding some debugging and looking at the logs I noticed that
things went sideways once a /data/ frame was sent.  The channel
change config happened between the data frame being sent and
being completed.

My guess is that the firmware doesn't like a channel change
and reset whilst there's pending data frames.  Checking the Linux
driver I found that it was doing a flush before a channel change,
and we're doing it afterwards.  This acts like a fence around
ensuring scheduled TX work has completed.  In net80211 the
transmit path and the control path aren't serialised, so it's
very often the case that ioctls, state changes, etc occur
whilst in parallel there are frame transmits being scheduled.

This seems to happen more frequently on a more recent, high core
(8) machine with XHCI.  I remember testing this driver years ago
on single and dual core CPU laptops with no problems.

So, add some flushes - before a channel change, and during
a transition to AUTH when the BSS config is being programmed into
the firmware.  These two fences seem enough to reliably
associate as a 2GHz and 5GHz STA.

Note that this isn't entirely blocking all newly queued
transmit work from occuring until after the NIC has finished
configuration.  That will need some further investigation.

Locally tested:

  * Wistron NuWeb AR5523 dual-band NIC, STA mode, 2/5GHz

Differential Revision:	https://reviews.freebsd.org/D47655
2024-11-18 20:50:41 -08:00
Adrian Chadd
7098b90152 usb: fix the ID for the dual-band Wistron AR5523 USB NIC
Use the correct ID, as I have one of these NICs.
Add the previous one back in case it's out there in the wild.

@emaste did a bit of a dig into the product numbers.
@sam did change the ID from 0x0828 -> 082a in a commit
a long while back. It's worth reading the code review for
further details.

However, I do have one of these NICs and I verified that
it indeed has the given ID, and with some follow-up work
to fix some race conditions, it works fine in 2GHz 11bg
and 5GHz 11a operation.

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

Obtained from:	Linux, drivers/net/wireless/ath/ar5523/ar5523.c
2024-11-18 20:50:24 -08:00
Matthew Nygard Dodd
0b5d86b38a uhid(4): update ugd_actlen in USB_GET_REPORT ioctl
USB_GET_REPORT ioctl is documented to update ugd_actlen on return with
the number of bytes copied.  It does not do this.

Reviewed by:	wulf
PR:		282790
MFC after:	1 week
2024-11-18 07:31:24 +03:00
Adrian Chadd
c249cc3822 net80211: migrate FC0_TYPE_MASK / FC0_SUBTYPE_MASK frame type checks to macros
* Add macros for the management and control frame type checks that
  I've come across in the drivers.
* Delete some now old code (eg ath's ieee80211_is_action()) as there's now
  a macro for it.

Local testing:

* not yet, I have a lot of wifi devices to find and test against

Differential Revision: https://reviews.freebsd.org/D47500
2024-11-17 09:53:04 -08:00
Hajimu UMEMOTO
8eaeaf5c46 usb: Add support for Brainboxes USB-to-Serial adapters
PR:		277482
Reported by:	Cameron Williams
2024-11-11 21:14:05 +09:00
Ed Maste
114080d199 usb: fix loop in usb_config_parse
By inspection, index increment was missing.

PR:		281843
Reported by:	Matt Jacobson
Reviewed by:	bz, markj
Fixes: e4611d2626 ("usb(4): Call optional endpoint_uninit() when changing configuration or alternate setting.")
Sponsored by:	The FreeBSD Foundation
2024-11-10 21:53:18 -05:00
Frank Hilgendorf
541e7a98b7 ukbd: Enable ukbd_apple_swap for all Apple ISO keyboards
Key code swapping between [<>] and [^°] key is enabled for all Apple ISO
type keyboards.  Before, swapping was enabled when the Eject key was
detected in HID usage.  This did not correlate well with the swapped
keys presence.

usbdevs file is extended by several Apple keyboard models to support ISO
model identification.

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1506
2024-11-07 20:38:38 +00:00
Bjoern A. Zeeb
5b8f97d8db usb: change LIST to SLIST to avoid LinuxKPI conflicts
In order to better integrate modern LinuxKPI USB this tries to reduce
a contention point of "LIST".  Given there is no need to use a LIST here
change it to SLIST to avoid conflicts.
It is a workaround which does not solve the actual problem (overlapping
namespaces) but it helps us a lot for now.

Sponsored by:	The FreeBSD Foundation
X-MFC?		unclear
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46534
2024-09-24 22:53:28 +00:00
Kristof Provost
f8d14a44de if_usie: fix typo
Fix a 'case AF_INET;' typo, and ensure we include 'opt_inet6.h' so #ifdef INET6
actually works.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-09-22 00:56:37 +02:00
Franco Fichtner
1693e3be3b u3g: reorder Quectel devices by product ID
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1410
2024-09-21 05:25:15 -06:00
Alexander Motin
a1bb5bdb0a ure(4): Add ID for LAN port in Thinkpad OneLink+ dock
That's a pretty old dock for Thinkpad X1 Carbon Gen4 and few others.

MFC after:	1 week
2024-09-18 21:55:24 -04:00
Joshua Rogers
8aef1cd698 wsp: Use already-calculated distance of fingers for comparison.
Also correctly use tun.max_double_tap_distance for maximum distance
of fingers for vertical scrolling.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
Reviewed by: imp, wulf
Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-09-06 12:34:31 -06:00
Joshua Rogers
62cf43dda8 wsp: Improve multi-finger touchpad usage and allow more configurations
This patch allows scrolling with multiple fingers simultaneously, in
line with how wsp trackpads function on MacOS.

Two new tunables are added: hw.usb.wsp.max_finger_area and
hw.usb.wsp.max_double_tap_distance.

max_finger_area defines the maximum size which the driver registered an
object on trackpad as a finger.
Previously, this value was hardcoded as 1200, which was too low to
register thumb-clicks.

max_double_tap_distance defines the maximum distance between two
fingers which will register as a double-click.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
Reviewed by: imp, wulf
Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-09-06 12:34:31 -06:00
Joshua Rogers
7b984d5043 wsp: Allow the trackpad to be used after a partially unreleased click.
This provides functionality for a click which is partially unreleased
and then allows the user to continue moving the mousepad as if were not
invoked as a full click

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
Reviewed by: imp, wulf
Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-09-06 12:34:31 -06:00