diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 26 | ||||
-rw-r--r-- | scripts/bluetooth.default | 4 | ||||
-rw-r--r-- | scripts/bluetooth.init | 51 | ||||
-rw-r--r-- | scripts/bluetooth.rules | 35 | ||||
-rw-r--r-- | scripts/bluetooth_serial | 39 |
5 files changed, 155 insertions, 0 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 000000000..6a8eec7fa --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1,26 @@ + +if PCMCIARULES +rulesdir = $(sysconfdir)/udev + +rules_DATA = bluetooth.rules + +udevdir = $(libexecdir)/udev + +udev_SCRIPTS = bluetooth_serial +endif + +EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default + +MAINTAINERCLEANFILES = Makefile.in + +if INITSCRIPTS +install-data-local: + $(INSTALL) -D -m 755 $(srcdir)/bluetooth.init $(DESTDIR)$(sysconfdir)/init.d/bluetooth + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/default + [ -f $(DESTDIR)$(sysconfdir)/default/bluetooth ] || \ + $(INSTALL_DATA) $(srcdir)/bluetooth.default $(DESTDIR)$(sysconfdir)/default/bluetooth + +uninstall-local: + @rm -f $(DESTDIR)$(sysconfdir)/init.d/bluetooth + @rm -f $(DESTDIR)$(sysconfdir)/default/bluetooth +endif diff --git a/scripts/bluetooth.default b/scripts/bluetooth.default new file mode 100644 index 000000000..b0c4493b6 --- /dev/null +++ b/scripts/bluetooth.default @@ -0,0 +1,4 @@ +# Bluetooth configuraton file + +# Run hid2hci (allowed values are "true" and "false") +HID2HCI_ENABLE=true diff --git a/scripts/bluetooth.init b/scripts/bluetooth.init new file mode 100644 index 000000000..832600350 --- /dev/null +++ b/scripts/bluetooth.init @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Start/stop the Bluetooth daemons +# + +set -e + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=bluetooth +DESC="Bluetooth subsystem" + +DAEMON_NAME=hcid +HID2HCI_NAME=hid2hci + +DAEMON_EXEC="`which $DAEMON_NAME || true`" +HID2HCI_EXEC="`which $HID2HCI_NAME || true`" + +DAEMON_ENABLE=true +HID2HCI_ENABLE=false + +DAEMON_CONFIG="/etc/bluetooth/hcid.conf" + +[ -e /etc/default/bluetooth ] && . /etc/default/bluetooth + +case "$1" in + start) + echo -n "Starting $DESC:" + if $DAEMON_ENABLE && [ -x "$DAEMON_EXEC" ] && [ -f "$DAEMON_CONFIG" ] ; then + $DAEMON_EXEC -s -f $DAEMON_CONFIG + 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) + echo -n "Stopping $DESC:" + killall $DAEMON_NAME > /dev/null 2>&1 || true + echo -n " $DAEMON_NAME" + echo "." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/scripts/bluetooth.rules b/scripts/bluetooth.rules new file mode 100644 index 000000000..0957225fd --- /dev/null +++ b/scripts/bluetooth.rules @@ -0,0 +1,35 @@ +# Brain Boxes BL-620 Bluetooth Adapter +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Brain Boxes", SYSFS{prod_id2}=="Bluetooth PC Card", ENV{HCIOPTS}="bboxes", RUN+="bluetooth_serial" + +# Xircom CreditCard Bluetooth Adapter +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", ENV{HCIOPTS}="xircom", RUN+="bluetooth_serial" + +# Xircom RealPort2 Bluetooth Adapter +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", ENV{HCIOPTS}="xircom", RUN+="bluetooth_serial" + +# IBM Bluetooth PC Card II +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="IBM", SYSFS{prod_id2}=="Bluetooth PC Card II", ENV{HCIOPTS}="tdk", RUN+="bluetooth_serial" + +# TDK Bluetooth PC Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="TDK", SYSFS{prod_id2}=="Bluetooth PC Card II", ENV{HCIOPTS}="tdk", RUN+="bluetooth_serial" + +# AmbiCom BT2000C Bluetooth PC/CF Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="AmbiCom BT2000C", SYSFS{prod_id2}=="Bluetooth PC/CF Card", ENV{HCIOPTS}="bt2000c", RUN+="bluetooth_serial" + +# COM One Platinium Bluetooth PC Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="COM1 SA", SYSFS{prod_id2}=="MC310 CARD", ENV{HCIOPTS}="comone", RUN+="bluetooth_serial" + +# Sphinx PICO Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="SPHINX", SYSFS{prod_id2}=="BT-CARD", ENV{HCIOPTS}="picocard", RUN+="bluetooth_serial" + +# H-Soft blue+Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="H-Soft", SYSFS{prod_id2}=="Blue+CARD", ENV{HCIOPTS}="$sysfs{manf_id},$sysfs{card_id}", RUN+="bluetooth_serial" + +# Compaq iPAQ Bluetooth Sleeve, Belkin F8T020, any other muppet who used an OXCF950 and didn't bother to program it appropriately. +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="CF CARD", SYSFS{prod_id2}=="GENERIC", ENV{HCIOPTS}="$sysfs{manf_id},$sysfs{card_id}", RUN+="bluetooth_serial" + +# Zoom Bluetooth Card and Sitecom CN-504 Card +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="PCMCIA", SYSFS{prod_id2}=="Bluetooth Card", ENV{HCIOPTS}="zoom", RUN+="bluetooth_serial" + +# CC&C BT0100M +SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Bluetooth BT0100M", ENV{HCIOPTS}="bcsp 115200", RUN+="bluetooth_serial" diff --git a/scripts/bluetooth_serial b/scripts/bluetooth_serial new file mode 100644 index 000000000..e5be6c2ee --- /dev/null +++ b/scripts/bluetooth_serial @@ -0,0 +1,39 @@ +#!/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 + + if [ "$BAUDBASE" != "" ]; then + /bin/setserial $DEVNAME baud_base $BAUDBASE + fi + + /usr/sbin/hciattach $DEVNAME $HCIOPTS 2>&1 | logger -t hciattach +} + +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 |