User Tools

Site Tools


howto:bluetoothdongles

Using Bluetooth peripherals with the Eee

Though the Eee PC does not come with built-in Bluetooth support, an external USB Bluetooth dongle can be used.

On the software side, the Eee install of Linux comes with Bluetooth support enabled, but there is no way to configure or use it from the graphical interface. The command-line must be used. However, this is trivial.

Just about any Bluetooth guide for Linux will apply to the Eee, but if there are parts about patching the kernel or installing a bluetooth stack then you can skip them, because this is all built-in to the Eee's kernel.

Bringing up a Bluetooth dongle so it works

Here is a quick list of commands which will show you if your Bluetooth dongle is detected and basically working… (Please note that these commands will not work on the 2G Surf models.)

900A bluetooth modules

  1. Plug in your USB bluetooth adapter
  2. Open a command prompt (Ctrl-Alt-T in simple desktop mode)
  3. Run the command
    dmesg

    which will show the kernel log, and look at the last few lines for Bluetooth related text. That should tell you if the device has been detected and Bluetooth support is starting up. If it has then you should see something like

    Bluetooth: HCI device and connection manager initialized

    plus more similar lines.

  4. Run
    sudo hciconfig

    which will list Bluetooth interfaces, e.g.

    hci0: Type: USB
          BD Address: 00:12:34:AB:CD:EF ACL MTU: 192:8 SCO MTU 64:8
          DOWN
          RX bytes ...
          TX bytes ...
  5. If the device is there and the STATUS reads DOWN, then type
    sudo hciconfig hci0 up

    to activate it.

    sudo hciconfig hci0 down

    will stop it, should you wish to.

  6. Now run
    hcitool dev

    to list devices, sample output is:

    Devices:
           hci0    00:12:34:AB:CD:EF

Connecting a Bluetooth keyboard and/or mouse

  1. Follow the instructions above to ensure the Bluetooth dongle is activated.
  2. Edit /etc/default/bluetooth with
    sudo kwrite /etc/default/bluetooth

    so that the Human Interface Devices are enabled:

    HIDD_ENABLED=1
  3. Restart the bluetooth stack to initialize the above change:
    /etc/init.d/bluetooth restart
  4. Type
    sudo hidd --search

    This will automatically find and utilize any Bluetooth keyboards and/or mice in range. Ensure that the keyboard and/or mouse is set in detection/discoverable mode.

  5. To actually connect to the mouse/keyboard, type in the following:
    sudo hidd --connect 00:12:5A:65:78:A4

    You'll need to change the address to be the same as the result you got when you did the hidd --search command above. You should now be connected to your bluetooth mouse/keyboard.

Connecting automatically after reboot

Warning: Use this chapter at own risk. Only follow these instructions, if you know what you are doing. If the modifications prevent the graphical desktop from starting properly, your machine may enter an endless boot loop, requiring you to resort to using the Rescue Console.

To reconnect to your bluetooth mouse/keyboard automatically on system start, the bluetooth init script hast to be executed after booting. If you are working with the preinstalled Xandros Linux distribution, you can do this by editing '/usr/sbin/services.sh': sudo kwrite /usr/sbin/services.sh. Find the following line:

start-stop-daemon --start --quiet --oknodo --pidfile /var/run/cups/cupsd.pid --exec /usr/sbin/cupsd

Below this line insert:

sudo hciconfig hci0 reset
sudo /usr/sbin/invoke-rc.d bluetooth start

The first line might not be necessary in all cases, but it certainly is necessary for my Hama Nano-Bluetooth-USB-Adapter.

You also have to edit '/sbin/fastshutdown.sh' and '/sbin/fastreboot.sh' to properly stop bluetooth before reboot/shutdown. Some bluetooth devices have problems to reconnect on system start if they aren't properly disconnected before. Do sudo kwrite /etc/sbin/fastshutdown.sh and find the following line:

[ `id -u` = "0" ] || echo "Must be root."

Below this line insert:

/etc/init.d/bluetooth stop
sleep 1

Now do the same with '/sbin/fastreboot.sh'.

After rebooting your eee you have a good chance that your keyboard/mouse reconnects automatically after a few moments.

Check the '/etc/bluetooth/hcid.conf' if the keyboard/mouse doesn't reconnect automatically. If you cannot find the address of the keyboard/mouse in the file, you'll have to add it. Do sudo kwrite /etc/bluetooth/hcid.conf and add the following lines at the end of the file:

device 70:00:00:00:08:08 {
 name "Mouse"
}

device 00:07:61:33:EE:EE {
	name "Keyboard";
	auth enable;
	encrypt enable;
}

You'll need to change the address to be the same as the result you got when you did the hidd --search command above. You should now be automatically reconnected to your bluetooth mouse/keyboard, when you (re)start your computer or when the screensaver ends.

Connecting to a mobile phone

Using OBEX file transfer

This assumes you have set up Bluetooth working and starting automatically as described above. Also, you'll need the extra Xandros repositories

Sending

Install ussp-push with

sudo apt-get install ussp-push

Find the MAC address of your phone with

hcitool scan

and make a note of the long string of numbers like this 01:23:45:67:89:AB then find its OBEX channel with

sdptool search --bdaddr 01:23:45:67:89:AB OPUSH

and note the channel number (usually 9). Edit /etc/bluetooth/rfcomm.conf and add a new section at the end. If you already have an rfcomm1, change to the next free number

rfcomm1 {
#       # Automatically bind the device at startup
        bind yes;
#
#       # Bluetooth address of the device
        device 01:23:45:67:89:AB;
#
#       # RFCOMM channel for the connection
        channel 9;
#
#       # Description of the connection
        comment "OBEX Push";
}

setting the address and channel number to the numbers you noted earlier. A quick reboot and you should be able to use the command

sudo ussp-push /dev/rfcomm1 <local_filename> <phone_filename>

Advanced users who aren't comfortable with using sudo for this may want to change the default owner/group of /dev/rfcomm1 by fiddling in /etc/udev/rules.d

Receiving

Install obexpushd with

sudo apt-get install obexpushd

Then, when you want to receive a file, change to a directory where you want it stored and run

obexpushd -n -B

and press Control-C when you have the files you want. If you want to have it run permanently, you can run this on startup, but add a 20 second delay to allow the Bluetooth to start and make sure you run it from a dedicated directory for incoming files. Also, there is no security on this so beware of running it permanently. If you have trouble finding your Eee from other devices, you can make it temporarily discoverable with

sudo hciconfig piscan

Links

howto/bluetoothdongles.txt · Last modified: 2012/01/28 10:28 by hello