From: Mario Limonciello <mario_limonciello@dell.com>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: [PATCH 3/3] Launch hid2hci from udev rules dynamically.
Date: Fri, 15 May 2009 17:08:48 -0500 [thread overview]
Message-ID: <4A0DE7F0.3090803@dell.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 580 bytes --]
Rather than launching hid2hci upon every boot even when the user
doesn't have hardware that needs it installed, launch it from
a set of udev rules that matches the hardware by attributes.
---
scripts/Makefile.am | 9 ++++++++-
scripts/bluetooth.default | 3 ---
scripts/bluetooth.init | 7 -------
scripts/hid2hci.rules | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 46 insertions(+), 11 deletions(-)
create mode 100644 scripts/hid2hci.rules
--
Mario Limonciello
*Dell | Linux Engineering*
mario_limonciello@dell.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0003-Launch-hid2hci-from-udev-rules-dynamically.patch --]
[-- Type: text/x-patch; name="0003-Launch-hid2hci-from-udev-rules-dynamically.patch", Size: 6163 bytes --]
From cde70b37b15cc2c41e97e3e307607a980809a5cf Mon Sep 17 00:00:00 2001
From: Mario Limonciello <Mario_Limonciello@Dell.com>
Date: Fri, 15 May 2009 17:02:56 -0500
Subject: [PATCH] Launch hid2hci from udev rules dynamically.
Rather than launching hid2hci upon every boot even when the user
doesn't have hardware that needs it installed, launch it from
a set of udev rules that matches the hardware by attributes.
---
scripts/Makefile.am | 9 ++++++++-
scripts/bluetooth.default | 3 ---
scripts/bluetooth.init | 7 -------
scripts/hid2hci.rules | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 46 insertions(+), 11 deletions(-)
create mode 100644 scripts/hid2hci.rules
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 6a8eec7..2dc754a 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -9,7 +9,14 @@ udevdir = $(libexecdir)/udev
udev_SCRIPTS = bluetooth_serial
endif
-EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default
+if HID2HCI
+hid2hcidir = $(sysconfdir)/udev
+
+hid2hci_DATA = hid2hci.rules
+
+endif
+
+EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default hid2hci.rules
MAINTAINERCLEANFILES = Makefile.in
diff --git a/scripts/bluetooth.default b/scripts/bluetooth.default
index b0c4493..cdf37fa 100644
--- a/scripts/bluetooth.default
+++ b/scripts/bluetooth.default
@@ -1,4 +1 @@
# Bluetooth configuraton file
-
-# Run hid2hci (allowed values are "true" and "false")
-HID2HCI_ENABLE=true
diff --git a/scripts/bluetooth.init b/scripts/bluetooth.init
index ee12408..3ea8a89 100644
--- a/scripts/bluetooth.init
+++ b/scripts/bluetooth.init
@@ -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)
diff --git a/scripts/hid2hci.rules b/scripts/hid2hci.rules
new file mode 100644
index 0000000..37bbe4b
--- /dev/null
+++ b/scripts/hid2hci.rules
@@ -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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode 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} --mode hci"
+
+##CSR adapters
+#These rules are for csr adapters to default them to hci mode
+ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+
+#These rules are for csr adapters to default them to hid mode
+#ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="0001" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+#ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="003f" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8203" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8204" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8207" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
--
1.6.0.4
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next reply other threads:[~2009-05-15 22:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 22:08 Mario Limonciello [this message]
2009-05-16 13:37 ` [PATCH 3/3] Launch hid2hci from udev rules dynamically Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A0DE7F0.3090803@dell.com \
--to=mario_limonciello@dell.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.