summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-08-10 10:30:06 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-08-10 10:30:06 +0000
commit58e445d114b13530c7e1372b1920fffed7b8387f (patch)
tree2ecbc80c745b760ba5008666730633c088363572 /scripts
parent35e9349ffc53950c4b78fba9537a50cdb6e5fd7a (diff)
Add udev script for Bluetooth serial PCMCIA cards
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am6
-rw-r--r--scripts/bluetooth_serial44
2 files changed, 49 insertions, 1 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index c6ab7301..33782368 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -3,7 +3,11 @@ rulesdir = $(sysconfdir)/udev
rules_DATA = bluetooth.rules
-EXTRA_DIST = $(rules_DATA) bluetooth.init bluetooth.default
+udevdir = /lib/udev
+
+udev_SCRIPTS = bluetooth_serial
+
+EXTRA_DIST = $(rules_DATA) $(udev_SCRIPTS) bluetooth.init bluetooth.default
MAINTAINERCLEANFILES = Makefile.in
diff --git a/scripts/bluetooth_serial b/scripts/bluetooth_serial
new file mode 100644
index 00000000..6461e78d
--- /dev/null
+++ b/scripts/bluetooth_serial
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# bluetooth_serial
+#
+# Bluetooth serial PCMCIA card initialization
+#
+
+start_serial()
+{
+ if [ ! -x /bin/setserial -o ! -x /usr/sbin/hciattach ]; then
+ logger "$0: setserial or hciattach not executable, cannot start $DEVNAME"
+ return 1
+ fi
+
+ IRQ=`/bin/setserial $DEVNAME | sed -e 's/.*IRQ: //'`
+ /bin/setserial $DEVNAME irq 0 ; /bin/setserial $DEVNAME irq $IRQ
+
+ MANF_CARD_ID="${MANF_ID},${CARD_ID}"
+ # I don't have a generic solution, sorry
+ if [ $MANF_CARD_ID = "0x0160,0x0002" ]; then
+ /usr/sbin/hciattach $DEVNAME $MANF_CARD_ID 115200
+ else
+ /usr/sbin/hciattach $DEVNAME $MANF_CARD_ID
+ fi
+}
+
+stop_serial()
+{
+ [ -x /bin/fuser ] || return 1
+
+ /bin/fuser -k -HUP $DEVNAME > /dev/null
+}
+
+case "$ACTION" in
+ add)
+ start_serial
+ ;;
+ remove)
+ stop_serial
+ ;;
+ *)
+ logger "Unknown action received $0: $ACTION"
+ ;;
+esac