[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] BlueZ stack initialization.



Folks, 

This is an attempt to document BlueZ stack initialization procedure :)
I'd appreciate if somebody could write HOWTO.

1. Loading stack modules.
Manual:
	modprobe hci		#HCI Core
	modprobe hci_uart 	#UART driver
	modprobe hci_usb	#USB driver
	modprobe l2cap		#L2CAP module

See doc/modules.txt on how to configure module auto-loading.

After you do that, you should have something like this:
Module                  Size  Used by
l2cap                  17520   0  
hci_uart                4656   2  
hci                      22576   3  [l2cap hci_uart]

2. Device intitialization

UART device:
	Make sure that you /etc/hcid.conf is correct (tty, speed, flow, etc). See example provided with the package (daemons/hcid.conf). 
	Start hcid. It will initialize UART devices from the config file.

USB device:
	Plug it in and do:  modprobe hci_usb

When hcid is running it will attempt to initialize new devices when they are plugged in(usb) or on the startup(uart).
If hcid is not running you can manually bring device up:
	hciconfig hci0 up

3. Traces from actual machines with physical devices.

Trace 1.
SMP machine. 2 Bluetooth devices (Ericsson AppTK) connected via UART.

bluetooth11:/> uname -a
Linux bluetooth11.qualcomm.com 2.4.4 #4 SMP Mon Apr 30 18:55:18 PDT 2001 i686 unknown

bluetooth11:/> cat /etc/modules.conf 
alias eth0 tlan
alias char-major-108    ppp_async
alias char-major-10-200 tun

# BlueZ
alias net-pf-31    hci
alias bt-proto-0   l2cap
alias tty-ldisc-14 hci_uart

bluetooth11:/> cat /etc/hcid.conf 
#
# HCI daemon configuration file.
#
# $Id: hcid.conf,v 1.1.1.1 2001/01/22 22:20:27 maxk Exp $
#

# HCI devices with UART interface
uart {
         device /dev/ttyS0 115200 flow ericsson;
         device /dev/ttyS1 115200 flow ericsson;
         #device /dev/ttyS0 57600 flow ericsson;
}

bluetooth11:/> lsmod
Module                  Size  Used by
tlan                   25056   1  (autoclean)

bluetooth11:/> hcid

bluetooth11:/> hciconfig 
hci0:   Type: UART
         BD Address: 00:D0:B7:03:4B:F0 ACL MTU: 672:10  SCO: MTU 0:0
         UP RUNNING NORMAL PSCAN ISCAN 
         RX bytes:62 acl:0 sco:0 events:7 errors:0
         TX bytes:36 acl:0 sco:0 commands:7 errors:0

hci1:   Type: UART
         BD Address: 00:D0:B7:03:4B:85 ACL MTU: 800:10  SCO: MTU 0:0
         UP RUNNING NORMAL PSCAN ISCAN 
         RX bytes:62 acl:0 sco:0 events:7 errors:0
         TX bytes:36 acl:0 sco:0 commands:7 errors:0

bluetooth11:/> lsmod
Module                  Size  Used by
hci_uart                4656   2  (autoclean)
hci                    22544   3  (autoclean) [hci_uart]

bluetooth11:/> l2ping 00:D0:B7:03:4B:85
Ping: 00:D0:B7:03:4B:85 from 00:D0:B7:03:4B:F0 (data size 20) ...
20 bytes from 00:D0:B7:03:4B:85 id 200 time 48.91ms
20 bytes from 00:D0:B7:03:4B:85 id 201 time 50.02ms
2 sent, 2 received, 0% loss

bluetooth11:/usr/src/bluez/tools> ./l2test -r -b 10 -I 2000 &
[1] 22761
l2test[22761]: Waiting for connection on psm 10 ...

bluetooth11:/usr/src/bluez/tools> ./l2test -s 00:D0:B7:03:4B:85
l2test[22763]: Connected [imtu 672, omtu 2000, flush_to 65535]
l2test[22763]: Sending ...
l2test[22764]: Connect from 00:D0:B7:03:4B:F0 [imtu 2000, omtu 672, flush_to 65535]
l2test[22764]: Receiving ...
l2test[22764]: 10240 bytes in 0.01m speed 11.12 kb
l2test[22764]: 10240 bytes in 0.01m speed 11.12 kb
l2test[22764]: 10240 bytes in 0.02m speed 11.00 kb
l2test[22764]: 10240 bytes in 0.01m speed 11.12 kb
l2test[22764]: 10240 bytes in 0.01m speed 11.12 kb
l2test[22764]: 10240 bytes in 0.01m speed 11.12 kb
<ctrl-c>
l2test[22764]: Read failed. Connection reset by peer(104)
l2test[22764]: Disconnect

bluetooth11:/> lsmod
Module                  Size  Used by
l2cap                  17520   0  (autoclean)
hci_uart                4656   2  (autoclean)
hci                    22544   3  (autoclean) [l2cap hci_uart]
tlan                   25056   1  (autoclean)

Trace 2
Compaq Laptop. 1 Bluetooth device (Ericsson AppTK) connected via USB.

btdemo1:~>lsmod
Module                  Size  Used by
uhci                   23040   0  (unused)
eepro100               15984   1  (autoclean)
usbcore                48784   1  [uhci]

btdemo1:~>modprobe l2cap
btdemo1:~>lsmod
Module                  Size  Used by
l2cap                  15552   0  (unused)
hci                    20624   0  [l2cap]
uhci                   23040   0  (unused)
eepro100               15984   1  (autoclean)
usbcore                48784   1  [uhci]

btdemo1:~>modprobe hci_usb

btdemo1:~>hciconfig 
hci0:   Type: USB 
         BD Address: 00:00:00:00:00:00 ACL MTU: 0:0  SCO: MTU 0:0
         DOWN NORMAL 
         RX bytes:0 acl:0 sco:0 events:0 errors:0
         TX bytes:0 acl:0 sco:0 commands:0 errors:0

btdemo1:~>hciconfig hci0 up
btdemo1:~>hciconfig 
hci0:   Type: USB 
         BD Address: 00:D0:B7:03:4B:3B ACL MTU: 672:10  SCO: MTU 255:255
         UP RUNNING NORMAL PSCAN ISCAN 
         RX bytes:61 acl:0 sco:0 events:8 errors:0
         TX bytes:33 acl:0 sco:0 commands:8 errors:0

btdemo1:~>l2ping aa:aa:aa:aa:aa:aa
Can't connect.: Host is down

Hope this helps.
Max

Maksim Krasnyanskiy		
Senior Kernel Engineer
Qualcomm Incorporated

maxk@xxxxxxx.com
(408) 557-1092

-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com