# hcitool cc 00:08:AC:03:58:A6
|------------|
| minicom -|
|------------|
| RFCOMM | /dev/rfcomm0
|------------|
| L2CAP |
|------------|
| --HCI_UART |
|------------|
| COM | /dev/ttyS0 OR
|------------| /dev/ttyUSB0 (USB to RS232)
| BT Device –|
|------------|
# hcitool cmd 0x03 0x001A 0x00
< HCI Command: ogf 0x03, ocf 0x001a, plen 1
00
> HCI Event: 0x0e plen 4
01 1A 0C 00
# hciconfig hci0
hci0: Type: USB
BD Address: 00:15:83:07:D5:78 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:1459 acl:0 sco:0 events:63 errors:0
TX bytes:764 acl:0 sco:0 commands:63 errors:0
# hcitool cmd 0x03 0x001A 0x01
< HCI Command: ogf 0x03, ocf 0x001a, plen 1
01
> HCI Event: 0x0e plen 4
01 1A 0C 00
# hciconfig hci0
hci0: Type: USB
BD Address: 00:15:83:07:D5:78 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING ISCAN
RX bytes:1472 acl:0 sco:0 events:65 errors:0
TX bytes:771 acl:0 sco:0 commands:65 errors:0
# hcitool cmd 0x03 0x001A 0x02
< HCI Command: ogf 0x03, ocf 0x001a, plen 1
02
> HCI Event: 0x0e plen 4
01 1A 0C 00
# hciconfig hci0
hci0: Type: USB
BD Address: 00:15:83:07:D5:78 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:1491 acl:0 sco:0 events:68 errors:0
TX bytes:785 acl:0 sco:0 commands:68 errors:0
# hcitool cmd 0x03 0x001A 0x03
< HCI Command: ogf 0x03, ocf 0x001a, plen 1
03
> HCI Event: 0x0e plen 4
01 1A 0C 00
# hciconfig hci0
hci0: Type: USB
BD Address: 00:15:83:07:D5:78 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:1525 acl:0 sco:0 events:73 errors:0
TX bytes:811 acl:0 sco:0 commands:73 errors:0
# vi bluetooth.sh
-----------------------------------
#!/bin/bash
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/bluetooth.ko &>/dev/null
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/l2cap.ko &>/dev/null
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/sco.ko &>/dev/null
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/bnep/bnep.ko &>/dev/null
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/rfcomm.ko &>/dev/null
insmod /lib/modules/`uname -r`/kernel/drivers/bluetooth/hci_uart.ko &>/dev/null
lsmod | grep bluetooth
/etc/init.d/bluetooth restart
sleep 5
hciconfig -a
hciconfig hci0 up
hcitool dev > locate_dev
hcitool scan > remote_dev
rm /dev/rfcomm0 &>/dev/null
mknod /dev/rfcomm0 c 216 1
chmod 666 /dev/rfcomm0
# configure rfcomm.conf
locate_dev_mac=`awk '{ if(NR ==2) printf $2}' locate_dev`
rm locate_dev
cat > /etc/bluetooth/rfcomm.conf << EOF
rfcomm0 {
bind no;
device $locate_dev_mac;
channel 1;
comment "HCI003"
}
EOF
sdptool add --channel=1 DID SP DUN LAN FAX OPUSH FTP HS HF SAP NAP GN PANU HID CIP CTP A2SRC A2SNK SYNCML NOKID PCSUITE SR1
remote_dev_mac=`awk '/DTK/{printf $1}' remote_dev`
rm remote_dev
rfcomm bind /dev/rfcomm0 $remote_dev_mac 1
hcitool cc $remote_dev_mac
hciattach - attach serial devices via UART HCI to BlueZ stack
---------------------------------------------------
hciattach [-n] [-p] [-t timeout] tty type|id speed flow bdaddr
-n
Don't detach from controlling terminal.
tty
This specifies the serial device to attach. A leading /dev can be omitted. Examples: /dev/ttyS1 ttyS2
type|id
The type or id of the Bluetooth device that is to be attached,i.e. vendor or other device specific identifier. Currently supported types are
type description
any Unspecified HCI_UART interface, no vendor specific options
ericsson Ericsson based modules
digi Digianswer based cards
xircom Xircom PCMCIA cards:Credit Card Adapter and Real Port Adapter
csr CSR Casira serial adapter or BrainBoxes serial dongle(BL642)
bboxes BrainBoxes PCMCIA card (BL620)
swave Silicon Wave kits
bcsp Serial adapters using CSR chips with BCSP serial protocol
Supported IDs are (manufacturer id, product id)
0x0105, 0x080a
Xircom PCMCIA cards:Credit Card Adapter and Real Port Adapter
0x0160, 0x0002
BrainBoxes PCMCIA card (BL620)
speed
The speed specifies the UART speed to use. Baudrates higher than 115.200bps require vendor specific initializations that are not implemented for all types of devices. In general the following speeds are supported:
9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
Supported vendor devices are automatically initialised to their respective best settings.