Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Distribution Guide
Device drivers
Bluetooth: BlueZ and Obex HowTo
BlueZ:How to run it
ST Logo
Previous   Contents   Next


Before starting, you need to enable Bluetooth at runtime:

    target% /etc/init.d/Bluetooth start
    

After that, the Bluetooth daemons will be running on your system. Now,after Bluetooth USB device plug-in,if the device is based on STLC2500 the following istruction is needed before to use it:

    target% hciattach /dev/ttyUSB0 stlc2500 115200
    

The hciattach tool is needed to attach the STLC2500 Bluetooth device to USB (handling the device by means of HCI). Moreover, after the hciattach istruction, the firmware suitable to setup the internal chip of the STLC2500 based Bluetooth devices will be loaded. For Linksys USBBT100 Bluetooth device the above istruction is not needed.

After that, the associated USB device hci0 can be manually bring up using the hciconfig tool:

    target% hciconfig hci0 up
    

[Top]

By means of hciconfig command, the device is now able to work handling other Bluetooth devices by its embedded discovery system. There are several tools provided by the installed Bluez-utils package. One of the most important tool is hcitool.
Hcitool is used to configure Bluetooth connections and send some special command to Bluetooth devices. If no command is given, or if the option -h is used, hcitool prints some usage information and exits. By using the hcitool the Bluetooth functionalities can be managed easily. For istance, the discovery of the Bluetooth devices (with Bluetooth enabled) in the closed area can be obtained as follow:
    target% hcitool scan
    

[Top]

If the Bluetooth system has been configured correctly, we can get something like that:
    target% hcitool scan
    Scanning…
    00:16:CF:DC:B9:81 Nokia3660
    00:15:4B:01:33:C5 BTGPS-321
    ...
    

[Top]

The number "00:16:....." is the MAC address of the associated Bluetooth device (a mobile Nokia for istance). Each time we want to handle the Nokia device we have to use its MAC address. For istance, if we want to ping the mentioned device, we can type as follow:
    target% l2ping 00:16:CF:DC:B9:81
    

[Top]

The tool l2ping is able to ping the discovered Bluetooth devices.If the Bluetooth system has been configured correctly and if the handled device has Bluetooth enabled, the l2ping command should provide an output like that:

    target% l2ping 00:16:CF:DC:B9:81
    Ping: 00:16:CF:DC:B9:81 from 00:11:B1:07:BE:A7 (data size 44) ... 
    4 bytes from 00:16:CF:DC:B9:81 id 0 time 42.71ms 
    4 bytes from 00:16:CF:DC:B9:81 id 1 time 35.34ms
    ........
    x sent, x received, 0% loss 
    

[Top]

Another useful Bluetooth tool is the sdptool. Sdptool provides the interface for performing SDP queries on Bluetooth devices, and administering a local sdpd (daemon). By using the sdptool we can get the features (ports, protocol, communication channels, etc..) of the Bluetooth device to be handled. For instance, in order to get a general overview of the features of the Bluetooth device we use the following command:

    target% sdptool browse 00:16:CF:DC:B9:81
    

[Top]

If there are no erros, we can get an output as follow:

    target% sdptool browse 00:16:CF:DC:B9:81
    Inquiring...
    Browsing 00:16:CF:DC:B9:81    
    Service Name:Fax     
    Service RecHandle: 0x10000
    Service Class ID List:
    "Fax" (0x1111)
    "Generic Telephony" (0x1204)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 1 
    Profile Descriptor List:
    "Fax" (0x1111)
    Version: 0x0100
    Service Name: Dial-up Networking  
    Service RecHandle: 0x10001
    Service Class ID List:
    "Dialup Networking" (0x1103)
    "Generic Networking" (0x1201)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 1
    Profile Descriptor List:
    "Dialup Networking" (0x1103)
    Version: 0x0100
    Service Name:Bluetooth Serial Port  
    Service RecHandle: 0x10002
    Service Class ID List:
    "Serial Port" (0x1101)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 2
    Language Base Attr List:
    code_ISO639: 0x656e
    encoding:    0x6a
    base_offset: 0x100
    Service Name:OBEX Object Push    
    Service RecHandle: 0x10003
    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
    Service Name: OBEX File Transfer  
    Service RecHandle: 0x10005
    Service Class ID List:
    "OBEX File Transfer" (0x1106)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 10
    "OBEX" (0x0008)
    Profile Descriptor List:
    "OBEX File Transfer" (0x1106)
    Version: 0x0100
    ......
    

[Top]

From the above log, we can get the information about the channels to be used for Obex file exchanging via Bluetooth. For more detail, please see the Obex section.

[Top]

Note: Each of the released Bluetooth tools have an help to be invoked (tipically a -h option) at runtime.
Previous   Contents   Next
Valid HTML 4.01! Last updated: 2007/11/26 13:16:30
© Copyright STMicroelectronics Limited, 2005
Printer