Commit graph

4634 commits

Author SHA1 Message Date
Tom Jones
405cfeef61 xhci: Parse and print extended capabilities
Parse out and display xhci controller extended capabilities. This gives
us a mechanism to pick these up when the controller attaches. The print
helps users and developer know the availability of features in the wild.

This change will let developers know from dmesg that a controller
supports USB debugging.

Reviewed by:	aokblast
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51255
2025-09-02 10:37:08 +01:00
Bjoern A. Zeeb
7dce26eded usb: hub: uhub_root_intr() mark function arguments as __unused
No functional change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	aokblast, imp
Differential Revision: https://reviews.freebsd.org/D52147
2025-08-29 13:18:40 +00:00
Gordon Bergling
444bb6a248 if_umb: Fix a typo in a source code comment
- s/tranfers/transfers/

MFC after:	3 days
2025-08-25 10:43:36 +02:00
Vladimir Kondratyev
37e3b66466 usbhid(4): Implement USB_GET_DEVICEINFO ioctl
With factoring out of supporting code from ugen(4) driver.
The ioctl is used in FIDO/U2F security key drivers to get
USB product and manufacturer strings.

PR:		264843
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D51609
2025-08-18 00:00:45 +03:00
Vladimir Kondratyev
149b9f26d0 hidraw(4): Rename to uhid if HIDRAW_MAKE_UHID_ALIAS is specified
instead of renaming uhid(4) to hidraw to make easier import of coming
u2f(4) driver which has similar option.

Differential Revision:	https://reviews.freebsd.org/D51608
2025-08-18 00:00:44 +03:00
Vladimir Kondratyev
7699ec1558 hid: Add HQ_NO_READAHEAD quirk and implement it in usbhid(4)
It disables interrupt emulation on poll-driven buses like USB and
forces aquiring of only one USB frame per read(2) operation.
This avoids an FIDO/U2F issue where IN endpoint data received from
the device right before the file handle is closed, gets lost.

PR:		263995
Reviewed by:	aokblast
Differential revision:	https://reviews.freebsd.org/D51605
2025-08-18 00:00:44 +03:00
ShengYi Hung
c992ac6213 ipheth(4): Add CDC-NCM support for RX
The CDC-NCM (USB Communications Device Class – Network Control Model)
protocol allows multiple Ethernet frames to be encapsulated into a single
USB transfer.

On iOS, CDC-NCM is currently implemented for RX only and uses a fixed number
of entries (16). To maintain compatibility with older iOS versions, we attempt
to enable NCM on the USB device first; if this fails, we fall back to the
original behavior.

Approved by:    lwhsu (mentor), markj (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-08-15 01:01:17 -04:00
Ahmad Khalifa
c063fb7acc gpio: remove gpiobus_attach_bus
Since gpiobus_attach_bus can attach the gpiobus child along with its
children in the same bus pass, the parent controller's reference to
gpiobus might not be set by the time the children need it. Instead,
drivers should use gpiobus_add_bus and explicitly call
bus_attach_children.

Reviewed by:	mmel, imp (older version)
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D51578
2025-08-13 14:14:00 +03:00
Ed Maste
74072e9f16 usbhid: Enable by default
Co-authored-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed by:	bapt, wulf
Relnotes:	Yes
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45659
2025-07-30 14:31:54 -04:00
Tom Jones
4d718f57c5 xhci pci: Add some amd xhci controller device ids
Reviewed by: aokblast
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51259
2025-07-14 09:03:45 +01:00
Kevin Lo
1395712cab uchcom: add support for CH9102 and CH343 uarts
The CH343 devices support any baud rate up to 6 Mbps.
PR:	272803
Reviewed by:	imp
Tested by:	joerg, Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
Differential Revision:	https://reviews.freebsd.org/D46290
2025-06-25 09:33:35 +08:00
Ahmad Khalifa
b670c9bafc newbus: replace leftover device unit wildcards
Reviewed by:	imp, jhb
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50913
2025-06-21 05:57:45 +03:00
Kevin Lo
19d0dd8718 mtw: fix display of the MAC revision
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D50542
2025-06-19 13:42:39 +08:00
Olivier Certner
c21c24adde
runq: More selective includes of <sys/runq.h> to reduce pollution
<sys/proc.h> doesn't need <sys/runq.h>.  Remove this include and add it
back for kernel files that relied on the pollution.

Reviewed by:    kib
MFC after:      1 month
Event:          Kitchener-Waterloo Hackathon 202506
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45387
2025-06-17 22:07:57 -04:00
Jan Biedermann
50461a68e0 Add USB quirk for Creative Stage SE mini
Note: The commit in main was modified for the new macros in main.
stable merge will need to use the version originally in #1715

MFC After: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1715
Closes: https://github.com/freebsd/freebsd-src/pull/1715
2025-06-11 17:16:21 -06:00
Jan Biedermann
c2794499be usb: Don't call usb_msc_auto_quirk for UQ_MSC_IGNORE devices
usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using

'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.

Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716
2025-06-11 17:16:21 -06:00
Brooks Davis
e453e498cb machine/stdarg.h -> sys/stdarg.h
Switch to using sys/stdarg.h for va_list type and va_* builtins.

Make an attempt to insert the include in a sensible place.  Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Pierre Pronchery
82c41c9ffc umb: avoid wild pointer dereference in umb_decap()
When processing messages produced by the USB device, umb_decap() trusts
ptroff and later dlen and doff with pointer arithmetic, without
sufficient sanity checks. The resulting pointer address may be outside
of the valid boundary, causing the wrong memory to be copied or a page
fault.

This fix from Gerhard Roth was obtained after coordination upstream with
OpenBSD. It converts the variables to 64-bit integers, which should
mitigate the risk of overflows.

PR:             284920
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:   The FreeBSD Foundation
2025-05-29 15:07:57 +02:00
Pierre Pronchery
152bb8e302 umb: avoid buffer overflow in umb_getinfobuf()
umb_getinfobuf() is called with offs and size taken from messages sent
by the USB device. The sanity check is not sufficient, due to a possible
integer wrap. This can allow a broken or malicious USB device, or
possibly the network operator, to cause a buffer overflow.

This fix from Gerhard Roth was obtained after coordination upstream with
OpenBSD. It converts the variables to 64-bit integers, which should
mitigate the risk of overflows.

PR:             284906
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:   The FreeBSD Foundation
2025-05-29 15:07:54 +02:00
Pierre Pronchery
5ed36e2e17 umb: avoid buffer overflow in umb_in_len2mask()
len comes from ipv4elem.prefixlen in a MBIM_CID_IP_CONFIGURATION message
from the USB device, and should not be trusted, as it could be any
uint32_t value. Without this extra check, a potential buffer overflow
could subsequently occur in umb_in_len2mask().

Fix from Gerhard Roth, after coordination upstream with OpenBSD.

PR:		284904
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Approved by:	philip (mentor)
Sponsored by:	The FreeBSD Foundation
2025-05-29 15:07:52 +02:00
Alexander Ziaee
ca47411ea5
usb/if_mos.c: Fix incorrect SPDX ID
Fixes:			718cf2ccb9 (further adoption of SPDX)
MFC after:		3 days
Reviewed by:		carlavilla, imp, mhorne
Approved by:		carlavilla, mhorne (mentors)
Differential Revision: 	https://reviews.freebsd.org/D50374
2025-05-28 17:08:00 -04:00
Andriy Gapon
97c799661a dwc_otg_fdt: do not create and leak extra usbus child
dwc_otg_init() already takes care of creating the bus and setting up sc
to point to it.

Fixes:		518da7ace8
MFC after:	1 week
2025-05-19 12:08:43 +03:00
Warner Losh
6f8fbb2adf usb/quirks: Remove overly broad quirks
Now that we have a safe way to detect the vast majority of problems
with SYNCHRONIEZ CACHE, and since I have devices from many of these
vendors that work just fine (one of which will hang if you send it a
SYNCHROMIZE CACHE), I think these should all be reverted. The details
of when they were added are sketchy, the age of the devices in
question means these vendors have many generations of products after
and the general over-quirking of SYNCHRONIZE CACHE all point to just
removing them and adding back specific quirks should any need arise
after trying other means to debug.

The APPLE quirk was added because the autoquirk code would hang an ipod
with RockBox with a reset loop in the firmware. Since it was quirked, it
disabled the autoprobe and started working. Now that we've disabled the
autoprobe, we can remove it for sure.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49478
2025-05-07 15:36:55 -06:00
Warner Losh
d41600e59c usb: Make autoquirk code optional and opt out
There are significant problems with the current autoquirk code. This
results in quite a bit of bogus over-quirking.

Most commands don't do the proper "sense" dance to get the scsi sense
codes to see if the failures are interesting or not. A number of
'sleeps' are used to try to get around this, but they are racy. Rather
than fix these, use better hueristics just introduced to catch
SYNCHRONIZE CACHE problems, etc.

The test for getting max lun number was bogus. It would set this quirk
both on errors and when 0 was returned. It appears to be an attempt to
filter our REPORT LUNS error messages that are actually benign (we
ignore the errors properly). These errors are also only filtered
sometimes, so the test is unreliable. In addition, it's doing exactly
the same test that the umass driver is doing and recovering in the
same way. There's no value add here.

The TEST UNIT READY almost always fails because the drive is becoming
ready. The SENSE is usually UNIT ATTENTION 28/0 "Drive went from
not ready to ready" which is a normal condition.

The crazy looping to get INQUIRY data is odd. It shouldn't be needed
and rarely actually fails (I've not seen any, despite using this code
on some really sketchy drives). It should set a NO_INQUIRY quirk if it
fails, but instead sets a whole bunch of other, mostly unrelated
quirks if it fails.

The INQUIRY code also doesn't recognie RBC devices as well as DIRECT
devices. This means it fails on some older generations of cameras that
could actually benefit from this code.

The SYNCHRONIZE CACHE test is flawed. It will do the same failed test
over and over again in the event the command succeeds. There are
better ways to detect probelms.

The START STOP test is useless. It doesn't really help on any of the
devices I've tested on. It appears to be another result of the failure
to properly obtain the SENSE code and do appropriate things with it.

The PREVENT ALLOW test is useless. It is overwhelmingly used to
prevent an error message later. However, after it was added the error
message was changed to be informative and not scary. We properly
probe this at runtime on all the devices I tested on.

At the end of the tests, we try to clear the SENSE errors, but
do so imperfectly. Only one is cleared and we use INQUIRY rather
than the better TEST UNIT READY.

Attempted re-write to fix this caused additional problems as the reset
code was not at all robust (the same sequnce in umass / CAM worked when
we disabled this code).

In addition, the over-quirking and hair-triggered declaration that
SYNCHRONIE CACHE is bad would mean that some working drives that have
cache wouldn't flush the cache when WCE=1, leading to
corruption. Thankfully, nearly all (but not all) the USB sticks I have
default to WCE=0. One, however, did default to WCE=1 and some allow
setting it (despite the fact this is a bad idea on removeable
devices). However, for real disks attached via USB could be tripped up
over this.

When we do reset, some small subset of drives are now failing to
probe. There are reports on the FreeBSD forums that at least one ebook
reader no longer works.  A different ebook reads is affected as well
(one of my long-time friends has htis). in my collection, one USB memory
stick, one SD card reader and one USB to generic PATA adapter no longer
work. All of them are pretty obscure (you could literally say they were
found in my junk drawer), but are troubling. These problems appear to
disappear if we stop doing the auto-quirk code.

For all these reasons, I'm turning this off and will likely remove
it entirely in the future once the alternative SYNC CACHE code
has provent itself.

Differential Revision:	https://reviews.freebsd.org/D49477
Sponsored by:		Netflix
2025-05-07 15:36:55 -06:00
Warner Losh
ec3cc37bd9 umass: Bring in small fix from NetBSD's umass
When completing a request for UFI, don't fail the request on
non-zero asc/ascq values if we've done a request sense.

This idea is from umass.c 1.100 by mycroft. He used it to help
elminate the INQUIRY_SHORT quirk that we still have. However, it will
make little difference because we treat both return values the same
for CBI. And it appears we have (maybe bogusly) some devices that
specify this quirk that aren't CBI.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49475
2025-05-07 15:36:55 -06:00
Warner Losh
ff77f1ca5a umass: Fix a direct call to sc_transform
Call umass_std_transform instead of following the sc_transform member to
get the standard transforms now that has moved to
umass_std_transform. Pass NULL as the CCB so that we don't stomp on the
status that was just set (and allow that in std_transform).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49474
2025-05-07 15:36:55 -06:00
Warner Losh
43030e3445 umass: Be more consistent about how we fail bad commands
Elsewhere, if we fail a command, we use SCSI code ILLEGAL REQUEST/24/00,
but here we were using the CAM code for illegal request.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49473
2025-05-07 15:36:55 -06:00
Warner Losh
86de66a674 umass: Move INQUIRY and TEST UNIT READY quirks to umass_std_transform
Only doing a short inquiry and converting TUR to START STOP UNIT are the
same everywhere, so move those quirks to umass_std_transform.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49472
2025-05-07 15:36:55 -06:00
Warner Losh
b8e77c8b00 umass: Move common code into umass_std_transform
Move the length checks, and byte copying into umass_std_transform. The
copies are typically small and this simplifies the code a lot. Move
zeroing the buffer now to only when we change TEST UNIT READY to START
STOP.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49471
2025-05-07 15:36:54 -06:00
Warner Losh
bff8730c24 umass: make *_transform() return a bool
These are now boolean, so make them return a boolean.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49470
2025-05-07 15:36:54 -06:00
Warner Losh
49633d5d02 umass: Simplify umass_std_transform to eliminate fake success
Now that nothing returns (2) to fake the success of the command,
eliminate that magic number by eliminating the case.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49469
2025-05-07 15:36:54 -06:00
Warner Losh
a945c21a61 umass: Fail SYNCHRONIZE_CACHE for UFI
Just go ahead and fail SYNCHRONIZE_CACHE commands for UFI. This standard
doesn't have a cache to flush, and the upper layers (aka da) will notice sync
cache failed and won't send it again.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D49468
2025-05-07 15:36:54 -06:00
Warner Losh
db860eb348 umass: Document the ideal that it's better to fail bad commands
Generally, lying to the periph drivers about commands working is a bad
idea. They cannot get a global insight into the actual capacities of
the device when commands just work. There's good reason to intercept
bad commands at times, and to prevent the device from being exposed to
commands that, for example, hand the device. However, upper layer
periph drivers is the better place to cope with devices that don't
support the commands since it can make other inferences about the
device when it has wider knowledge.

But this represents a change in philosphy, so document that as
well. This shift happened for some commands a while ago. Many of the
quirks existed only to avoid whining errors on boot that were benign
and were a big burden. So da and cd slowly stopped the whining. Except
in cases where the command hangs the drive, we should limit new quirks
and avoid overly broad quirks (things work, but are less performant or
reliable, again mostly to avoid harmless errors that are no longer
printed).

Other sims will likely need some help with this.

Differential Revision:	https://reviews.freebsd.org/D49467
Sponsored by:		Netflix
2025-05-07 15:36:54 -06:00
Warner Losh
966c6be6c8 umass: fail synchronize_cache
When we know the umass device doesn't support synchronize cache
(either probed or hard quirk), fail the command w/o sending it to the
device. The da driver is the only driver that sends this command, and
since this filter was written has grown the ability to catch the
failure and never send the command again.

In an ideal world, we'd let the da driver work this out. However,
there's a lot of devices that hang when this command is sent in a way
that's impossible to detect other than a black list. There's also a
number that require a hard USB endpoint reset to recover, which the
autoquirk code takes care of. So umass has to act as a filter.

By failing this command, we're able to avoid upper level BIO_FLUSH
commands by tagging the underlying disk as not supporting that.

Differential Revision:	https://reviews.freebsd.org/D49466
Sponsored by:		Netflix
2025-05-07 15:36:54 -06:00
Warner Losh
668cef02ce umass: Move illegal opcode return to a function
Move illegal opcode completion of ccb to its own function. da can cope
with a number of different failures now (it didn't used to), so we
should return the unnsupported commands as illegal rather than faking
completion. This will allow da to, in the future, do more intelligent
things in response to these quirks. Other SIMs will need to do this
too.

Differential Revision:	https://reviews.freebsd.org/D49465
Sponsored by:		Netflix
2025-05-07 15:36:54 -06:00
Vladimir Kondratyev
fd6690e2d5 hidraw(4): Add additional hidraw input/output report ioctls
to Linux hidraw compatibility API.

Respective Linux commit f43d3870cafa made by Dean Camera message is:

Currently the hidraw module can only read and write feature HID reports on
demand, via dedicated ioctls. Input reports are read from the device through
the read() interface, while output reports are written through the write
interface().

This is insufficient; it is desirable in many situations to be able to read and
write input and output reports through the control interface to cover
additional scenarios:

  - Reading an input report by its report ID, to get initial state
  - Writing an input report, to set initial input state in the device
  - Reading an output report by its report ID, to obtain current state
  - Writing an output report by its report ID, out of band

This patch adds these missing ioctl requests to read and write the remaining
HID report types. Note that not all HID backends will neccesarily support this
(e.g. while the USB link layer supports setting Input reports, others may not).

FreeBSD native uhid(4) compatible API already has similar ioctls.

MFC after:	3 days
2025-04-27 12:07:35 +03:00
Kyle Evans
40ad87e958 usb: if_ure: stop touching the mbuf accounting on rxq insertion
uether_rxmbuf() assumes the uether_newbuf() model where the caller has
just set m_len to the entire size of the mbuf, and passed the final
size into uether_rxmbuf() for finalization.

In if_ure we're creating our own mbuf chains, and the accounting is all
already accurate.  uether_rxmbuf's logic won't work at all for a chain,
so let's add an assertion to that effect (but I think the other callers
were all OK).

This fixes a panic on my Windows DevKit when undergoing any kind of
network stress that surfaces after the bogus mbuf is injected into the
network stack (usually observed in `m_dup`).

markj and I had spent some time investigating it and decided there's
some kind of buffer underrun happening; the rx packet descriptor reports
a length longer than what's actually available.  We discard the rest of
the transfer, but then we end up fetching it in a subsequent transfer
and end up casting packet data to a `struct ure_rxpkt` incorrectly.  It
would be better to fix the underlying root cause, but this is a
reasonable mitigation in the interim.

Reviewed by:	markj
Fixes:	7d5522e16a ("A major update to the ure driver.")
Differential Revision:	https://reviews.freebsd.org/D43465
2025-04-20 13:28:12 -05:00
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