Created attachment 161251 [details] usb_quirk The new USB 2 stack allows dynamic additions to the quirk table, but not at boot time. This patch resurrects the idea of bug #122819 in which Maurice Castro implemented dynamic quirks in 2008 for the USB 1 stack, allowing quirks to be defined through the environment. It allows the modification of the quirks table through the environment in the USB 2 stack. So the devices plugged in at boot time can be correctly quirk'ed even if they are not statically defined in usb_quirk.c. One can define several variables in loader.conf, like this one: usb.quirk.0="0x04d9 0xfa50 0 0xffff UQ_KBD_IGNORE" The value format is "VendorId ProductId LowRevision HighRevision Quirk1,...,QuirkN". Quirk1,...,QuirkN are the quirks names as defined in the usb_quirk_str array, seprated by commas without space. One can have usb.quirk.1, .2, ..., .99 if there is enough space in the quirks table... If a matching entry is found in the quirk_usb.c's quirk table, it is replaced by the environment defined one. If not, a new entry is created (while the table is not full.) To keep it simple, it iterates over usb.quirk.N (N = 0; N < 100) variables and stop after the first non-existent one.
Do you have a patch for the usb_quirk.3 manual page?
Created attachment 161317 [details] usb_quirk.4 patch Sure. usb_quirk.4 patch just added.
A commit references this bug: Author: hselasky Date: Thu Sep 24 17:37:31 UTC 2015 New revision: 288180 URL: https://svnweb.freebsd.org/changeset/base/288180 Log: Implement support for reading USB quirks from the kernel environment. Refer to the usb_quirk(4) manual page for more details on how to use this new feature. Submitted by: Maxime Soule <btik-fbsd@scoubidou.com> PR: 203249 MFC after: 2 weeks Changes: head/share/man/man4/usb_quirk.4 head/sys/dev/usb/quirk/usb_quirk.c
Hi, I made some small modifications to your patch before committing. Can you verify they are OK? "hw.usb.quirk" instead of "usb.quirk" and some minor code and language cleanup in the manual page. Thank you! --HPS
Hi, It works, thanks a lot! In usb_quirk.4, shouldn't we say: ...for all USB devices matching VendorId, ProductId and *have* a hardware... ? Max.
A commit references this bug: Author: hselasky Date: Sat Sep 26 16:48:25 UTC 2015 New revision: 288273 URL: https://svnweb.freebsd.org/changeset/base/288273 Log: Fix spelling. Submitted by: Maxime Soule <btik-fbsd@scoubidou.com> PR: 203249 MFC after: 2 weeks Changes: head/share/man/man4/usb_quirk.4
A commit references this bug: Author: hselasky Date: Thu Oct 8 07:17:36 UTC 2015 New revision: 289007 URL: https://svnweb.freebsd.org/changeset/base/289007 Log: MFC r288180: Implement support for reading USB quirks from the kernel environment. Refer to the usb_quirk(4) manual page for more details on how to use this new feature. Submitted by: Maxime Soule <btik-fbsd@scoubidou.com> PR: 203249 Changes: _U stable/10/ stable/10/share/man/man4/usb_quirk.4 stable/10/sys/dev/usb/quirk/usb_quirk.c
A commit references this bug: Author: hselasky Date: Thu Oct 8 07:19:58 UTC 2015 New revision: 289009 URL: https://svnweb.freebsd.org/changeset/base/289009 Log: MFC r288180: Implement support for reading USB quirks from the kernel environment. Refer to the usb_quirk(4) manual page for more details on how to use this new feature. Submitted by: Maxime Soule <btik-fbsd@scoubidou.com> PR: 203249 Changes: _U stable/9/share/ _U stable/9/share/man/ _U stable/9/share/man/man4/ stable/9/share/man/man4/usb_quirk.4 _U stable/9/sys/ _U stable/9/sys/dev/ stable/9/sys/dev/usb/quirk/usb_quirk.c
A commit references this bug: Author: hselasky Date: Tue Oct 13 08:09:17 UTC 2015 New revision: 289213 URL: https://svnweb.freebsd.org/changeset/base/289213 Log: MFC r288273: Fix spelling. PR: 203249 Changes: _U stable/10/ stable/10/share/man/man4/usb_quirk.4
A commit references this bug: Author: hselasky Date: Tue Oct 13 08:10:21 UTC 2015 New revision: 289214 URL: https://svnweb.freebsd.org/changeset/base/289214 Log: MFC r288273: Fix spelling. PR: 203249 Changes: _U stable/9/share/ _U stable/9/share/man/ _U stable/9/share/man/man4/ stable/9/share/man/man4/usb_quirk.4