Jan 112009
 

Ever wondered how to connect your linux box via bluetooth, for instance to allow file transfer with your phone?

I found some cool and working hints on the Net, reporting here below what worked for me.

  1. Connect your USB dongle
  2. Install what you need:
    apt-get install obexftp bluetooth
  3. Then you need to set the system to use a predefined PIN, since you have no console and very probably you would like to digit only from phone side to connect with this box.
    To do this, you need to edit file /etc/bluetooth/hcid.conf to change the following defaults:
    # Security Manager mode
    #   none – Security manager disabled
    #   auto – Use local PIN for incoming connections
    #   user – Always ask user for a PIN
    #
    security auto; <== this is set by default to user

    and
            # Default PIN code for incoming connections
            passkey "58336342"; <== this is set by default to 1234, not enough secure IMHO…

Now, back to cellular connections:

  1. Scan for cellular address:
    hcitool scan
    this will return the address of your device, like:
    magicbox:~# hcitool scan
    Scanning …
            00:17:E4:82:F4:64       RoarinPenguin
  2. Now we need to search the channel for file tranfers
    magicbox:~# sdptool browse 00:17:E4:82:F4:64      
    This will return all details about services provided by the phone:
    magicbox:~# sdptool browse 00:17:E4:82:F4:64
    Browsing 00:17:E4:82:F4:64 …
    Service Name: AVRCP Target
    Service Description: Audio Video Remote Control
    Service Provider: Symbian Software Ltd.
    Service RecHandle: 0x10000
    Service Class ID List:
      "AV Remote Target" (0x110c)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
        PSM: 23
      "AVCTP" (0x0017)
        uint16: 0x100
    Profile Descriptor List:
      "AV Remote" (0x110e)
        Version: 0x0100
  3. Service RecHandle: 0x10001
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 1

    Service Name: Dial-Up Networking
    Service RecHandle: 0x10002
    Service Class ID List:
      "Dialup Networking" (0x1103)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 2
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "Dialup Networking" (0x1103)
        Version: 0x0100

    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)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "OBEX Object Push" (0x1105)
        Version: 0x0100

    Service Name: Hands-Free Audio Gateway
    Service RecHandle: 0x10004
    Service Class ID List:
      "Handfree Audio Gateway" (0x111f)
      "Generic Audio" (0x1203)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 28
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "Handfree Audio Gateway" (0x111f)
        Version: 0x0101

    Service Name: Headset Audio Gateway
    Service RecHandle: 0x10005
    Service Class ID List:
      "Headset Audio Gateway" (0x1112)
      "Generic Audio" (0x1203)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 29
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "Headset" (0x1108)
        Version: 0x0100

    Service Name: Imaging
    Service RecHandle: 0x10006
    Service Class ID List:
      "Imaging Responder" (0x111b)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 15
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "Imaging" (0x111a)
        Version: 0x0100

    Service Name: SyncMLClient
    Service RecHandle: 0x10007
    Service Class ID List:
      UUID 128: 00000002-0000-1000-8000-0002ee000002
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 10
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "" (0x00000002-0000-1000-8000-0002ee000002)
        Version: 0x0100

    Service Name: OBEX File Transfer
    Service RecHandle: 0x10008
    Service Class ID List:
      "OBEX File Transfer" (0x1106)
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 11
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "OBEX File Transfer" (0x1106)
        Version: 0x0100

    Service Name: Nokia OBEX PC Suite Services
    Service RecHandle: 0x10009
    Service Class ID List:
      UUID 128: 00005005-0000-1000-8000-0002ee000001
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 12
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "" (0x00005005-0000-1000-8000-0002ee000001)
        Version: 0x0100

    Service Name: SyncML DM Client
    Service RecHandle: 0x1000a
    Service Class ID List:
      UUID 128: 00000004-0000-1000-8000-0002ee000002
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 13
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "" (0x00000004-0000-1000-8000-0002ee000002)
        Version: 0x0100

    Service Name: Nokia SyncML Server
    Service RecHandle: 0x1000b
    Service Class ID List:
      UUID 128: 00005601-0000-1000-8000-0002ee000001
    Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
        Channel: 14
      "OBEX" (0x0008)
    Language Base Attr List:
      code_ISO639: 0x454e
      encoding:    0x6a
      base_offset: 0x100
    Profile Descriptor List:
      "" (0x00005601-0000-1000-8000-0002ee000001)
        Version: 0x0100

  4. The interesting channel for us is Obex File Transfer, thus 11. Let’s browse what telefone has to offer:

    obexftp -b  00:17:E4:82:F4:64 -c / -l

    This command will access the cellular of the given address the "/" (root) directory and will list its contents

Now, once could ask how to send files to the mentioned box. Well, so far I have discovered how to “pull” them from the box from the phone using obexftp command as follows:

obexftp -b 00:17:E4:82:F4:64 -c /<path_on_the_phone> -g picture1.jpg

There should be another way to put the box in listening mode through rfcomm command, but that’s food for another article 😉 since I have first to read and “digest” articles like this one

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)