FAQ
- FAQ
- How to ...?
- I execute a "hcitool scan" and get all devices that are available, but how …
- How do I run a service in standalone mode? (Developers)
- Windows can show the battery status of my (no-brand) bluetooth mouse. Will …
- I'm unable to find my pc from the mobile using Kubuntu Edgy/Feisty
- What is the air-speed velocity of an unladen swallow?
- How to ...?
How to ...?
Have a look at this list before asking question here http://www.holtmann.org/linux/bluetooth/ And also check in the official FAQ http://www.bluez.org/faq.html
I execute a "hcitool scan" and get all devices that are available, but how can I get some sort of info about what device it is? E.g. is it a mobile phone? A Laptop? A PDA? And so on..
To get information about the class of device of the devices found you should issue this command:
hcitool scan --class
This will show the bluetooth device address?, the device name and the device class of each device found:
BD Address: 01:23:45:67:89:AB [mode 1, clkoffset 0x2a11] Device name: Nokia N800 Device class: Computer, Palm (0x100114)
How do I run a service in standalone mode? (Developers)
You will probably want to monitor the d-bus traffic while doing this and watch for the d-bus ID to show up (see NameOwnerChanged?, normally returned by ActivateService?).
dbus-monitor --system
run the service in standalone mode:
./bluetoothd-service-echo -s -d
Then hit control-c when done. You will see the service appear in lbuetooth preferences under the services tab and it won't be stopable from the gui. To inject d-bus messages, in this case with the input service:
dbus-send --system --type=method_call --print-reply --dest=":1.63" /org/bluez/input/wearable1 org.bluez.input.Device.Connect dbus-send --system --type=method_call --print-reply --dest=":1.23" /org/bluez/input org.bluez.input.Manager.CreateDevice string:"00:00:00:E8:68:57"
To test the autoloading, copy the service description file (eg input.service) to /etc/bluetooth.
Windows can show the battery status of my (no-brand) bluetooth mouse. Will I be able to do this in Linux, and if so, how?
I'm unable to find my pc from the mobile using Kubuntu Edgy/Feisty
This happened to me more then once. When I started the system I could detect my pc, but after a while it just disapears. Lets check this step by step in order to find the right reason and fix it.
First of all, Bluez have a feature that can turn on/off its own visibility. Let's check if it's visible or not.
$dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.GetMode
This should display something like
string "discoverable"
If you get something different then this do the following
$dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable
Another feature of Bluez is to turn visibility off after some time. So, lets find out if this is the problem:
$dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.GetDiscoverableTimeout
This will return something like
uint32 0
If this was the result, then it's just fine. If you get another value after the uint32 then you might just have found you're problem. To fix this go to the console.
$dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetDiscoverableTimeout uint32:0
This should do the job. Now you should be visible to any device.
As for me, something else happened. I could see my pc from the mobile but I was unable to pair. It failed just saying the pairing was rejected. Lest's try something with the passkey-agent. This workaround is very specific for edgy/feisty and is most probably due to a bug in kdebluetooth in this version. This should not happen in anyother version.
First lets generate a script that prints the pin. I'll be using "1234". You can use your own. Create a file /etc/bluetooth/gen_pin
$sudo gedit /etc/bluetooth/gen_pin
Edit the file and write this:
#!/bin/bash echo PIN:1234
Save and close the file. We'll have to give it execution permisssions
$sudo chmod +x /etc/bluetooth/gen_pin
Now let's start the passkey-agent to use this script
$sudo passkey-agent --default /etc/bluetooth/gen_pin &
Try to pair now. It should be working with the pin you selected.
What is the air-speed velocity of an unladen swallow?
42
