Not seeing BLE device advertising unless set bluetoothctl transport le - bluetooth

I'm using bluetoothctl 5.53 to scan for BLE advertisement. Initially, I tried bluetoothctl scan on but I'm not seeing the device advertising. I scanned with the nRfConnect app and was able to verify that the device is indeed advertising. Just not seeing it with the bluetoothctl.
After some searches, I found the following setting allows me to discover the advertising BLE device:
$bluetoothctl
[bluetooth]# menu scan
[bluetooth]# transport le
[bluetooth]# scan on
After looking through the bluez documentation, I saw this and it suggested the default bluetoothctl should be able to discover BLE devices:
string Transport (Default "auto")
Transport parameter determines the type of
scan.
Possible values:
"auto" - interleaved scan
"bredr" - BR/EDR inquiry
"le" - LE scan only
If "le" or "bredr" Transport is requested,
and the controller doesn't support it,
org.bluez.Error.Failed error will be returned.
If "auto" transport is requested, scan will use
LE, BREDR, or both, depending on what's
currently enabled on the controller.
Doc here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt#n95
However, this StackOverflow post suggests that the default filter might blocking me from seeing a lot of advertising devices: How to use bluetoothctl like hcitool lescan to report repeated proximity beacons
I also ran this to clear the filter setting, but I'm still not seeing any BLE devices
$bluetoothctl
[bluetooth]# menu scan
[bluetooth]# clear
[bluetooth]# back
[bluetooth]# scan on
So my question is:
why am I not seeing BLE device advertising with just bluetoothctl scan on?
is there a way to set the transport le permanently? So that everytime I do bluetoothctl scan on it looks for BLE devices?

Related

Disable BT pairing security pin on Embedded Linux device

I have an embedded Linux board running a Yocto Linux image containing BlueZ.
I want to activate the HCI bluetooth device advertising mode and disable the pairing security.
I want to scan for the device with my smartphone and connect directly without security PI, just like any Audio device (JBL, ...).
I tried many methods using (bluetoothctl and other tools) but without success.
Is there a way to achieve this?
Thanks in advance,
Talel
Set IOCapability of your device to NoInputNoOutput then pairing will happen but it won't ask for any confirmation similar to BT headsets.
bluetoothctl command line tool has option to set IOCapability. Set capability and check.
$bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent NoInputNoOutput
Agent registered

BLUETOOTH - Linux: Changing advertisement of appearance with bluetoothctl fails

I like to use a RaspberryPi to act as HeartRate Sensor and transmit these data via BLTH to other Health/Sport-Apps.
Finally all is working fine with python and bluez I'm able to create a BLTH GATT Server and advertise HR-Data via Service 0x180d.
The last problem is I'm not able to change the Appearance of the BLTH in Generic Access (0x1800). Apprearance is to find here with UUID: 0x2A01.
I tryed to do this the manual way via bluetoothctl:
menu advertise
appearance 833 (for HeartRate)
appearance on
back
advertise on
This will fail with: Failed to register advertisement: org.bluez.Error.Failed
nevermind to which value i change the apperance (also if the value is well known and accepted) it fail the advertisement.
If i switch appearance off it will start advertisment.
Any hint, what do to or what I just missed?
I already updated bluez from 5.50 to 5.54
also used bluez in experimental mode
and using newest raspian os with all updates
Many thanks for help
These are the steps that I used on my Raspberry Pi:
pi#raspberrypi:~ $ bluetoothctl
[bluetooth]# menu advertise
[bluetooth]# clear
[bluetooth]# uuids 0x180D
[bluetooth]# appearance 833
[bluetooth]# name heart_test
[bluetooth]# discoverable on
[bluetooth]# back
[bluetooth]# advertise on
[CHG] Controller 00:02:5B:03:44:07 SupportedInstances: 0x04
[CHG] Controller 00:02:5B:03:44:07 ActiveInstances: 0x01
Advertising object registered
UUID: Heart Rate(0x180D)
Tx Power: off
LocalName: heart_test
Appearance: Heart Rate Belt (0x0341)
Discoverable: on
[bluetooth]#
And it gave me this on me this in the nRF app when I scanned for it:

Can't disconnect from a bonded BLE device (programming the BLE HID device)

I'm running a BLE HID device on a Sparkfun Artemis Thing Plug board. I can pair with the board and it works as a keyboard. What doesn't work is that, after pairing, I can't connect/disconnect. For example, if I look at my smart watch on my iPhone, the options for it look like follows:
Disconnect option in the iPhone menu
But for my HID device that's all there is:
Lacking the disconnect option in the iPhone menu
As you can see there is no Disconnect option. That's what I want to have for my HID device. I know that in order for the devices to pair only once they actually have to bond (pairing + saving the security information for any future connections). They bond correctly for sure. Resetting the HID BLE device results in iPhone and the device reconnecting. I just can't disconnect from the device with keeping the bonding information. I can only Forget the device.
Is it that the BLE device doesn't advertise properly and iPhone assumes that it's not a device that can be connected and disconnected from?
For some strange reasons Apple has decided that it should not be possible to disconnect HID devices, only unpair them.

Detect mobile phone presence with Bluetooth usb dongle.

I am using BeagleBone Black and Bluetooth USB dongle V4.0. My dongle is detecting iBeacons with no problems but is there any way to detect mobile phones with bluetooth on. I am using NodeJs and Noble package.
So when I use hcitool lescan it's not finding mobile phone either but with hcitool there is option scan. When I call hcitool scan in terminal I get my mobile as result. Is there any NodeJs package that wraps this option. I have no need to connect to mobile device, I just need to discover it's presence, and see it's MAC address.
If you can see your device with "hcitool scan" and not with "hcitool lescan" it means your phone(or BT stack you use in phone) don't support BLE protocol. Not all BT devices are BLE capable.

Bluetooth profile info in linux

As bluetooth device has a number of bluetooth profiles. when want to do communication is bluetooth device, first pair bluetooth device and then starts sending data using bluetooth.
In linux, hcitool is used to scan nearby bluetooth devices.
Questions:
1) How can i know which bluetooth profile is supported by selected nearby bluetooth device?Is there any particular command to know bluetooth profile supported by selected nearby bluetooth device in linux?
2) suppose, i come to know selected nearby bluetooth device support abcd and xyz bluetooth profiles. How can i select particular bluetooth profile in linux?, example abcd out of supported profiles.
2) How can i connect to that selected bluetooth device as SPP profile for transferring data as serial port in linux?
Regards,
Sukhdeep Singh
In linux, sdptool utility is provided with which you can search your own device supported profiles and other devices supported profiles(sdptool browse local/).
Since you know the peer device support abcd/xyz profile, you dont have to select any profile, you have to intiate a profile level connection request(pairing/authentication also needs to be taken care)
For SPP connection, rfcomm tool is provided by bluez

Resources