Re: Patch to allow dynamic USB quirks at boot
Nearly all the PCI drivers have tables of vendor/device IDs. They all have slightly different forms, and none of them use a common macro / format like USB. So each driver needs a line or two to describe the table so we can extract the data from the .ko. Some drivers don't have lists, and those will need to be dealt with on a case-by-case basis. I also have another set of work to do PNP translations at run time. The bus will lie about the PNP IDs of the device so that drivers can treat new hardware just like old hardware. The obvious (and wrong) approach of forcing drivers to "take" devices only works for the most trivial drivers as nearly all of them have a table that tells about the "quirks" of the hardware since not all of that can be determined from registers alone. Warner On Tue, Sep 22, 2015 at 5:38 PM, Mehmet Erol Sanliturk < m.e.sanlit...@gmail.com> wrote: > > > On Tue, Sep 22, 2015 at 2:38 PM, Warner Loshwrote: > >> I need help with PCI driver marking. Grab my patches and we can talk. >> >> Basically, it marks all the .ko modules in a similar way that we do >> inter-module >> dependencies with plug and play info. kldxref then takes this data and >> stuffs >> it in loader.hints. I also need to write something that will parse this >> data and >> either generate a devd.conf file (easy to do from kldxref sources) or >> queues >> the load drive in the kernel (kinda hard). Bonus points for similar code >> in >> /boot/loader for any storage device that’s found. >> >> Warner >> >> >> > On Sep 22, 2015, at 1:12 AM, Mehmet Erol Sanliturk < >> m.e.sanlit...@gmail.com> wrote: >> > >> > >> > >> > On Mon, Sep 21, 2015 at 11:58 PM, Hans Petter Selasky >> wrote: >> > On 09/22/15 00:58, Mehmet Erol Sanliturk wrote: >> > On Mon, Sep 21, 2015 at 2:16 PM, Maxime Soulé >> > wrote: >> > >> > One of my wishes is to move ALL of the device definition information >> for ( >> > NIC , USB , and other devices ) into files where for each device ( a >> unique >> > file to dedicated itself containing information presently defined as >> preset >> > in internal arrays with one additional information ( at least ) which >> > driver will be used for the device ) will be prepared . >> > >> > >> > Hi Mehmet, >> > >> > Warner Losh is working on this currently, CC'ed. See: >> > >> > https://reviews.freebsd.org/D3458 >> > >> > Maybe you want to help out testing? >> > >> > --HPS >> > >> > >> > >> > If I can help in any way , I will do it . >> > >> > >> > Mehmet Erol Sanliturk >> > >> > >> >> > > > What does "PCI driver marking" mean ? > > > Mehmet Erol Sanliturk > > > > ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
On 09/22/15 00:58, Mehmet Erol Sanliturk wrote: On Mon, Sep 21, 2015 at 2:16 PM, Maxime Souléwrote: One of my wishes is to move ALL of the device definition information for ( NIC , USB , and other devices ) into files where for each device ( a unique file to dedicated itself containing information presently defined as preset in internal arrays with one additional information ( at least ) which driver will be used for the device ) will be prepared . Hi Mehmet, Warner Losh is working on this currently, CC'ed. See: https://reviews.freebsd.org/D3458 Maybe you want to help out testing? --HPS ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
On Mon, Sep 21, 2015 at 11:58 PM, Hans Petter Selaskywrote: > On 09/22/15 00:58, Mehmet Erol Sanliturk wrote: > >> On Mon, Sep 21, 2015 at 2:16 PM, Maxime Soulé >> wrote: >> >> One of my wishes is to move ALL of the device definition information for ( >> NIC , USB , and other devices ) into files where for each device ( a >> unique >> file to dedicated itself containing information presently defined as >> preset >> in internal arrays with one additional information ( at least ) which >> driver will be used for the device ) will be prepared . >> >> > Hi Mehmet, > > Warner Losh is working on this currently, CC'ed. See: > > https://reviews.freebsd.org/D3458 > > Maybe you want to help out testing? > > --HPS > If I can help in any way , I will do it . Mehmet Erol Sanliturk ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
On Tue, Sep 22, 2015 at 2:38 PM, Warner Loshwrote: > I need help with PCI driver marking. Grab my patches and we can talk. > > Basically, it marks all the .ko modules in a similar way that we do > inter-module > dependencies with plug and play info. kldxref then takes this data and > stuffs > it in loader.hints. I also need to write something that will parse this > data and > either generate a devd.conf file (easy to do from kldxref sources) or > queues > the load drive in the kernel (kinda hard). Bonus points for similar code in > /boot/loader for any storage device that’s found. > > Warner > > > > On Sep 22, 2015, at 1:12 AM, Mehmet Erol Sanliturk < > m.e.sanlit...@gmail.com> wrote: > > > > > > > > On Mon, Sep 21, 2015 at 11:58 PM, Hans Petter Selasky > wrote: > > On 09/22/15 00:58, Mehmet Erol Sanliturk wrote: > > On Mon, Sep 21, 2015 at 2:16 PM, Maxime Soulé > > wrote: > > > > One of my wishes is to move ALL of the device definition information for > ( > > NIC , USB , and other devices ) into files where for each device ( a > unique > > file to dedicated itself containing information presently defined as > preset > > in internal arrays with one additional information ( at least ) which > > driver will be used for the device ) will be prepared . > > > > > > Hi Mehmet, > > > > Warner Losh is working on this currently, CC'ed. See: > > > > https://reviews.freebsd.org/D3458 > > > > Maybe you want to help out testing? > > > > --HPS > > > > > > > > If I can help in any way , I will do it . > > > > > > Mehmet Erol Sanliturk > > > > > > What does "PCI driver marking" mean ? Mehmet Erol Sanliturk ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
On 09/20/15 23:42, Maxime Soulé wrote: Hi all, I own a X9800 Tecknet mouse with 3 side buttons. When I plug it in, a ukbd device appears handling each 3 buttons with key modifiers Control, Shift and Alt, with one device uhid. As I wanted to see these buttons as buttons under X and not as key modifiers, I first thought about using USB quirk UQ_KBD_IGNORE and devd to hack it. I succeeded (more or less) but devd starts to late during boot to be able to apply the quirk when the mouse is already plugged in, so I needed to always plug the mouse in once the system has booted... Not very cool... When the USB quirk UQ_KBD_IGNORE is applied, the ukbd device does not appear, but two uhid devices appear, including the one dedicated to the "keyboard" feature of the mouse. During my searches on the net, I found the Bug 122819 in which Maurice Castro implemented dynamic quirks in 2008, allowing quirks to be defined dynamically and also through the environment. Unfortunately, this code was for the old USB 1 stack. Indeed, the new USB 2 stack allows dynamic additions to the quirk table, but not at boot time (or I did not find the way). So, I made a patch, with the help of Maurice one, allowing the modification of the quirks table through the environment: http://scoubidou.com/usb_quirk/usb_quirk.diff Hi, Can you make this patch into a PR at FreeBSD's bugzilla and I will process it. Yes, I've been thinking about this feature, and you just implemented it! Thank you :-) Now in my loader.conf, I have: usb.quirk.0="0x04d9 0xfa50 0 0x UQ_KBD_IGNORE" The value format is "VendorId ProductId LowRevision HighRevision Quirk1,...,QuirkN". One can have usb.quirk.1, .2, ..., .99 if there is enough space in the quirks table... In a devd conf file: notify 1000 { match "system" "DEVFS"; match "subsystem" "CDEV"; match "type" "CREATE"; match "cdev" "uhid[0-9]+"; action "/usr/bin/usbhidctl -f /dev/$cdev \ Keyboard:Keyboard_LeftShift \ Keyboard:Keyboard_LeftAlt \ Keyboard:Keyboard_LeftControl > /dev/null 2>&1 \ && DISPLAY=:0.0 /usr/bin/usbhidaction -f $cdev \ -c /usr/local/etc/tecknet-mouse-usbhidaction.conf \ -p /var/run/usbhidaction.$cdev.pid"; }; The usbhidctl is to check that we handle the right uhid device, the one with Keyboard_LeftShift, Keyboard_LeftAlt AND Keyboard_LeftControl features. Then, usbhidaction daemon can be launched to handle all the "keyboard" events. And the contents of my /usr/local/etc/tecknet-mouse-usbhidaction.conf file: Keyboard:Keyboard_LeftShift1 0 /usr/local/bin/xdotool mousedown 8 Keyboard:Keyboard_LeftShift0 1 /usr/local/bin/xdotool mouseup 8 Keyboard:Keyboard_LeftAlt1 0 /usr/local/bin/xdotool mousedown 9 Keyboard:Keyboard_LeftAlt0 1 /usr/local/bin/xdotool mouseup 9 Keyboard:Keyboard_LeftControl1 0 /usr/local/bin/xdotool mousedown 6 Keyboard:Keyboard_LeftControl0 1 /usr/local/bin/xdotool mouseup 6 to translate "keyboard" actions to buttons clicks thanks to xdotool (from ports). And all works like a charm :) Finally, I have two questions: First, is there a way to link the uhid device with the USB vendor/product ID in devd? Without doing it using a script and parsing devinfo output of course... Second, when I unplug the mouse, devd did not receive the "DESTROY" event for the uhid device, until the usbhidaction daemon is killed. But I would have liked to be able to kill usbhidaction daemon automatically when the mouse is unplugged using devd... With USB vendor/product details available at uhid level, I could have done it when the corresponding ugen device is DETACHed by caching this information... There is a chicken-egg situation there. If your application using /dev/uhidX doesn't close its device upon receiving a read/poll error, you might not receive the detach event, depending on which kernel you use, because the kernel waits for /dev/uhidX to be detached/closed before generating the destruction event. You might want to listen to some other events. See how /usr/local/etc/devd/webcamd.conf is doing it from /usr/ports/multimedia/webcamd . --HPS Best regards, Max. ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org" ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
On Mon, Sep 21, 2015 at 2:16 PM, Maxime Souléwrote: > Le 21.09.2015 08:51, Hans Petter Selasky a écrit : > > On 09/20/15 23:42, Maxime Soulé wrote: > >> Hi all, > >> > >> I own a X9800 Tecknet mouse with 3 side buttons. When I plug it in, a > >> ukbd device appears handling each 3 buttons with key modifiers Control, > >> Shift and Alt, with one device uhid. > >> > >> As I wanted to see these buttons as buttons under X and not as key > >> modifiers, I first thought about using USB quirk UQ_KBD_IGNORE and devd > >> to hack it. I succeeded (more or less) but devd starts to late during > >> boot to be able to apply the quirk when the mouse is already plugged in, > >> so I needed to always plug the mouse in once the system has booted... > >> Not very cool... > >> > >> When the USB quirk UQ_KBD_IGNORE is applied, the ukbd device does not > >> appear, but two uhid devices appear, including the one dedicated to the > >> "keyboard" feature of the mouse. > >> > >> During my searches on the net, I found the Bug 122819 in which Maurice > >> Castro implemented dynamic quirks in 2008, allowing quirks to be defined > >> dynamically and also through the environment. Unfortunately, this code > >> was for the old USB 1 stack. > >> > >> Indeed, the new USB 2 stack allows dynamic additions to the quirk table, > >> but not at boot time (or I did not find the way). > >> > >> So, I made a patch, with the help of Maurice one, allowing the > >> modification of the quirks table through the environment: > >> http://scoubidou.com/usb_quirk/usb_quirk.diff > > > > Hi, > > > > Can you make this patch into a PR at FreeBSD's bugzilla and I will > > process it. Yes, I've been thinking about this feature, and you just > > implemented it! Thank you :-) > > Hi, > > Done, bug 203249. > > > > >> > >> Now in my loader.conf, I have: > >> > >> usb.quirk.0="0x04d9 0xfa50 0 0x UQ_KBD_IGNORE" > >> > >> The value format is "VendorId ProductId LowRevision HighRevision > >> Quirk1,...,QuirkN". > >> One can have usb.quirk.1, .2, ..., .99 if there is enough space in the > >> quirks table... > >> > >> In a devd conf file: > >> > >> notify 1000 { > >> match "system" "DEVFS"; > >> match "subsystem" "CDEV"; > >> match "type" "CREATE"; > >> match "cdev" "uhid[0-9]+"; > >> > >> action "/usr/bin/usbhidctl -f /dev/$cdev \ > >> Keyboard:Keyboard_LeftShift \ > >> Keyboard:Keyboard_LeftAlt \ > >> Keyboard:Keyboard_LeftControl > /dev/null 2>&1 \ > >> && DISPLAY=:0.0 /usr/bin/usbhidaction -f $cdev \ > >> -c /usr/local/etc/tecknet-mouse-usbhidaction.conf \ > >> -p /var/run/usbhidaction.$cdev.pid"; > >> }; > >> > >> The usbhidctl is to check that we handle the right uhid device, the one > >> with Keyboard_LeftShift, Keyboard_LeftAlt AND Keyboard_LeftControl > >> features. Then, usbhidaction daemon can be launched to handle all the > >> "keyboard" events. > >> > >> And the contents of my /usr/local/etc/tecknet-mouse-usbhidaction.conf > >> file: > >> > >> Keyboard:Keyboard_LeftShift1 0 /usr/local/bin/xdotool mousedown 8 > >> Keyboard:Keyboard_LeftShift0 1 /usr/local/bin/xdotool mouseup 8 > >> Keyboard:Keyboard_LeftAlt1 0 /usr/local/bin/xdotool mousedown 9 > >> Keyboard:Keyboard_LeftAlt0 1 /usr/local/bin/xdotool mouseup 9 > >> Keyboard:Keyboard_LeftControl1 0 /usr/local/bin/xdotool mousedown 6 > >> Keyboard:Keyboard_LeftControl0 1 /usr/local/bin/xdotool mouseup 6 > >> > >> to translate "keyboard" actions to buttons clicks thanks to xdotool > >> (from ports). > >> > >> And all works like a charm :) > >> > >> Finally, I have two questions: > >> > >> First, is there a way to link the uhid device with the USB > >> vendor/product ID in devd? Without doing it using a script and parsing > >> devinfo output of course... > >> > >> Second, when I unplug the mouse, devd did not receive the "DESTROY" > >> event for the uhid device, until the usbhidaction daemon is killed. But > >> I would have liked to be able to kill usbhidaction daemon automatically > >> when the mouse is unplugged using devd... With USB vendor/product > >> details available at uhid level, I could have done it when the > >> corresponding ugen device is DETACHed by caching this information... > > > > There is a chicken-egg situation there. If your application using > > /dev/uhidX doesn't close its device upon receiving a read/poll error, > > you might not receive the detach event, depending on which kernel you > > use, because the kernel waits for /dev/uhidX to be detached/closed > > before generating the destruction event. > > > > You might want to listen to some other events. See how > > /usr/local/etc/devd/webcamd.conf is doing it from > > /usr/ports/multimedia/webcamd . > > > > --HPS > > I found a solution using "attach" instead of "notice" in my devd conf > file. Really devd rocks! :) > > attach 1000 { >device-name "uhid[0-9]+"; >
[Bug 203249] [patch] Patch to allow dynamic USB quirks at boot (USB 2 stack)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203249 Hans Petter Selaskychanged: What|Removed |Added CC||hsela...@freebsd.org Assignee|freebsd-usb@FreeBSD.org |hsela...@freebsd.org -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
[Bug 203249] [patch] Patch to allow dynamic USB quirks at boot (USB 2 stack)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203249 Bug ID: 203249 Summary: [patch] Patch to allow dynamic USB quirks at boot (USB 2 stack) Product: Base System Version: 10.2-RELEASE Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Only Me Priority: --- Component: usb Assignee: freebsd-usb@FreeBSD.org Reporter: btik-f...@scoubidou.com Keywords: patch Created attachment 161251 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=161251=edit 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 0x 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. -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Patch to allow dynamic USB quirks at boot
Le 21.09.2015 08:51, Hans Petter Selasky a écrit : > On 09/20/15 23:42, Maxime Soulé wrote: >> Hi all, >> >> I own a X9800 Tecknet mouse with 3 side buttons. When I plug it in, a >> ukbd device appears handling each 3 buttons with key modifiers Control, >> Shift and Alt, with one device uhid. >> >> As I wanted to see these buttons as buttons under X and not as key >> modifiers, I first thought about using USB quirk UQ_KBD_IGNORE and devd >> to hack it. I succeeded (more or less) but devd starts to late during >> boot to be able to apply the quirk when the mouse is already plugged in, >> so I needed to always plug the mouse in once the system has booted... >> Not very cool... >> >> When the USB quirk UQ_KBD_IGNORE is applied, the ukbd device does not >> appear, but two uhid devices appear, including the one dedicated to the >> "keyboard" feature of the mouse. >> >> During my searches on the net, I found the Bug 122819 in which Maurice >> Castro implemented dynamic quirks in 2008, allowing quirks to be defined >> dynamically and also through the environment. Unfortunately, this code >> was for the old USB 1 stack. >> >> Indeed, the new USB 2 stack allows dynamic additions to the quirk table, >> but not at boot time (or I did not find the way). >> >> So, I made a patch, with the help of Maurice one, allowing the >> modification of the quirks table through the environment: >> http://scoubidou.com/usb_quirk/usb_quirk.diff > > Hi, > > Can you make this patch into a PR at FreeBSD's bugzilla and I will > process it. Yes, I've been thinking about this feature, and you just > implemented it! Thank you :-) Hi, Done, bug 203249. > >> >> Now in my loader.conf, I have: >> >> usb.quirk.0="0x04d9 0xfa50 0 0x UQ_KBD_IGNORE" >> >> The value format is "VendorId ProductId LowRevision HighRevision >> Quirk1,...,QuirkN". >> One can have usb.quirk.1, .2, ..., .99 if there is enough space in the >> quirks table... >> >> In a devd conf file: >> >> notify 1000 { >> match "system" "DEVFS"; >> match "subsystem" "CDEV"; >> match "type" "CREATE"; >> match "cdev" "uhid[0-9]+"; >> >> action "/usr/bin/usbhidctl -f /dev/$cdev \ >> Keyboard:Keyboard_LeftShift \ >> Keyboard:Keyboard_LeftAlt \ >> Keyboard:Keyboard_LeftControl > /dev/null 2>&1 \ >> && DISPLAY=:0.0 /usr/bin/usbhidaction -f $cdev \ >> -c /usr/local/etc/tecknet-mouse-usbhidaction.conf \ >> -p /var/run/usbhidaction.$cdev.pid"; >> }; >> >> The usbhidctl is to check that we handle the right uhid device, the one >> with Keyboard_LeftShift, Keyboard_LeftAlt AND Keyboard_LeftControl >> features. Then, usbhidaction daemon can be launched to handle all the >> "keyboard" events. >> >> And the contents of my /usr/local/etc/tecknet-mouse-usbhidaction.conf >> file: >> >> Keyboard:Keyboard_LeftShift1 0 /usr/local/bin/xdotool mousedown 8 >> Keyboard:Keyboard_LeftShift0 1 /usr/local/bin/xdotool mouseup 8 >> Keyboard:Keyboard_LeftAlt1 0 /usr/local/bin/xdotool mousedown 9 >> Keyboard:Keyboard_LeftAlt0 1 /usr/local/bin/xdotool mouseup 9 >> Keyboard:Keyboard_LeftControl1 0 /usr/local/bin/xdotool mousedown 6 >> Keyboard:Keyboard_LeftControl0 1 /usr/local/bin/xdotool mouseup 6 >> >> to translate "keyboard" actions to buttons clicks thanks to xdotool >> (from ports). >> >> And all works like a charm :) >> >> Finally, I have two questions: >> >> First, is there a way to link the uhid device with the USB >> vendor/product ID in devd? Without doing it using a script and parsing >> devinfo output of course... >> >> Second, when I unplug the mouse, devd did not receive the "DESTROY" >> event for the uhid device, until the usbhidaction daemon is killed. But >> I would have liked to be able to kill usbhidaction daemon automatically >> when the mouse is unplugged using devd... With USB vendor/product >> details available at uhid level, I could have done it when the >> corresponding ugen device is DETACHed by caching this information... > > There is a chicken-egg situation there. If your application using > /dev/uhidX doesn't close its device upon receiving a read/poll error, > you might not receive the detach event, depending on which kernel you > use, because the kernel waits for /dev/uhidX to be detached/closed > before generating the destruction event. > > You might want to listen to some other events. See how > /usr/local/etc/devd/webcamd.conf is doing it from > /usr/ports/multimedia/webcamd . > > --HPS I found a solution using "attach" instead of "notice" in my devd conf file. Really devd rocks! :) attach 1000 { device-name "uhid[0-9]+"; match "vendor" "0x04d9"; match "product" "0xfa50"; match "intsubclass" "0x01"; match "intprotocol" "0x01"; action "DISPLAY=:0.0 /usr/bin/usbhidaction -f $device-name \ -c /usr/local/etc/tecknet-mouse-usbhidaction.conf \ -p
Patch to allow dynamic USB quirks at boot
Hi all, I own a X9800 Tecknet mouse with 3 side buttons. When I plug it in, a ukbd device appears handling each 3 buttons with key modifiers Control, Shift and Alt, with one device uhid. As I wanted to see these buttons as buttons under X and not as key modifiers, I first thought about using USB quirk UQ_KBD_IGNORE and devd to hack it. I succeeded (more or less) but devd starts to late during boot to be able to apply the quirk when the mouse is already plugged in, so I needed to always plug the mouse in once the system has booted... Not very cool... When the USB quirk UQ_KBD_IGNORE is applied, the ukbd device does not appear, but two uhid devices appear, including the one dedicated to the "keyboard" feature of the mouse. During my searches on the net, I found the Bug 122819 in which Maurice Castro implemented dynamic quirks in 2008, allowing quirks to be defined dynamically and also through the environment. Unfortunately, this code was for the old USB 1 stack. Indeed, the new USB 2 stack allows dynamic additions to the quirk table, but not at boot time (or I did not find the way). So, I made a patch, with the help of Maurice one, allowing the modification of the quirks table through the environment: http://scoubidou.com/usb_quirk/usb_quirk.diff Now in my loader.conf, I have: usb.quirk.0="0x04d9 0xfa50 0 0x UQ_KBD_IGNORE" The value format is "VendorId ProductId LowRevision HighRevision Quirk1,...,QuirkN". One can have usb.quirk.1, .2, ..., .99 if there is enough space in the quirks table... In a devd conf file: notify 1000 { match "system" "DEVFS"; match "subsystem" "CDEV"; match "type" "CREATE"; match "cdev" "uhid[0-9]+"; action "/usr/bin/usbhidctl -f /dev/$cdev \ Keyboard:Keyboard_LeftShift \ Keyboard:Keyboard_LeftAlt \ Keyboard:Keyboard_LeftControl > /dev/null 2>&1 \ && DISPLAY=:0.0 /usr/bin/usbhidaction -f $cdev \ -c /usr/local/etc/tecknet-mouse-usbhidaction.conf \ -p /var/run/usbhidaction.$cdev.pid"; }; The usbhidctl is to check that we handle the right uhid device, the one with Keyboard_LeftShift, Keyboard_LeftAlt AND Keyboard_LeftControl features. Then, usbhidaction daemon can be launched to handle all the "keyboard" events. And the contents of my /usr/local/etc/tecknet-mouse-usbhidaction.conf file: Keyboard:Keyboard_LeftShift1 0 /usr/local/bin/xdotool mousedown 8 Keyboard:Keyboard_LeftShift0 1 /usr/local/bin/xdotool mouseup 8 Keyboard:Keyboard_LeftAlt1 0 /usr/local/bin/xdotool mousedown 9 Keyboard:Keyboard_LeftAlt0 1 /usr/local/bin/xdotool mouseup 9 Keyboard:Keyboard_LeftControl1 0 /usr/local/bin/xdotool mousedown 6 Keyboard:Keyboard_LeftControl0 1 /usr/local/bin/xdotool mouseup 6 to translate "keyboard" actions to buttons clicks thanks to xdotool (from ports). And all works like a charm :) Finally, I have two questions: First, is there a way to link the uhid device with the USB vendor/product ID in devd? Without doing it using a script and parsing devinfo output of course... Second, when I unplug the mouse, devd did not receive the "DESTROY" event for the uhid device, until the usbhidaction daemon is killed. But I would have liked to be able to kill usbhidaction daemon automatically when the mouse is unplugged using devd... With USB vendor/product details available at uhid level, I could have done it when the corresponding ugen device is DETACHed by caching this information... Best regards, Max. ___ freebsd-usb@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"