Skip to contentSkip to conversation

patch: new card

Bluez-devel Tim Hurman 1 participant 1 message Jan 6, 2005 Bluetooth drivers

lore
Share & tools
lore

Tim Hurman

author
#0 lore raw

Hi,

I have attached a patch for a new card, the CC&C/Bulemonkey CF card. Unfortunately the card silly and does not set the vendor/device IDs properly, instead they are set to 0x0000,0x0000. I have had to create a fudge table in /etc/pcmcia/bluetooth as this device/vendor ID is used by hciattach. To do this I have detected the a $MANFID of "0000,0000" and converted it to "bcsp" (the card is CSR BlueCore).

I have also added some detection for the hciattach executable as on some platforms (notably OpenEmbedded), it does not reside in /usr/sbin/. Finally I have also added some backup in case fuser is non existant, which happens busybox based platforms (again OpenEmbedded).

Tim

pcmcia/bluetooth +38 -2
diff -urN bluez-utils-2.13.orig/pcmcia/bluetooth bluez-utils-2.13/pcmcia/bluetooth
@@ -19,16 +19,52 @@
 get_info $DEVICE
 
 #
+# Where are the executables
+#
+if [ -x /sbin/hciattach ]; then
+	HCIATTACH=/sbin/hciattach
+elif [ -x /usr/sbin/hciattach ]; then
+	HCIATTACH=/usr/sbin/hciattach
+elif [ -x /usr/local/sbin/hciattach ]; then
+	HCIATTACH=/usr/local/sbin/hciattach
+else
+	HCIATTACH=""
+fi
+
+#
 # Serial devices
 #
 start_serial() {
+    if [ -z $HCIATTACH ]; then
+		log hciattach: command not found
+        return
+    fi
+
     IRQ=`setserial /dev/$DEVICE | sed -e 's/.*IRQ: //'`
     setserial /dev/$DEVICE irq 0 ; setserial /dev/$DEVICE irq $IRQ
- 
-    /usr/sbin/hciattach $DEVICE $MANFID
+
+    # some replacements - This is because hciattach only knows of a few
+    # cards. Worse, some have broken vendor/device IDs
+    case $MANFID in
+    "0000,0000")
+        # Bluemonkey/CC&C Tech bluetooth card.
+        MANFID="bcsp"
+        ;;
+    esac
+    $HCIATTACH $DEVICE $MANFID
 }
 stop_serial() {
     do_fuser -k -HUP /dev/$DEVICE > /dev/null
+    hcilist=`ps -ef | grep hciattach | grep -v grep`
+    if [ "x$hcilist" = "x" ]; then
+        return
+    fi
+    killall $HCIATTACH > /dev/null 2>&1
+    hcilist=`ps -ef | grep hciattach | grep -v grep`
+    if [ "x$hcilist" = "x" ]; then
+        return
+    fi
+    killall hciattach > /dev/null 2>&1
 }
 suspend_serial() {
     stop_serial
pcmcia/bluetooth.conf +5 -0
diff -urN bluez-utils-2.13.orig/pcmcia/bluetooth.conf bluez-utils-2.13/pcmcia/bluetooth.conf
@@ -106,3 +106,8 @@
 card "Cyber-blue Compact Flash Card"
   version "BT", "", "", ""
   bind "btuart_cs"
+
+card "Bluetooth BT0100M"
+  version "Bluetooth BT0100M", ""
+  bind "serial_cs" class "bluetooth"
+