USB Bluetooth Adapters (Linux) - WORKING*

Discussion in 'Networking' started by linker3000, Aug 4, 2008.

  1. linker3000

    linker3000

    Joined:
    Aug 1, 2008
    Messages:
    64
    Likes Received:
    0
    Last Edit: 18-Jan-2010 (Note about needed files)

    The bluetooth.tgz and bluetooth2.tgz files are now attached to another post in this thread - see the note at the bottom of this one. In order to keep the files within the allowed 256KB attachment limit, I have removed the source code and object files - these files are not needed to install the Bluetooth modules and drivers. If you really want the source code, it can be obtained from places like http://www.kernel.org (FYI: The original Linpus linux shipped with the AA1 is based on kernel 2.6.23.9). The drivers and kernel modules supplied here are based on 100% unmodified original source code - I just compiled them to make them available for all of us.

    I am glad that so many have found this thread useful and thanks to those who have added their appreciations and their own wisdom in the true spirit of an Open Source support community. Since originally posting this article, things have moved on and my AA1 is (July 2009) now running Fedora 11 so I can't really help much now with Linpus-related issues, but I encourage everyone to post their technical questions to this thread where some kind soul will no doubt help if they can. All the best - Linker3000.

    These notes describe setting up a bluetooth adaptor for use with a mobile phone to connect to the Internet, but the initial setup and pairing procedure is also applicable to other devices such as keyboards and mouses - see the other posts in this thread for additional info from others.

    *Everything is working except with Dial Up Networking (DUN) getting the ppp DNS servers to be used automatically. There's a few options to work around this:
    Upgrading NetworkManager to the SVN version (see this post: viewtopic.php?f=16&t=1209) helps as it allows manual DNS entries to be specified so you can edit in your dial-up service's DNS servers after you have connected - or just use the OpenDNS DNS servers (208.67.222.222 and 208.67.220.220). Others have added the OpenDNS servers to /etc/resolv.conf, but you need to keep an eye on this as NetworkManager can overwrite the file later. You can also specify your service provider's DNS servers (or use OpenDNS) in the gnome-ppp app.

    The developers of NetworkManager state that they will 'soon' implement improved support for Dial Up Networking (I'll update the notes here 'as and when'). As an alternative to DUN, some have implemented Personal Area Networks (PANs) via Bluetooth to their phones - see the other posts in this thread.


    Useful reading: This PDF is chapter 7 of "Linux Unwired" from O'Reilly and it contains further notes on getting Bluetooth working, pairing devices, file transfers, OBEX, PAN and printing: http://www.devx.com/assets/download/10183.pdf

    Happy Bluetoothing!

    I hope you find these notes useful - just remember that it's up to you whether you decide to act upon them - they worked for me, but you use them at your own risk.

    1) Use the Package Installer (having enabled the Advanced Menu as described here: viewtopic.php?f=13&t=28 ) or yum to install the following:

    bluez-gnome, bluez-hcidump, bluez-libs, bluez-libs-devel, bluez-utils, gnome-ppp, gnome-bluetooth

    Note: the above-referenced article also describes how you can open a terminal window using file manager and someone has added a note about doing the same with Alt-F2. You will need to be in a terminal window, with root (super user) permissions to issue the commands below. To do this, use the su command to elevate your permissions, or issue the commands with sudo - eg: sudo hciconfig -a

    2) Plug in your USB dongle and see if it is recognised (here, I am already logged in as root):

    Code:
    [[email protected]]$ lsusb
    Bus 005 Device 001: ID 0000:0000
    Bus 004 Device 001: ID 0000:0000
    Bus 003 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
    
    If it's not recognised you may need to try a different make/model. Mine was a cheap 'Technika' one from Tesco in the UK.

    3) Issuing the command /etc/init.d/bluetooth start gives:

    Code:
    [[email protected]]$ /etc/init.d/bluetooth start
    audit_log_user_command(): Connection refused
    Can't open RFCOMM control socket: Address family not supported by protocol
    We need some Kernel modules...

    Download links are at the bottom of this post.

    4) Download the kernel modules pack bluetooth.tgz (compiled using a vanilla 2.6.23.9 kernel), extract the files and copy them to the folder /lib/modules/2.6.23.9lw/kernel/drivers/net/bluetooth

    5) Now download bluetooth2.tgz, extract and copy the drivers to /lib/modules/2.6.23.9lw/kernel/drivers/bluetooth

    Note: Each tgz file expands into its own 'bluetooth' folder so the simplest way to install these files is to copy them into the .../drivers/net and .../kernel/drivers folder (one per location as per the above instructions) and then issue the command tar xvfz <filename>. If you get an error during the copy or extraction, make sure you are logged in as root.

    then...

    Code:
    [[email protected]]# depmod
    [[email protected]]# /etc/init.d/bluetooth start
    Starting Bluetooth Services:   [OK]
     
    6) Run the 'Bluetooth Applet' (/usr/bin/bluetooth-applet) to get a Bluetooth logo at the bottom of the screen. Here you can change Bluetooth properties (enable/disable audio, serial, echo and input service), but nothing else happens yet...

    7) If your Bluetooth dongle seems dead - remove and re-insert it - OHMYGOD it's flashing! - and a little window should pop up telling you your device had been made 'connectable'!!

    8) Scan for new Bluetooth devices on your phone - mine found 'localhost-0' - instruct the phone to pair with the device and enter a key. A 'pairing request' box should pop up on the Acer One asking for a key too. Note the MAC address of the device wishing to pair - you'll need it later. Enter the key on your Acer and you should be told you have bonded!

    9) Right click on the Bluetooth logo and select 'Preferences': My bonded phone is listed and the Services tab shows Input and Serial services are available...

    10) You can now try and ping your bluetooth device:

    First - confirm device is there - it's probably hci0:

    Code:
    hciconfig -a
    Start your device (it may be already started - need to be root for this):

    Code:
    hciconfig hci0 up
    Ping your USB dongle:

    Code:
    l2ping [MAC address of adapter]  eg: l2ping 00:11:33:55:77:AA
    If all is well - ask your paired phone for what it can do - for internet connectivity we're looking for Dial Up Networking (DUN) - on my phone it's on channel 4. Issue the following command and find out:

    Code:
    sdptool search dun [MAC Address]  eg sdptool search dun 00:17:83:9C:36:D6
    If that command doesn't find anything, try the following, which is more comprehensive:

    Code:
    sdptool records [MAC ADDRESS]

    11) Edit /etc/bluetooth/rfcomm.conf to look like this:

    Code:
    #
    # RFCOMM configuration file.
    #
    
    rfcomm0 {
    # Automatically bind the device at startup
    bind yes;
    
    # Bluetooth address of the device attached to the Acer
    device [MAC ADDRESS - eg 00:11:22:33:44:55];
    
    # RFCOMM channel for the connection - use the channel number 
    # for DUN found with the sdptool records command...
    channel [CHANNELNO];
    
    # Description of the connection
    comment "My_Bluetooth";
    }
    
    Now bind the port - this creates /dev/rfcomm0 and connects it to your bluetooth device (if paired)

    Code:
    rfcomm bind rfcomm0
    12) Try and connect to the phone using gnome-ppp:

    Code:
    gnome-ppp
    I filled in gnome-ppp as follows for UK Vodafone - you will need to check what user name and password you need to use. The number *99# is the standard one to access a data connection from most phones:

    Username: web
    Password: web
    Remember Password = ticked
    Phone Number: *99#

    SETUP:
    Modem:
    Device: /dev/rfcomm0
    Type: Analog Modem
    Speed: 115200
    Phone line: Tone
    Wait for dialtone: unticked

    Init strings: (I don't seem to have an Init1!?)
    Init 2: ATQ0 V1 E1 S0=0 &C1 &D2
    Init 3: AT+CGDCONT=1,"IP","INTERNET"

    NB: your Init3 string may be different - the word "INTERNET" is the APN (Access Point Name) for UK Vodafone Pay Monthly connections - look up the APN of your network here: http://franson.com/forum/topic.asp?TOPIC_ID=6669 or here (UK): http://www.filesaveas.com/gprs.html

    NB2: Sooo many people get that last CGD... string wrong and put CDG instead, which will throw an error - check carefully!

    OPTIONS:
    Connections: I have nothing ticked.

    Having entered all this, I closed the setup page and hit Connect. In the terminal window behind gnome-ppp I could see the dialog between the Acer and the phone and...

    PPP Connected!!!! I

    All that needs tidying up now is the DUN DNS issue as described at the top of this post.

    NB: If a dial-up fails, or you cancel the ppp dial attempt you may need to issue the following to free the rfcomm connection before using gnome-pp again:

    Code:
    rfcomm release 0
    rfcomm bind 0
    

    *******************************
    BLUETOOTH MODULES AND DRIVERS

    Well, the files were here, but they expired off the board! I have tried to put them back but the editing tools won't let me. Neva has kindly attached the files you need to his post here:

    viewtopic.php?f=36&t=789&start=140#p106283

    Read the notes in this post to see where the files need to be put.
     
    linker3000, Aug 4, 2008
    #1
  2. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    Re: USB Bluetooth Adapters (Linux) - WORKING

    I have this error when I try to run /usr/bin/gnome-applet

    libnotify-Message: Unable to get session bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

    Any help?
     
    bug, Aug 6, 2008
    #2
  3. linker3000

    linker3000

    Joined:
    Aug 1, 2008
    Messages:
    64
    Likes Received:
    0
    Hi,

    I get a similar message *sometimes* and then when I retry the command it works again - although having the applet running is not essential.

    Edit: This may be caused by updating dbus - I am going to try and grab the original version and downgrade to see what happens.
     
    linker3000, Aug 6, 2008
    #3
  4. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    Finally flashing (I forget "depmod")

    Now I have onother issue, I need bluez-PAN module. But is not available as a compiled module. Can you help me linker3000? ;)
     
    bug, Aug 6, 2008
    #4
  5. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    PAN modules are in bluez-utils so I have it. Even I connect to the phone but no network interface is up... I'm afraid that is the networ-manager ... :roll: still researching
     
    bug, Aug 6, 2008
    #5
  6. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    Finally connected through BT PAN of my Windows mobile 6 phone.

    I had to:

    First of all pair the phone. Activate the PAN Bluetooth in the phone

    Once: create /etc/sysconfig/network-scripts/ifcfg-bnep0 with

    DEVICE=bnep0
    BOOTPROTO=static
    IPADDR=192.168.0.2
    NETMASK=255.255.255.0

    Each time I want to connect:

    Start bluetooth service: /etc/init.d/bluetooth start
    Activate PAN in the phone
    connect to the phone: pand --connect phone-bt-mac-address(00:00:-----)
    add the default gateway: route add default gw 192.168.0.1
    And the DNS in /etc/resolv.conf: echo "nameserver 80.bla.bla.bla" > /etc/resolv.conf

    It's a manual process but is working (at the moment ;) )

    I'm sending this post by my BT PAN 3G connection :lol:
     
    bug, Aug 7, 2008
    #6
  7. linker3000

    linker3000

    Joined:
    Aug 1, 2008
    Messages:
    64
    Likes Received:
    0
    Nice work! I'll have to try PAN with my HTC Tytn II instead of DUN. I am glad that adding the DNS servers to resolv.conf manually worked - I will have to re-try that because it didn't for me - did you have to restart network services after editing resolv.conf? I tried that too without any success. Maybe it's a DUN thing?
     
    linker3000, Aug 7, 2008
    #7
  8. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    No I didn't. But I had the wifi off and no eth cable plugged. When I start wifi networkmanager deletes my resolv.conf... but after switch of wifi again (front button) you have to edit resolv.conf again to add DNS servers.

    Now I am trying to start bluetooth service and gnome-applet automatically at boot time, but I'm not able yet...any help? :roll:
     
    bug, Aug 7, 2008
    #8
  9. linker3000

    linker3000

    Joined:
    Aug 1, 2008
    Messages:
    64
    Likes Received:
    0
    This is strange - I have tried chkconfig bluetooth on and also added '/etc/init.d/bluetooth start to /etc/rc.d/rc.local and neither fires up the drivers on boot.

    EDIT: It seems that autostart stuff needs to be put in /etc/rc.d/slim/nowait.sh, but this may not be necessary as Bluetooth seems to auto start when it first detects an adaptor - see bug's next post in this thread.
     
    linker3000, Aug 7, 2008
    #9
  10. linker3000

    bug

    Joined:
    Jul 24, 2008
    Messages:
    10
    Likes Received:
    0
    I realize that without doing anything in the rc.local or wathever, only with the installation of the bluez- pkgs, if you boot with the BT dongle plugged, bluetooth start automatically.
    But if you unplug and plug it againg nothing happens...

    May be the auto discover of usb devices but i'm not familiar with this...
     
    bug, Aug 8, 2008
    #10
  11. linker3000

    linker3000

    Joined:
    Aug 1, 2008
    Messages:
    64
    Likes Received:
    0
    Just a warning: I compiled and installed the latest versions of dbus, bluez-libs and bluez-utils and this totally trashed all network functionality. I suspect this was down to dbus, but the bluez stuff wouldn't compile with the installed version of dbus so it was a catch-22 situation.

    I decided to reflash my One from the recovery DVD - actually quite a straightforward task!
     
    linker3000, Aug 8, 2008
    #11
  12. linker3000

    fw1962

    Joined:
    Aug 3, 2008
    Messages:
    37
    Likes Received:
    0
    Link this information - Thanks :)
     
    fw1962, Aug 14, 2008
    #12
  13. linker3000

    eMich

    Joined:
    Jul 24, 2008
    Messages:
    1
    Likes Received:
    0
    If the dongle doesn't start flashing, you might just try a reboot to make it work...

    For the DNS issue, I have put the following line in /etc/resolv.conf:
    Code:
    nameserver 208.67.222.222
    This is a temporary (working) solution...
     
    eMich, Aug 18, 2008
    #13
  14. linker3000

    Guest Guest

    I bought a bluetooth mouse and dongle for my A1 running Linpus. Must I go through this process in order to make it work?
     
    Guest, Aug 19, 2008
    #14
  15. linker3000

    mattymatt

    Joined:
    Aug 17, 2008
    Messages:
    5
    Likes Received:
    0
    Location:
    Melbourne
    @linker3000

    Thanks for your work! I've successfully got my One online using my Nokia 6680 as a bluetooth modem on my Vodafone (Australia) data plan. yay.

    For now, because I'm uber lazy, I'm manually inserting the DNS details into /etc/resolv.conf, like bug is. Just make sure there is no prior network device enabled and the file will be basically a clean slate. No need to restart networking either.

    Too bad I only have 100meg a month on my data plan :( yum install lynx

    I was going to go the route of compiling a whole new kernel before I found your post. It never even occurred to me to compile as modules!

    *happy dance*
     
    mattymatt, Aug 20, 2008
    #15
  16. linker3000

    Guest Guest

    So I did all these steps and now have a blue blinking dongle. But when I press the button to scan for bluetooth stuff on my mouse, I don't get a popup window. My mouse and dongle just keep blinking away looking for each other. Any thoughts?
     
    Guest, Aug 20, 2008
    #16
  17. linker3000

    mattymatt

    Joined:
    Aug 17, 2008
    Messages:
    5
    Likes Received:
    0
    Location:
    Melbourne
    Have you tried pinging the mouse's bluetooth id with "l2ping xx:yy:..." to see if they can communicate at all?

    Unfortunately I know nothing about bluetooth mice, but you might try:
    "hidd --server --search" or "hidd –connect <bluetooth id>" after pressing the connect button on the mouse.
     
    mattymatt, Aug 21, 2008
    #17
  18. linker3000

    Guest Guest

    Ah, hidd --search did the trick. Thank you VERY much. BTW does anyone know how to make the blue LED on the dongle stop blinking but still work? Its kinda distracting and mine is VERY bright.
     
    Guest, Aug 21, 2008
    #18
  19. linker3000

    eflyersteve

    Joined:
    Aug 16, 2008
    Messages:
    12
    Likes Received:
    0
    when attempting a gnome-ppp connect, I get the following:

    GNOME PPP: STDERR: --> Cannot open /dev/rfcomm0: No route to host
    GNOME PPP: STDERR: --> Cannot open /dev/rfcomm0: No route to host
    GNOME PPP: STDERR: --> Cannot open /dev/rfcomm0: No route to host

    I've got everything setup pretty well. Phone and AAO are paired, etc. But this is where I am stumped.

    Additionally, I can't l2ping the BT dongel for some reason. I get 'can't connect: no route to host'

    Any ideas?
     
    eflyersteve, Aug 21, 2008
    #19
  20. linker3000

    eflyersteve

    Joined:
    Aug 16, 2008
    Messages:
    12
    Likes Received:
    0
    I've repeated the steps over and over and I get the same results with three different phones.

    Will installing windows or a different flavor of Linux let me manage the bluetooth stuff any easier?

    I can't take another late night with this problem....

    Thanks,
     
    eflyersteve, Aug 22, 2008
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.