Wednesday, December 17, 2008

Connecting bluetooth mouse, keyboard and other hid devices.

It isn't that hard to get a mouse, a keyboard an even some cellphones, working as an input devices through bluetooth. These are all HID devices and do work out of the box. As for your cellphone, you have to make sure it supports HID. You can check this easly, but make sure you use your phones mac-addr.

sdptool search --bdaddr AA:BB:CC:DD:EE:FF 0x1002

Before we can actually use HID, we have to make sure it has been turned on. So edit the file /etc/default/bluetooth and enable the hid daemon.
HIDD_ENABLED=1

Now you will have to restart bluetooth
/etc/init.d/bluetooth

Let's pair out device with our computer. This time we don't need the passkey, because hidd devices don't use pairing, or the key has been set to "0000". If you do encouter problems, use the passkey-agent. Change the mac-addr.
sudo hidd --connect AA:BB:CC:DD:EE:FF

That's all folks and your device will even work on reboot. Just put it "on" and press a button to make the connection. If you need the passkey-agent, use the following commands. Don't forget to replace the PIN with the one you have put in givepin and again change the mac-addr.
./passkey-agent --default 1234 &
sudo hidd --connect AA:BB:CC:DD:EE:FF


Share/Save/Bookmark

8 comments:

Unknown said...

Hi JO3RI, i apprechiate all your instructions and would apprechiate your advice. I'm on a 901/xandros and use bluetooth to connect to my phone to access the web. The bad thing is that firefox/computer hangs when the webpages get more advanced. My guess would be that it's related to the bt stack. So for the question: will i get rid of these problems if i change stack to bluez? Also do you have any advice on how to set up the dial up using bluez... furtheron, if i fail how do i revert to azurebt?
A lot of questions, and yes - I'm all new to linux, Thanks for a great blog.

JO3RI said...

Hi, took me some time to reply.

Before you start changing BT, you have to be sure it's BT that is messing up firefox.

To check this, you could disable bluetooth with the FN+F2 key until BT is disabled.

I'm telling you this, because Firefox add-ons might be causing the problem and not the BT stack.

If you decide to go for Bluez, you can always reinstall the xandros azurebt( apt-get remove bluez-utils --purge and apt-get install azurbt).

Unknown said...

Thanks for your reply, i'm pretty convinced that the problem is related to the bt stack. I don't have the same issue when browsing over wifi, it seems like i'm not the only one with the problem http://forum.eeeuser.com/viewtopic.php?pid=384132
btw, i feel a little puzzled, so there are users out there who don't have the problem? do you have success with azurebt?

thanks again.

JO3RI said...

Aha, didn't know you're browsing over BT. I that case, you'll beter install Bluez. I never had good results with azureBT. Just follow the how-to.

Unknown said...

I've replaced my stack and i seem to be able to discover services avalilble. But from that point on i dont know how to proceed. Is there any of your tutorials i should re-use. I guess there isn't one matching exacly what i would like to do.
btw, for some reason hciconfig doesn't seem to exist, nut i guess it's not a problem, hcitool works fine.

/Aleksandar

JO3RI said...

Hi, it took me some time to anwser again. Tell me what is it you want to do? Using your cellphone to connect to the internet with Bluetooth? Then you can setup a network with bluetooth or you could use bluetooth as dial in. I have always used pan (network way) on Sony Ericsson phones.

What phone do you have?

Unknown said...

hello again, yes, i would like to use my phone to connect to the web using bt link. since i have some issues with freezing mozilla (the link i posted previously) i would like to replace azurebt and use something else (bluez?). i'm using a sony ericsson and sometimes a lg phone.

JO3RI said...

Ok, So If i'm right you already replaced azurebt with bluez. Now it's very important that you are able to connect and pair your phone with your EeePC. If not follow my howto's.

If you are able to pair and connect the phone, you'll have to set up an Bluetooth network. I find this the best way to connect to the internet. Make sure you are able to surf the web on your phone (without your Eeepc).

Now, I didn't write the howto on how to setup a BT network, but I can give you a link. If you don't succeed, I could write the howto later on.

http://www.howtoforge.com/bluetooth_pand_debian_etch
You should skip the pairing part. good luck. :-)