USB_QUIRK(4)
π USB_QUIRK(4) β the usb_quirk module, bestie edition π
okay so this is a page from the Kernel Interfaces Manual and it's all about usb_quirk, the USB quirks module. It's giving "fix the weird USB devices" energy and honestly? iconic. Let's get into it π«Ά
β¨ NAME β¨
usb_quirk β the USB quirks module π
πΈ SYNOPSIS πΈ
So there's two ways to get this module living its best life. To compile it into the kernel, drop this line into your kernel configuration file:
device usb
Or, if you'd rather load it at boot time, put this in loader.conf(5):
usb_quirk_load="YES"
no cap, that's it β¨
π¦ DESCRIPTION π¦
The usb_quirk module is the main character that lets you dynamically add and remove quirks for USB devices using usbconfig(8). literally so useful, fr fr π
π General quirks
UQ_AUDIO_SWAP_LRβ swap left and right channels πUQ_AU_INP_ASYNCβ input is async despite claim of adaptiveUQ_AU_NO_FRACβ do not adjust for fractional samplesUQ_AU_NO_XUβ audio device has broken extension unit πUQ_AU_VENDOR_CLASSβ audio device uses vendor class to identify itselfUQ_AU_SET_SPDIF_CM6206β audio device needs special programming to enable S/PDIF audio outputUQ_BAD_ADCβ bad audio spec version numberUQ_BAD_AUDIOβ device claims audio class, but is not πUQ_BROKEN_BIDIRβ printer has broken bidir modeUQ_BUS_POWEREDβ device is bus powered, despite claimUQ_HID_IGNOREβ device should be ignored by hid classUQ_KBD_IGNOREβ device should be ignored by kbd classUQ_KBD_BOOTPROTOβ device should set the boot protocolUQ_UMS_IGNOREβ device should be ignored by ums classUQ_MS_BAD_CLASSβ does not identify properlyUQ_MS_LEADING_BYTEβ mouse sends an unknown leading byteUQ_MS_REVZβ mouse has Z-axis reversedUQ_MS_VENDOR_BTNβ mouse has buttons in vendor usage pageUQ_NO_STRINGSβ string descriptors are brokenUQ_POWER_CLAIMβ hub lies about power status πUQ_SPUR_BUT_UPβ spurious mouse button up eventsUQ_SWAP_UNICODEβ has some Unicode strings swappedUQ_CFG_INDEX_1β select configuration index 1 by defaultUQ_CFG_INDEX_2β select configuration index 2 by defaultUQ_CFG_INDEX_3β select configuration index 3 by defaultUQ_CFG_INDEX_4β select configuration index 4 by defaultUQ_CFG_INDEX_0β select configuration index 0 by defaultUQ_ASSUME_CM_OVER_DATAβ assume cm over data featureUQ_IGNORE_CDC_CMβ ignore cm descriptorUQ_WMT_IGNOREβ device should be ignored by wmt driver
π USB Mass Storage quirks
UQ_MSC_NO_TEST_UNIT_READYβ send start/stop instead of TURUQ_MSC_NO_RS_CLEAR_UAβ does not reset Unit Att.UQ_MSC_NO_START_STOPβ does not support start/stopUQ_MSC_NO_GETMAXLUNβ does not support get max LUNUQ_MSC_NO_INQUIRYβ fake generic inq responseUQ_MSC_NO_INQUIRY_EVPDβ does not support inq EVPDUQ_MSC_NO_SYNC_CACHEβ does not support sync cacheUQ_MSC_SHUTTLE_INITβ requires Shuttle init sequenceUQ_MSC_ALT_IFACE_1β switch to alternate interface 1UQ_MSC_FLOPPY_SPEEDβ does floppy speeds (20kb/s) πUQ_MSC_IGNORE_RESIDUEβ gets residue wrongUQ_MSC_WRONG_CSWSIGβ uses wrong CSW signatureUQ_MSC_RBC_PAD_TO_12β pad RBC requests to 12 bytesUQ_MSC_READ_CAP_OFFBY1β reports sector count, not max sec.UQ_MSC_FORCE_SHORT_INQβ does not support full inq.UQ_MSC_FORCE_WIRE_BBBβ force BBB wire protocolUQ_MSC_FORCE_WIRE_CBIβ force CBI wire protocolUQ_MSC_FORCE_WIRE_CBI_Iβ force CBI with int. wire protocolUQ_MSC_FORCE_PROTO_SCSIβ force SCSI command protocolUQ_MSC_FORCE_PROTO_ATAPIβ force ATAPI command protocolUQ_MSC_FORCE_PROTO_UFIβ force UFI command protocolUQ_MSC_FORCE_PROTO_RBCβ force RBC command protocol
π§ 3G Datacard (u3g) quirks
UQ_MSC_EJECT_HUAWEIβ ejects after Huawei USB commandUQ_MSC_EJECT_SIERRAβ ejects after Sierra USB commandUQ_MSC_EJECT_SCSIEJECTβ ejects after SCSI eject command0x1b0000000200UQ_MSC_EJECT_REZEROβ ejects after SCSI rezero command0x010000000000UQ_MSC_EJECT_ZTESTORβ ejects after ZTE SCSI command0x850101011801010101010000UQ_MSC_EJECT_CMOTECHβ ejects after C-motech SCSI command0xff52444556434847UQ_MSC_EJECT_WAITβ wait for the device to ejectUQ_MSC_EJECT_SAEL_M460β ejects after Sael USB commandsUQ_MSC_EJECT_HUAWEISCSIβ ejects after Huawei SCSI command0x11060000000000000000000000000000UQ_MSC_EJECT_TCTβ ejects after TCT SCSI command0x06f504025270UQ_MSC_DYMO_EJECTβ ejects after HID command0x1b5a01
bestie, for the complete list of supported quirks, look at/sys/dev/usb/quirk/usb_quirk.hor runusbconfig dump_quirk_namesπ
π LOADER TUNABLE π
There's one tunable here, and you can set it at the loader(8) prompt before booting the kernel, or just store it in loader.conf(5). easy β¨
hw.usb.quirk.%dβ the value is a string, and its format is literally:
"VendorId ProductId LowRevision HighRevision UQ_QUIRK,..."
This installs the quirks UQ_QUIRK,... for all USB devices matching VendorId and ProductId which have a hardware revision between and including LowRevision and HighRevision π«Ά
VendorId, ProductId, LowRevision and HighRevision are all 16 bits numbers which can be decimal or hexadecimal based, no cap.
A maximum of 100 variables hw.usb.quirk.0, .1, ..., .99 can be defined.
If a matching entry is found in the kernel's internal quirks table, it is replaced by the new definition. π
Else a new entry is created given that the quirk table is not full.
The kernel iterates over the hw.usb.quirk.N variables starting at N = 0 and stops at N = 99 or the first non-existing one. periodt.
π₯ EXAMPLES π₯
So after attaching a u3g device which appears as a USB device on ugen0.3:
usbconfig -d ugen0.3 add_quirk UQ_MSC_EJECT_WAIT
Enable a Holtec/Keep Out F85 gaming keyboard on ugen1.4:
usbconfig -d ugen1.4 add_quirk UQ_KBD_BOOTPROTO
And to install a quirk at boot time, place one or several lines like the following in loader.conf(5):
hw.usb.quirk.0="0x04d9 0xfa50 0 0xffff UQ_KBD_IGNORE"
slay. that's the whole vibe check π
π SEE ALSO π
π HISTORY π
The usb_quirk module appeared in FreeBSD 8.0, and was written by Hans Petter Selasky <hselasky@FreeBSD.org>. This manual page was written by Nick Hibma <n_hibma@FreeBSD.org>. iconic authors, honestly πβ¨
so yeah, that's the whole page! this version is from Debian, dated August 19, 2017 β catch you in the group chat, bestie ππ¦
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2010 AnyWi Technologies
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms