Commit graph

4554 commits

Author SHA1 Message Date
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
Ahmad Khalifa
e152944f1a usb: increase USB_PORT_RESET_RECOVERY
10ms seems to be too strict for some configurations, so increase to
20ms.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1327
2024-09-06 12:34:30 -06:00
Franco Fichtner
4b6e76eff8 u3g: add SIERRA AC340U
Pull request:	https://github.com/freebsd/freebsd-src/pull/1397
MFC after:	3 days
2024-08-30 00:05:30 -07:00
Bjoern A. Zeeb
9c0cce3283 usb: correct the rtw8821cu quirk and add another wireless rtw88 device
The RTW8821CU_CD entry in quirks has an invalid lo_rev/hi_rev match
entry.  Use the different USB_QUIRK macro to match on all of these;
the value we currently see is 0x0200 on two different wifi sticks. [1]

Also add an entry for the DLINK DWA-181 rev A1, rtw88 USB.

Submitted by:	phk
Tested by:	phk
Fixes:		b3b6a959c8 [1]
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46189
2024-08-27 17:48:43 +00:00
Li-Wen Hsu
6ea4d95f6c
Move support of Realtek 8156/8156B from cdce(4) to ure(4)
Reviewed by:	kevlo, imp, hrs
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45088
2024-08-12 14:56:28 +08:00
Warner Losh
5b56413d04 newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY
Sponsored by:		Netflix
2024-07-24 22:22:58 -06:00
Adrian Chadd
2589197adb net80211: migrate the group/unicast key check into inline functions
The way that net80211 and drivers are checking for the /type/ of key
is to check if it's in the vap WEP key array and if so, it's a group
key.  If not, it's a unicast key.

That's not only kind of terrible, but it's also going to be
problematic with future 802.11 support (for multiple unicast keys
and IGTK keys for management frame protection.)

So as part of this, remove the places where this is done and
instead use a pair inline functions - ieee80211_is_key_global() and
ieee80211_is_key_unicast().  They currenly still use the same logic
but the drivers and net80211 stack isn't doing it itself.

There are still open questions about why keys are not being
correctly tagged as GROUP, GTK, PTK, etc.  That will be investigated
and addressed in follow-up work as a pre-cursor to MFP, IGTK, etc.
as mentioned above.

Testing:

* iwn, rtwn - STA mode

Differential Revision:	 https://reviews.freebsd.org/D45516
2024-07-15 11:45:30 -07:00
Mark Johnston
5dc4682c32 if_urndis: Organize buffer layouts more naturally
- Group the request header and I/O buffer in one structure, rather than
  assuming that both request structures have the same size.
- Pass a pointer to the whole structure to urndis_ctrl_query() and
  urndis_ctrl_set() rather than just the header.  Otherwise, on CHERI
  platforms, these functions violate subobject bounds since they modify
  the buffer following the header.

While here, there is no apparent reason for the request structure used
in urndis_attach() to be allocated statically.  Change it so that it's
allocated on the stack.

No functional change intended.

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D45866
2024-07-09 10:26:16 -04:00
Niko Sonack
d6888e211b ums(4): fix incorrect mouse button reporting via evdev
when ums driver receives non-mouse HID report. This results in
unexpected button release event. Reuse existing sysmouse logic to
keep button pressed.

Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45838
2024-07-03 02:15:50 +03:00
Zhenlei Huang
aa3860851b net: Remove unneeded NULL check for the allocated ifnet
Change 4787572d05 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740
2024-06-28 18:16:29 +08:00
Dmitry Luhtionov
4cc4b5e2b5 Add some AMD device IDs. 2024-06-07 13:02:03 -04:00
Maxime Thiebaut
b5b90ff984 u3g: Add support for SIM7600G
Signed-off-by:	Maxime Thiebaut <maxime+freebsd@thiebaut.dev>
Reviewed by:	kp
2024-06-06 17:02:15 +02:00
Joshua Kinard
80828c6fab kern: Remove leftover saf1761otg bits
Almost all code related to the saf1761 driver was removed in commit
44796b7e82, except for two small bits related to saf1761otg support.
This patch completes the removal.

PR:		279302
Signed-off-by:	Joshua Kinard <freebsd@kumba.dev>
Reviewed by:	mhorne
MFC after:	3 days
Fixes:		44796b7e82 ("mips: remove saf1761")
2024-06-03 12:52:58 -03:00
Kevin Lo
345fd21a6a Add a new USB ID for Xiaomi mini USB WiFi 2024-05-31 09:40:03 +08:00
Ahmad Khalifa
881ae768f2 usb: Remove uneeded revision verbosity from quirks list
Seperate usb quirks that target specific revisions from those that
dont. Alot of the quirks dont use lo_rev and hi_rev, so we can abstract
the 0x0000, 0xffff into a macro.

[[ This commit is a bit more churn than we like. I carefully reviewed
   each one and they are all good. The end product is better -- imp ]]

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1153
2024-05-11 13:32:57 -06:00
Ahmad Khalifa
64e05e9065 usb: Fix quirks list
In some cases, the USB_QUIRK_VP macro was being misused. Instead of
setting quirks to the intended value, the first two supplied quirks
would go into lo_rev and hi_rev. Replace it with USB_QUIRK_VO which only
takes the needed args. This also makes the Dummy products, which where
being used to correctly set vendor only quirks, not necessary.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1153
2024-05-11 13:32:37 -06:00
Ed Maste
7ef6ce5174 smsc(4): update to mention Microchip
Microchip Technology acquired SMSC in 2012, and all current products
and datasheets refer to the devices supported by this driver as
Microchip parts.  Mention SMSC in a parenthetical comment to explain
the driver's name.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45115
2024-05-08 14:18:46 -04:00
Gordon Bergling
604511f84a usb(4): Remove a double word in a source code comment
- s/of of/of/

MFC after:	3 days
2024-04-20 14:10:59 +02:00
Denis Bodor
54e231b373 Add support for i2c-tiny-usb: usb to iic bridge
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1123
2024-04-19 16:40:23 -06:00
Gordon Bergling
046fe202e7 muge(4): Fix a typo in a source code comment
- s/addres/address/

MFC after:	3 days
2024-04-18 16:18:26 +02:00
Lexi Winter
ac83063d37 bcm2838_xhci: add module
bcm2838_xhci(4) is a shim for the XHCI controller on the Raspberry Pi 4B
SoC.  It loads the controller's firmware before passing control to the
normal xhci(4) driver.

When xhci(4) is built as a module (and not in the kernel), bcm2838_xhci
is not built at all and the RPi4's XHCI controller won't attach due to
missing firmware.

To fix this, build a new module, bcm2838_xhci.ko, which depends on
xhci.ko.  For the dependency to work correctly, also modify xhci to
provide the 'xhci' module in addition to the 'xhci_pci' module it
already provided.

Since bcm2838_xhci is specific to a quirk of the RPi4 SoC, only build
the module for AArch64.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1142
2024-04-09 21:11:39 -06:00
Gordon Bergling
5a476e64b5 uath(4): Fix a typo in a source code comment
- s/parmeter/parameter/

MFC after:	3 days
2024-02-22 16:55:51 +01:00
Gordon Bergling
059fd69e74 umcs(4): Fix two typos in source code comments
- s/frequences/frequencies/

MFC after:	3 days
2024-02-22 14:14:08 +01:00
Andriy Gapon
8f374fa528 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43960
2024-02-19 12:44:00 +02:00
Bjoern A. Zeeb
713db49d06 net80211: deal with lost state transitions
Since 5efea30f03 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389
2024-02-14 19:47:21 +00:00
Andriy Gapon
5b54b6ac8c usbdevs: add Ralink RT7601 aka MT7601
This is a popular USB WiFi chip.
Unfortunately, it's not supported by FreeBSD yet.
2024-01-28 13:10:51 +02:00
Gordon Bergling
d743711016 usb: Fix a typo in a source code comment
- s/recevied/received/

MFC after:	3 days
2024-01-22 21:57:06 +01:00
Gordon Bergling
f5e3329a5a usb: Fix two typos in source code comments
- s/bascially/basically/
- s/assistence/assistance/

MFC after:	3 days
2024-01-20 17:32:20 +01:00
Christos Margiolis
45cd29412e usb: use only usb_devinfo() in device_set_usb_desc()
device_set_usb_desc() first tries to fetch device information through
the iInterface descriptor, otherwise it falls back to usb_devinfo().
Since usb_devinfo() is both guaranteed to work, and is more verbose, get
rid of the initial iInterface attempt.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D43383
2024-01-16 18:49:08 +02:00
Emmanuel Vadot
62e8ccc3a4 syscon: Move syscon code in dev/syscon
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	mhorne
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43196
2024-01-10 19:20:37 +01:00
Emmanuel Vadot
950a6087ec phy: Move phy code in dev/phy
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	emaste, imp
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43195
2024-01-10 19:20:34 +01:00
Emmanuel Vadot
b2f0caf160 regulator: Move regulator code in dev/regulator
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	emaste, imp
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43194
2024-01-10 19:20:32 +01:00
Emmanuel Vadot
1f469a9fc4 hwreset: Move reset code in dev/hwreset
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	imp
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43192
2024-01-10 19:20:28 +01:00
Emmanuel Vadot
be82b3a0bf clk: Move clock code in dev/clk
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	mhorne
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43191
2024-01-10 19:20:26 +01:00
Emmanuel Vadot
fe75646a02 usb: dwc3: Move driver under a subdirectory
dwc3 is big enough to have its own subdirectory.
While here only make it depend on kernel option dwc3 and rk_dwc3
without any SOC options.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43190
2024-01-10 19:20:24 +01:00
Mark Johnston
b2caed2f8d uhid: Check for errors from copyin() in ioctl handlers
This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	wulf
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43103
2023-12-25 21:04:00 -05:00
Ronald Klop
8a0ee30622 if_smsc: fix build on armv6 & armv7
compile error was:
/usr/src/sys/dev/usb/net/if_smsc.c:1597:40: error: format specifies type 'unsigned long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
                                "failed alloc for bootargs (%lu)", len);
                                                            ~~~    ^~~
                                                            %zd

PR:	274092
Approved by:	karels
MFC after:	1 month
2023-12-07 17:50:28 +01:00
Ronald Klop
3878bbf1bb Teach if_smsc to get MAC from bootargs.
Some Raspberry Pi pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX as bootargs.
Use this if no ethernet address is found in an EEPROM.
As last resort fall back to ether_gen_addr() instead of random MAC.

PR:	274092
Reported by:	Patrick M. Hausen (via ML)
Reviewed by:	imp, karels, zlei
Tested by:	Patrick M. Hausen
Approved by:	karels
MFC after:	1 month
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D42463
2023-12-07 12:32:01 +01:00
Eugene Grosbein
970d73856b usbdevs: add quirk for WD MyPassport Ultra External HDD
WD MyPassport Ultra External HDD needs quirk
UQ_MSC_NO_TEST_UNIT_READY to attach.

MFC after:	3 days
2023-12-03 23:50:40 +07:00
Bjoern A. Zeeb
75f298492a Revert "Enter the network epoch in USB WiFi drivers when processing input"
This reverts commit 17c328b6ae.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Bjoern A. Zeeb
39b7027979 Revert "Widen EPOCH(9) usage in USB WLAN drivers."
This reverts commit 21c4082de9.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Warner Losh
fdafd315ad sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00
Dmitry Luhtionov
f969fb53d8 Add some Intel ICH10 PCI IDs. 2023-10-30 10:37:36 -04:00
Warner Losh
f42bb99ad5 udbp: Remove stale splnet comment
netgraph no longer needs splnet. Document that we're forcing queueing.

Sponsored by:		Netflix
2023-10-27 14:12:04 -06:00