I have an external bluetooth adapter, it works if I attach it before booting, but if I connect it afterwards it fails to detect any device.
Is there any command to scan for and detect devices?
You should check to see if the USB bluetooth kernel module (driver) is loaded.
lsmod | grep btusb
If it doesn't return anything, then you need to load the kernel module with:
sudo modprobe btusb
lsmod | grep btusb
, sometimes it helps to force a restart of it: rmmod btusb
, then modprobe btusb
.
Can you try restarting the init.d service?
:~$ sudo /etc/init.d/bluetooth restart
Executing this command after you connect your usb bluetooth adapter should restart the service and make the bluetooth service recognize new connections/adapters/etc....
Let me know...
In addition to the above answer lsmod
to check for the bluetooth kernel module, you can also use rfkill
to check the status of (and block and unblock) different wireless devices on your machine.
rfkill
was merged into the linux kernel in 2.6 and is a simple way to manage wireless devices.
For example, view wireless devices by calling rfkill
with no arguments:
cat@rt~ $ rfkill
ID TYPE DEVICE SOFT HARD
0 wlan phy0 unblocked unblocked
1 bluetooth hci0 blocked unblocked
And get a little more details with rfkill list $TYPE
:
cat@rt~ $ rfkill list bluetooth
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
Then (with sudo/root) you can block or unblock the devices with rfkill block $TYPE
(or $ID
):
cat@rt~ $ sudo rfkill block bluetooth
cat@rt~ $ sudo rfkill block wlan
Now check their new status with rfkill
again:
cat@rt~ $ rfkill
ID TYPE DEVICE SOFT HARD
0 wlan phy0 blocked unblocked
1 bluetooth hci0 blocked unblocked
Note the devices I disabled are listed blocked
under SOFT
but not HARD
. This means we've disabled the device through software (and can re-enable the device through software).
A HARD
blocked device indicates the wireless device was hardware blocked. This could be a hardware kill switch (some laptops have a switch to toggle wireless off), or the device may be disabled by bios, or possibly doesn't have a driver for the software to interact with it (double-check me on that last one though).
And to unblock a SOFT
blocked device:
cat@rt~ $ sudo rfkill unblock bluetooth
cat@rt~ $ sudo rfkill unblock wlan
hcitool
andsdptool
may help.