How can I tell if my laptop has Bluetooth?
Your kernel would have picked it up and loaded a module for it when you started Ubuntu. From the command line, gnome-terminal type this command:
If you get output simliar to the below then your laptop has bluetooth capability.
[ 2.933062] usb 1-1.4: Product: Broadcom Bluetooth Device
That won’t work if it’s been a while since you booted the laptop. The kernel ring buffer has a limited size and keeps only the latest messages. Alternatively you can try journalctl -b .
sudo lsusb |grep Bluetooth
Should give an output similar to:
Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
If there is no bluetooth device, you’ll get no output for this command.
Please be aware that this will not work if your bluetooth device is using UART, not USB (if it is part of a SOC). In this case only dmesg will work.
Mine did not show up, but it works. Could it be connected with PCIe? It is a Qualcomm Atheros QCA9377.
on my Asus laptop i have a Bluetooth icon on the top right and
[ 3.757769] Bluetooth: Core ver 2.16 [ 3.757798] Bluetooth: HCI device and connection manager initialized [ 3.757802] Bluetooth: HCI socket layer initialized [ 3.757805] Bluetooth: L2CAP socket layer initialized [ 3.757814] Bluetooth: SCO socket layer initialized [ 3.767297] Bluetooth: Generic Bluetooth USB driver ver 0.6 [ 4.332846] Bluetooth: RFCOMM TTY layer initialized [ 4.332853] Bluetooth: RFCOMM socket layer initialized [ 4.332856] Bluetooth: RFCOMM ver 1.11 [ 4.340772] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 4.340776] Bluetooth: BNEP filters: protocol multicast
but: sudo lsusb |grep Bluetooth Doesn’t return anything.
also check if you have a Hardware network (airplane mode) switch. This can disable bluetooth and make it not visible to Ubuntu
Bluetooth in Terminal
I want to see the Bluetooth adapter details in terminal without using Bluetooth GUI. Initially Bluetooth is turned off both in terminal and GUI. My commands for different functions in Terminal View status of Bluetooth (it will show active/inactive and status in some cases, and just active/inactive in some other cases)
sudo /etc/init.d/bluetooth status
sudo /etc/init.d/bluetooth start
sudo /etc/init.d/bluetooth stop
- Status = «Running»
- Active = «active (running)»
- Bluetooth adapter details: Doesn’t display anything
2. Turn off Bluetooth via terminal
- Status = Not shown
- Active = «inactive (dead)»
- Bluetooth adapter details: Doesn’t display anything
3. Turn on Bluetooth via GUI
- Status = «Running»
- Active = «active (running)»
- Bluetooth adapter details: Shows the adapter details
4. Turn off Bluetooth via terminal, but doesn’t change in GUI
- Status = «Quitting»
- Active = «inactive (dead)»
- Bluetooth adapter details: Shows the adapter details
5. Turn on Bluetooth via terminal
- Status = «Running»
- Active = «active (running)»
- Bluetooth adapter details: Shows the adapter details
6. Turn off Bluetooth via terminal, but doesn’t change in GUI
- Status = «Quitting»
- Active = «inactive (dead)»
- Bluetooth adapter details: Shows the adapter details
7. Turn off Bluetooth in GUI
- Status = Not shown
- Active = «inactive (dead)»
- Bluetooth adapter details: Doesn’t display anything
Can someone please help me what’s wrong in my commands? Also, why it works fine along with GUI? What does GUI actually do?
Questions that are not about writing software should be on a different StackExchange site. In this case, consider Unix & Linux or SuperUser
(Also, we can’t say anything useful about your GUI without knowing which one it is — lots of different Linux distributions have their own settings GUIs, and nothing included in this question specifies your distro, desktop environment, etc; similarly, /etc/init.d/bluetooth is itself distribution-specific).
1 Answer 1
it gives you a lot of posibilities:
Menu main: Available commands: ------------------- advertise Advertise Options Submenu scan Scan Options Submenu gatt Generic Attribute Submenu list List available controllers show [ctrl] Controller information select Select default controller devices List available devices paired-devices List paired devices system-alias Set controller alias reset-alias Reset controller alias power Set controller power pairable Set controller pairable mode discoverable Set controller discoverable mode agent Enable/disable agent with given capability default-agent Set agent as the default one advertise Enable/disable advertising with given type set-alias Set device alias scan Scan for devices info [dev] Device information pair [dev] Pair with device trust [dev] Trust device untrust [dev] Untrust device block [dev] Block device unblock [dev] Unblock device remove Remove device connect Connect device disconnect [dev] Disconnect device menu Select submenu version Display version quit Quit program exit Quit program help Display help about this program
you can even drill down into the advertise policies and more:
# menu advertise Menu advertise: Available commands: ------------------- uuids [uuid1 uuid2 . ] Set/Get advertise uuids service [uuid] [data=xx xx . ] Set/Get advertise service data manufacturer [id] [data=xx xx . ] Set/Get advertise manufacturer data tx-power [on/off] Show/Enable/Disable TX power to be advertised name [on/off/name] Configure local name to be advertised appearance [on/off/value] Configure custom appearance to be advertised duration [seconds] Set/Get advertise duration timeout [seconds] Set/Get advertise timeout clear [uuids/service/manufacturer/config-name. ] Clear advertise config back Return to main menu version Display version quit Quit program exit Quit program help Display help about this program
That is a lot of information you can pull (and set) directly.
Is there a way to find out which Bluetooth device is plugged into which USB port?
I’m using two Bluetooth adaptors with BlueZ, both are the same device but with different types of antenna, is there any method to find out which usb port the identifier on BlueZ (hci0/hci1) is referring to? I can discover the MAC address of the device through hcitool dev, so if there was a way to discover which USB port the adaptor with that MAC address was connected to, that would also solve my problem. As both the adaptors are the same model, lsusb does not provide any identifying information I can use. Using Ubuntu 16.04. I am looking for a solution in any form, whether it is a shell command or java/C/python/etc.
Here’s an ugly workaround: connect your phone or some device to one of the Bluetooth adaptors and then copy a picture/file to the computer and use online tools to trace where the file/picture came from.
Unfortunately I’m trying to find a way to do this automatically, as it will need to be redone every time the adaptors are disconnected. Thanks for the suggestion
2 Answers 2
This answer should point you in the right direction, though doesn’t give you a complete solution.
You should be able to use the contents of the «sys» filesystem, under /sys/class/bluetooth :
$ ls -lA /sys/class/bluetooth/ total 0 lrwxrwxrwx 1 root root 0 Dec 8 09:35 hci0 -> ../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0 lrwxrwxrwx 1 root root 0 Dec 8 09:35 hci1 -> ../../devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci1
That’s from my Raspberry Pi, with a builtin adapter on the /dev/ttyAMA0 UART interface, and an added Bluetooth adapter on USB. The information in the symlink target technically tells you which physical port the adapter is plugged into.
If you’re not familiar with the convention for USB device numbering (which forms a tree of nodes, since a port can have a USB hub with multiple additional ports, etc), look under /sys/bus/usb/devices, and match that up with the «lsusb» output and you should figure it out. In my case, «lsusb» shows that adapter as «Bus 001 Device 004: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0», which if I recall corresponds to the «1-3» stuff in the /sys/class/bluetooth path (where unfortunately it appears the bus value uses index origin 1, while the device number uses index origin 0 so the 4 turns into a 3 there).
If you experiment with moving your USB adapter around to different physical ports, you should be able to work out the pattern.
How to check bluetooth status via terminal
I suppose I needed to word my question better. This answer provides me with what I need. With this I can see if my device is on or off based on whether or not it shows up. Thank you for your reply.
More information with hciconfig -a
hciconfig -a provides way more information, including the Bluetooth version.
$ hciconfig -a hci0: Type: Primary Bus: USB BD Address: 00:1A:7D:DC:70:13 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN RX bytes:1013 acl:0 sco:0 events:60 errors:0 TX bytes:4890 acl:0 sco:0 commands:60 errors:0 Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'hostname' Class: 0x1c0104 Service Classes: Rendering, Capturing, Object Transfer Device Class: Computer, Desktop workstation HCI Version: 4.0 (0x6) Revision: 0x22bb LMP Version: 4.0 (0x6) Subversion: 0x22bb Manufacturer: Cambridge Silicon Radio (10)
Just press Ctrl + Alt + T on your keyboard to open Terminal. When it opens, You can run this command to see the status of bluetooth
sudo service bluetooth status
after you enter your password, you should see something like
Regardless of whether or not the bluetooth is on i get the same message from that command: bluetooth start/running, process 1132
The Bluetooth icon disappeared.I get the following message. Can anyone please help me what this mean?
ashoke@Dell-3470:~$ sudo service bluetooth status ● bluetooth.service — Bluetooth service Mar 09 15:16:42 Dell-3470 bluetoothd[1141]: Starting SDP server Mar 09 15:16:42 Dell-3470 bluetoothd[1141]: Bluetooth management interface 1.14> Mar 09 16:35:14 Dell-3470 bluetoothd[1141]: Failed to set mode: Failed (0x03) Mar 09 16:35:59 Dell-3470 bluetoothd[1141]: Failed to set mode: Failed (0x03) Mar 09 16:36:01 Dell-3470 bluetoothd[1141]: Failed to set mode: Failed (0x03) Mar 09 16:36:04 Dell-3470 bluetoothd[1141]: Failed to set mode: Failed (0x03) lines 1-20/20 (END)
This answer was correct for me. I wanted to see if it was active and it said so, I think this answers the question. Thanks for the help:)
An alternative is to use the command hciconfig . It will list clearly the interfaces, and you will see by the marker «RUNNING» or «DOWN» what is their current status.
With BlueZ: Using bluetoothctl (interactive bluetooth control tool), which gives you a terminal with show and these other commands:
[bluetooth]# help Menu main: Available commands: ------------------- advertise Advertise Options Submenu scan Scan Options Submenu gatt Generic Attribute Submenu list List available controllers show [ctrl] Controller information select Select default controller devices List available devices paired-devices List paired devices system-alias Set controller alias reset-alias Reset controller alias power Set controller power pairable Set controller pairable mode discoverable Set controller discoverable mode discoverable-timeout [value] Set discoverable timeout agent Enable/disable agent with given capability default-agent Set agent as the default one advertise Enable/disable advertising with given type set-alias Set device alias scan Scan for devices info [dev] Device information pair [dev] Pair with device trust [dev] Trust device untrust [dev] Untrust device block [dev] Block device unblock [dev] Unblock device remove Remove device connect Connect device disconnect [dev] Disconnect device menu Select submenu version Display version quit Quit program exit Quit program help Display help about this program export Print environment variables
With bluez-tools: bt-* ( apropos bt- ) like bt-device , a bluetooth device manager.