Add support for command line arguments on hid2hci tool
Subsystems (2)
PATCH 1/3 Add support for command line arguments on hid2hci tool
This means that hid2hci won't have to run
on every bootup for every machine with bluetooth installed. It instead
gets ran on demand if a
product that is called out from the dbus rules file contains the
correct attributes and/or VID/PID.
It also makes it easier for users to manually test new VID/PID
combinations that may or may not
be yet supported by bluez.
--- scripts/Makefile.am | 12 ++- scripts/bluetooth.default | 3 - scripts/bluetooth.init | 7 -- scripts/hid2hci.rules | 38 ++++++++++ tools/hid2hci.c | 179 +++++++++++++++++++------------------------- 5 files changed, 124 insertions(+), 115 deletions(-) create mode 100644 scripts/hid2hci.rules
Attaching patch as Exchange would mangle otherwise.
Thanks,
Signature · 3 lines
Mario Limonciello *Dell | Linux Engineering* [email protected]
From d95fe2f74815243123bff8f34cb427d901e3ba32 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <[email protected]>
Date: Fri, 15 May 2009 14:29:03 -0500
Subject: [PATCH] Add support for command line arguments on hid2hci tool.
This means that hid2hci won't have to run
on every bootup for every machine with bluetooth installed. It instead gets ran on demand if a product that is called out from the dbus rules file contains the correct attributes and/or VID/PID.
It also makes it easier for users to manually test new VID/PID combinations that may or may not be yet supported by bluez.
--- scripts/Makefile.am | 12 ++- scripts/bluetooth.default | 3 - scripts/bluetooth.init | 7 -- scripts/hid2hci.rules | 38 ++++++++++ tools/hid2hci.c | 179 +++++++++++++++++++------------------------- 5 files changed, 124 insertions(+), 115 deletions(-) create mode 100644 scripts/hid2hci.rules
scripts/Makefile.am +9 -3
@@ -1,14 +1,20 @@ +rulesdir = $(sysconfdir)/udev + +udevdir = $(libexecdir)/udev if PCMCIARULES -rulesdir = $(sysconfdir)/udev rules_DATA = bluetooth.rules -udevdir = $(libexecdir)/udev - udev_SCRIPTS = bluetooth_serial endif +if HID2HCI + +rules_DATA = $rules_DATA hid2hci.rules + +endif + EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default MAINTAINERCLEANFILES = Makefile.in
scripts/bluetooth.default +0 -3
@@ -1,4 +1 @@ # Bluetooth configuraton file - -# Run hid2hci (allowed values are "true" and "false") -HID2HCI_ENABLE=true
scripts/bluetooth.init +0 -7
@@ -10,13 +10,10 @@ NAME=bluetooth DESC="Bluetooth subsystem" DAEMON_NAME=bluetoothd -HID2HCI_NAME=hid2hci DAEMON_EXEC="`which $DAEMON_NAME || true`" -HID2HCI_EXEC="`which $HID2HCI_NAME || true`" DAEMON_ENABLE=true -HID2HCI_ENABLE=false [ -e /etc/default/bluetooth ] && . /etc/default/bluetooth
@@ -27,10 +24,6 @@ case "$1" in $DAEMON_EXEC echo -n " $DAEMON_NAME" fi - if $HID2HCI_ENABLE && [ -x "$HID2HCI_EXEC" ] ; then - $HID2HCI_EXEC --tohci > /dev/null 2>&1 || true - echo -n " $HID2HCI_NAME" - fi echo "." ;; stop)
scripts/hid2hci.rules new file +38 -0
@@ -0,0 +1,38 @@ +#UDEV Rules to match on Bluetooth USB dongles that need to be switched to HCI mode upon +#being plugged into the PC's USB bus. + +##Variety of Dell Bluetooth adapters +# it looks like a bit of an odd rule, because it is matching +# on a mouse device that is self powered, but that is where +# a HID report needs to be sent to switch modes. +#Known supported devices: +# 413c:8154 +# 413c:8158 +# 413c:8162 +ACTION=="add", ENV{ID_VENDOR}=="413c", ENV{ID_CLASS}=="mouse", ATTRS{bmAttributes}=="e0", KERNEL=="mouse*", RUN+="/usr/sbin/hid2hci --method dell -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" + +##Logitech adapters +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c703" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c704" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c705" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70a" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70b" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70c" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70e" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c713" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c714" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71b" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71c" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" + +##HID Proxy adapters +#These rules are for hid proxy adapters to default them to hci mode +ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" +ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hci" + +#These rules are for hid proxy adapters to default them to hid mode +#ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="0001" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hid" +#ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="003f" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hid" +#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8203" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hid" +#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8204" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hid" +#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8207" RUN+="/usr/sbin/hid2hci --method hidproxy -v $env{ID_VENDOR} -p $env{ID_MODEL} --radiomode hid"
tools/hid2hci.c +77 -102
253 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Marcel Holtmann
maintainerHi Mario,
Quoted 19 lines
This means that hid2hci won't have to run
on every bootup for every machine with bluetooth installed. It instead
gets ran on demand if a
product that is called out from the dbus rules file contains the
correct attributes and/or VID/PID.It also makes it easier for users to manually test new VID/PID
combinations that may or may not
be yet supported by bluez.--- scripts/Makefile.am | 12 ++- scripts/bluetooth.default | 3 - scripts/bluetooth.init | 7 -- scripts/hid2hci.rules | 38 ++++++++++ tools/hid2hci.c | 179 +++++++++++++++++++------------------------- 5 files changed, 124 insertions(+), 115 deletions(-) create mode 100644 scripts/hid2hci.rules
Quoted 1 line
Attaching patch as Exchange would mangle otherwise.
please restrict the commit message to 70-72 chars per line.
And please do the following changes:
s/radiomode/mode/ since it is not about the radio part here.
s/hidproxy/csr/ if you wanna expose this then call it what it is.
And go over the coding style once more since there are some cases where it breaks.
Also please split Makefile/rules changes from the actual code changes. I want two patches here. One that fixes the code and another one that takes care of the udev integration.
Other than that, looks pretty good.
Regards
Marcel
Hi Marcel:
Quoted 17 lines · Marcel Holtmann
Hi Mario,
please restrict the commit message to 70-72 chars per line.
And please do the following changes:
s/radiomode/mode/ since it is not about the radio part here.
s/hidproxy/csr/ if you wanna expose this then call it what it is.
And go over the coding style once more since there are some cases where it breaks.
Also please split Makefile/rules changes from the actual code changes. I want two patches here. One that fixes the code and another one that takes care of the udev integration.
Quoted 6 lines
Other than that, looks pretty good.
Regards
Marcel
Thanks for the feedback. I've hopefully addressed all of your concerns. If you still have problems with coding style, can you please point them out specifically? The attached patch is the code portion of the split up patch. Again it's attached so my mail server doesn't mangle it.
Regards
Signature · 3 lines
Mario Limonciello *Dell | Linux Engineering* [email protected]
From cdb895e4ed76b2474ae6309456ec0f4222a7051c Mon Sep 17 00:00:00 2001
From: Mario Limonciello <[email protected]>
Date: Fri, 15 May 2009 16:31:42 -0500
Subject: [PATCH] Add support for command line arguments on hid2hci tool.
This means that the hid2hci tool will not have to run on every bootup for every machine with bluez installed. It instead gets ran on demand if a product that is called out from a udev rules file contains the correct attributes and/or VID/PID.
It also makes it easier for users to manually test new VID/PID combinations to determine if they should be supported by bluez.
--- tools/hid2hci.8 | 18 ++++-- tools/hid2hci.c | 172 ++++++++++++++++++++++--------------------------------- 2 files changed, 81 insertions(+), 109 deletions(-)
tools/hid2hci.8 +12 -6
@@ -14,7 +14,7 @@ .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" .\" -.TH HID2HCI 8 "JUNE 6, 2003" "" "" +.TH HID2HCI 8 "MAY 15, 2009" "" "" .SH NAME hid2hci \- Bluetooth HID to HCI mode switching utility
@@ -25,7 +25,7 @@ hid2hci \- Bluetooth HID to HCI mode switching utility ] .SH DESCRIPTION .B hid2hci -is used to set up switch HID proxy Bluetooth dongle into the HCI +is used to set up switch supported bluetooth devices into the HCI mode and back. .SH OPTIONS .TP
@@ -35,11 +35,17 @@ Gives a list of possible options. .BI -q Don't display any messages. .TP -.BI -0 -Switches the device into HCI mode. +.BI -r [hid,hci] +Sets the mode to switch the device into .TP -.BI -1 -Switches the device into HID mode. +.BI -v +Specifies the 4 digit vendor ID assigned to the device being switched +.TP +.BI -p +Specifies the 4 digit product ID assigned to the device being switched +.TP +.BI -m [csr, logitech, dell] +Which vendor method to use for switching the device. .SH AUTHOR Written by Marcel Holtmann <[email protected]>. .br
tools/hid2hci.c +69 -103
247 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Marcel Holtmann
maintainerHi Mario,
Quoted 15 lines
Quoted 15 lines
please restrict the commit message to 70-72 chars per line.
And please do the following changes:
s/radiomode/mode/ since it is not about the radio part here.
s/hidproxy/csr/ if you wanna expose this then call it what it is.
And go over the coding style once more since there are some cases where it breaks.
Also please split Makefile/rules changes from the actual code changes. I want two patches here. One that fixes the code and another one that takes care of the udev integration.
Quoted 7 lines
Quoted 2 lines
Other than that, looks pretty good.
Thanks for the feedback. I've hopefully addressed all of your concerns. If you still have problems with coding style, can you please point them out specifically? The attached patch is the code portion of the split up patch. Again it's attached so my mail server doesn't mangle it.
patch has been applied. However I was serious about the 70-72 chars width of the commit message. Had to manually fix that.
Also it is Bluetooth and not bluetooth when writing about it. That is a trademark issue :)
Regards
Marcel