Keyboard: 6C:5D:63:00:93:F8 Bluetooth Keyboard
headphone: 00:0D:FD:4B:53:B6 Motorola S305
================================================================================
1 Build the rootfs with bluetooth.
================================================================================
Build wrlinux4.3 with feature/bluetooth
================================================================================
2 Start and configure bluetooth devices.
================================================================================
#:/root> vi /etc/bluetooth/main.conf :
Name = bluez4
PageTimeout = 65535
AttributeServer = true
#:/root> (all the following commands in turn to start/restart bt)
rm -rf /var/lib/bluetooth/*
bluetoothd
hciconfig hci0 noencrypt
hciconfig hci0 piscan
hciconfig hci0 name "bluez4"
hciconfig hci0 pageto 65535
sdptool add a2snk
sdptool add a2src
sdptool add avrct
sdptool add avrtg
sdptool add hf
sdptool add hs
hciconfig hci0 class 0x200404
#:/root> hciconfig -a
hci0: Type: BR/EDR Bus: USB
BD Address: C4:85:08:02:C4:0B ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:126829 acl:64 sco:0 events:17450 errors:0
TX bytes:10046345 acl:35012 sco:0 commands:127 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'bluez4'
Class: 0x200404
Service Classes: Audio
Device Class: Audio/Video, Device conforms to the Headset profile
HCI Version: 4.0 (0x6) Revision: 0x1ebd
LMP Version: 4.0 (0x6) Subversion: 0xfc00
Manufacturer: Intel Corp. (2)
================================================================================
3 Obex Push/Recieve file
================================================================================
Bind device in PC host after start simple-agent, then enter yes to confirm.
#:/root> simple-agent
Agent registered
RequestConfirmation (/org/bluez/18475/hci0/dev_00_1A_7D_DA_71_11, 452347)
Confirm passkey (yes/no): yes
^CTraceback (most recent call last):
File "/usr/bin/simple-agent", line 127, in <module>
mainloop.run()
KeyboardInterrupt
#:/root> sdptool browse 00:1A:7D:DA:71:11
...
Service Name: Bluetooth Object Push
Service RecHandle: 0x10021
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
...
#:/root> sdptool add OPUSH
OBEX Object Push service registered
#:/root> obex_test -b 00:1A:7D:DA:71:11 3
Using Bluetooth RFCOMM transport
OBEX Interactive test client/server.
> c
Tx: 80 00 10 10 00 04 00 4A 00 09 4C 69 6E 75 78 00
Connect OK!
Version: 0x10. Flags: 0x00
> p /root/test.txt test.txt
PUT file (local, remote)> name=/root/test.txt, size=11
Going to send 11 bytes
Tx: 82 00 2B C3 00 00 00 0B 01 00 15 00 74 00 65 00 73 00 74 00 2E 00 74 00 78 00
Tx: 74 00 00 49 00 0E 31 32 33 34 35 36 37 38 39 30 0A
PUT successful!
> q
================================================================================
4 A2DP
================================================================================
#:/root> vi /etc/asound.conf :
# add these line at the end
pcm.bluetooth{
type bluetooth
device 00:0D:FD:4B:53:B6
profile "hifi"
}
#:/root> vi /etc/bluetooth/audio.conf :
[General]
Enable=Socket
Master=true
SCORouting=PCM
AutoConnect=true
[Headset]
HFP=true
MaxConnected=2
FastConnectable=true
[A2DP]
SBCSources=1
MPEG12Sources=0
rm -rf /var/lib/bluetooth/*
bluetoothd
hciconfig hci0 noencrypt
hciconfig hci0 piscan
sdptool add a2snk
sdptool add a2src
sdptool add avrct
sdptool add avrtg
sdptool add hf
sdptool add hs
hciconfig hci0 class 0x200404
oot@WR-IntelligentDevice:/root> simple-agent hci0 00:0D:FD:4B:53:B6
RequestPinCode (/org/bluez/4624/hci0/dev_00_0D_FD_4B_53_B6)
Enter PIN Code: 0000
Release
New device (/org/bluez/4624/hci0/dev_00_0D_FD_4B_53_B6)
#:/root> bttest/test-audio connect 00:0D:FD:4B:53:B6
#:/root> hcitool con
Connections:
< ACL 00:0D:FD:4B:53:B6 handle 35 state 1 lm SLAVE AUTH ENCRYPT
#:/root> aplay -D bluetooth Drenched.wav
Playing WAVE 'Drenched.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
================================================================================
5 HID
================================================================================
#:/root> simple-agent hci0 6C:5D:63:00:93:F8
RequestPinCode (/org/bluez/21017/hci0/dev_6C_5D_63_00_93_F8)
Enter PIN Code: 0000 (Enter and press the same code in keyboard and press enter in keyboard)
Release
New device (/org/bluez/21017/hci0/dev_6C_5D_63_00_93_F8)
#:/root> ./bttest/test-input connect 6C:5D:63:00:93:F8
#:/root> hcidump (press any key in keyboard will send ACL data)
HCI sniffer - Bluetooth packet analyzer ver 2.4
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 33 mode 0x00 interval 0
Mode: Active
> HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 33 mode 0x02 interval 56
Mode: Sniff
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 33 mode 0x00 interval 0
Mode: Active
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 33 mode 0x02 interval 56
Mode: Sniff
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
> ACL data: handle 33 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 0]
================================================================================
6 SPP
================================================================================
================================================================================
7 Low Energy
================================================================================
(remote device)
vi /etc/bluetooth/main.conf
AttributeServer = true
rm -rf /var/lib/bluetooth/*
bluetoothd
hciconfig hci0 up
hciconfig hci0 piscan
hciconfig hci0 -a
hciconfig hci0 leadv (remote device)
(local device)
vi /etc/bluetooth/main.conf
AttributeServer = true
rm -rf /var/lib/bluetooth/*
bluetoothd
hciconfig hci0 up
hciconfig hci0 piscan
hciconfig hci0 -a
#:/root> hcitool lescan
LE Scan ...
C4:85:08:03:7A:AE (unknown)
C4:85:08:03:7A:AE (unknown)
C4:85:08:03:7A:AE (unknown)
C4:85:08:03:7A:AE (unknown)
^C
#:/root> hcitool lecc C4:85:08:03:7A:AE
Connection handle 34
#:/root> gatttool -i hci0 -b C4:85:08:03:7A:AE --interactive
[ ][C4:85:08:03:7A:AE][LE]> connect
[CON][C4:85:08:03:7A:AE][LE]> primary
[CON][C4:85:08:03:7A:AE][LE]>
attr handle: 0x0001, end grp handle: 0x0008 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0009, end grp handle: 0x000b uuid: 00001803-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001804-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0010 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0011, end grp handle: 0x0013 uuid: 00001802-0000-1000-8000-00805f9b34fb
attr handle: 0x0014, end grp handle: 0x0017 uuid: 0000a002-0000-1000-8000-00805f9b34fb
attr handle: 0x0022, end grp handle: 0x002c uuid: 0000a004-0000-1000-8000-00805f9b34fb
attr handle: 0xfffa, end grp handle: 0xfffe uuid: feee74dc-a8de-3196-1149-d43596c00a4f
[CON][C4:85:08:03:7A:AE][LE]> characteristics 0x0010 0x0010
[CON][C4:85:08:03:7A:AE][LE]>
[CON][C4:85:08:03:7A:AE][LE]> char-desc 0x0010 0x0010
[CON][C4:85:08:03:7A:AE][LE]>
handle: 0x0010, uuid: 2800
[CON][C4:85:08:03:7A:AE][LE]> char-read-uuid 2800
[CON][C4:85:08:03:7A:AE][LE]>
handle: 0x0001 value: 00 18
handle: 0x0009 value: 03 18
handle: 0x000c value: 04 18
handle: 0x0010 value: 01 18
handle: 0x0011 value: 02 18
handle: 0x0014 value: 02 a0
handle: 0x0022 value: 04 a0
[CON][C4:85:08:03:7A:AE][LE]> disconnect
[ ][C4:85:08:03:7A:AE][LE]> exit
/*others for more test*/
#:/root> dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -1 | sed 's/^.*"\(.*\)".*$/\1/'
#:/root> dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter (to get btadpter)
#:/root> dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/2617/hci1/dev_78_DD_08_A3_A7_52 org.bluez.Proximity.GetProperties
method return sender=:1.62 -> dest=:1.91 reply_serial=2
array [
dict entry(
string "LinkLossAlertLevel"
variant string "none"
)
dict entry(
string "ImmediateAlertLevel"
variant string "none"
)
]
#:/root> dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/2617/hci1/dev_78_DD_08_A3_A7_52 org.bluez.Proximity.SetProperty string:LinkLossAlertLevel variant:string:mild
method return sender=:1.62 -> dest=:1.96 reply_serial=2
-------------------------------------
bluetooth-usecase.txt
bluez-hcidump-2.4-1_WR4.3.0.0.atom-a339188.rpm
btsco-0.4-1_WR4.3.0.0.atom-1a1fa81.rpm
openobex-1.3-1_WR4.3.0.0.atom-f426146.rpm
Keyboard: 6C:5D:63:00:93:F8
headphone: 00:0D:FD:4B:53:B6 Motorola S305
================================================================================
1 Build the rootfs with bluetooth.
================================================================================
Step 01: Build wrlinux4.3 with feature/bluetooth
Step 02: Rebuild the linux kernel with all the bluetooth option selected.
Step 03: Compile openobex-1.3
(configure with --enable-apps --enable-dump --enable-bluetooth --disable-usb)
================================================================================
2 Scan and Bind other bluetooth devices.
================================================================================
Step 01: Insert the Bluetooth USB dongle and check it
#:/root> hciconfig
hci0: Type: USB
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:1
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:0 acl:0 sco:0 commands:0 errors:0
Step 02: Config hci0
#:/root> hciconfig hci0 up
#:/root> hciconfig hci0 piscan
Step 03: scan devices
#:/root> hcitool scan
Scanning ...
80:B6:86:2A:FD:53 hoxm
Step 04: start bluetooth
#:/root> vi /etc/bluetooth/rfcomm.conf
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device 80:B6:86:2A:FD:53;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "hoxm";
}
#:/root> vi /etc/bluetooth/hcid.conf
security auto; #??? user
passkey "1234"
#:/root> service bluetooth start
Step 05: bind device ???
Clear the bind information
#:/root> rm -rf /var/lib/bluetooth/*;
#:/root> /etc/init.d/bluetooth restart
Step 06: browse services supported
#:/root> sdptool browse local
#:/root> sdptool browse 80:B6:86:2A:FD:53
================================================================================
3 Obex Push/Recieve file
================================================================================
#:/root> obex_test -b 80:B6:86:2A:FD:53 12
Using Bluetooth RFCOMM transport
OBEX Interactive test client/server.
> c
Tx: 80 00 10 10 00 04 00 4A 00 09 4C 69 6E 75 78 00
Connect OK!
Version: 0x10. Flags: 0x00
> p /root/test.txt test.log
name=/root/test.txt, size=16
Going to send 16 bytes
Tx: 82 00 3C C3 00 00 00 10 01 00 21 00 2F 00 72 00 6F 00 6F 00 74 00 2F 00 74 00
Tx: 65 00 73 00 74 00 2E 00 74 00 78 00 74 00 00 49 00 13 0A 6F 62 65 78 20 70 75
Tx: 73 68 20 74 65 73 74 0A
PUT successful!
> q
#:/root> sdptool add OPUSH
OBEX Object Push service registered
#:/root> sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service Name: OBEX Object Push
Service RecHandle: 0x10000
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 9
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
#:/root> obex_test -b 00:1F:81:00:02:00 9
Using Bluetooth RFCOMM transport
OBEX Interactive test client/server.
> s
push file and press 's'[ENTER] to recieve right away!
================================================================================
3 Obex FTP
================================================================================
================================================================================
3 A2DP
================================================================================
sdptool add A2SRC
================================================================================
4 HID
================================================================================
#:/root> hcitool scan
Scanning ...
6C:5D:63:00:93:F8 Bluetooth Keyboard
================================================================================
E hcidump debug
================================================================================
hcidump –X –V