As of FreeBSD 5.5 there is an entry in devd.conf which sets up the BT stack when a device is plugged in. The driver module is still needed though, so edit /boot/loader.conf and add
ng_ubt_load="YES"
The hcsecd daemon controls link keys and pin numbers for devices. Edit /etc/rc.conf and add
hcsecd_enable="YES"
Either reboot to have things take effect or run
kldload ng_ubt /etc/rc.d/hcsecd startPlug the device in and check dmesg..
ubt0: Micro Star International Bluetooth USB dongle, rev 1.10/2.72, addr 2 ubt0: Micro Star International Bluetooth USB dongle, rev 1.10/2.72, addr 2 ubt0: Interface 0 endpoints: interrupt=0x81, bulk-in=0x82, bulk-out=0x2 ubt0: Interface 1 (alt.config 5) endpoints: isoc-in=0x83, isoc-out=0x3; wMaxPacketSize=49; nframes=6, buffer size=294And I can see the phone and ping it
[inchoate 13:39] ~ >hccontrol -n ubt0hci inquiry Inquiry result, num_responses=1 Inquiry result #0 BD_ADDR: 00:03:89:65:6c:8b Page Scan Rep. Mode: 0x1 Page Scan Period Mode: 0x2 Page Scan Mode: 00 Class: 20:04:04 Clock offset: 0x5127 Inquiry result, num_responses=1 Inquiry result #0 BD_ADDR: 00:0e:ed:28:f5:e3 Page Scan Rep. Mode: 0x1 Page Scan Period Mode: 00 Page Scan Mode: 00 Class: 50:02:0c Clock offset: 0x1eaa Inquiry complete. Status: No error [00] [inchoate 13:40] ~ >sudo l2ping -a 00:0e:ed:28:f5:e3 0 bytes from 00:0e:ed:28:f5:e3 seq_no=0 time=2117.016 ms result=0 0 bytes from 00:0e:ed:28:f5:e3 seq_no=1 time=30.430 ms result=0 0 bytes from 00:0e:ed:28:f5:e3 seq_no=2 time=38.638 ms result=0 ^CNote that the other Bluetooth device here is a handsfree kit. I added an entry for the phone to /etc/bluetooth/hosts so I don't have to use the whole address of the phone. Now I have to pair the phone and the PC so I create an entry in /etc/bluetooth/hcsecd.conf (note you can't use a name for bdaddr here, it must be a numeric address)
device { bdaddr 00:0e:ed:28:f5:e3; name "Fiona's Phone"; key nokey; pin "0000"; }Restart hcsecd by running..
/etc/rc.d/hcsecd restartNote that you can run hcsecd manually with the -d option for debugging (stop the already running one first of course).
hcsecd[6110]: Got PIN_Code_Request event from 'ubt0hci', remote bdaddr 00:0e:ed:28:f5:e3 hcsecd[6110]: Found matching entry, remote bdaddr 00:0e:ed:28:f5:e3, name 'Fiona's Phone', PIN code exists hcsecd[6110]: Sending PIN_Code_Reply to 'ubt0hci' for remote bdaddr 00:0e:ed:28:f5:e3 hcsecd[6110]: Got Link_Key_Notification event from 'ubt0hci', remote bdaddr 00:0e:ed:28:f5:e3 hcsecd[6110]: Updating link key for the entry, remote bdaddr 00:0e:ed:28:f5:e3, name 'Fiona's Phone', link key doesn't existNote that you may have to run
hccontrol -n ubt0hci write_authentication_enable 1first before some devices will pair.
Now to get GPRS working I edited the ppp.conf file and added this entry..
rfcomm-dialup: # This is IMPORTANT option enable force-scripts # You might want to change these set authname set authkey set phone "*99***1#" # You might want to adjust dial string as well set dial "ABORT ERROR ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \ \"\" ATZ OK-ATZ-OK AT+CGDCONT=1,\\\"IP\\\",\\\"telstra.internet\\\" OK \\dATD\\T TIMEOUT 40 CONNECT" set login set timeout 600 enable dns resolv rewrite set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 add default HISADDRNote the +CGDCONT command - it tells the phone which access point to use (I'm not really up on GPRS terminology..) the extra quotes are necessary or the phone will complain about the command. The actual magic I obtained by doing some web searches. After this you run rfcomm_pppd -a phone -c -C dun -l rfcomm-dialup which starts up PPP after opening a channel to the phone and then "dials" up and logs in. In the case here I got an RFC1918 address from Telstra and they seem to NAT it so you can use it like a normal network connection.
I'm currently trying to figure out how to get OBEX working but not having much luck at this stage - obexapp does not seem to do much except exit with code 255 which is a bit frustrating... Ahah, it can't init my locale for some strange reason.. Setting LC_CTYPE to en_AU.ISO8859-1 allows me to do some more (it was logging stuff to syslog about locale failures).
inchoate# env LC_CTYPE=en_AU.ISO8859-1 obexapp -a phone -C OPUSH obex> put bar.vcf bar.vcf Success, response: OK, Success (0x20) obex> get telecom/devinfo.txt foo.txt Failure, response: Forbidden (0x43) obex> di Success, response: OK, Success (0x20)Unfortunately, obexapp seems to send some output to syslog and some to stderr/out so it can be difficult to find out why things didn't work.