Skip to contentSkip to conversation

Bluetooth: Is it possible to operate Bluez concurrent in central and peripheral role?

DISCUSSION Eisenkolb Thomas 2 participants 6 messages Oct 11, 2018 – Oct 12, 2018 1 message not in the archive Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?
If yes, can you give me some hints what I have to consider to get this case working?
If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Thanks for your answer,
Thomas

#1 lore raw

Hi Thomas,

Quoted 10 lines · Eisenkolb Thomas

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

Quoted 6 lines

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?

BlueZ should work as dual roles already, if it doesn't there could bugs or the controller preventing commands to work properly.

Quoted 1 line

If yes, can you give me some hints what I have to consider to get this case working?

Do you have HCI logs of the problem(s)?

Quoted 1 line

If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Most of upstream effort is on mesh and updates to include 5.0 features, but dual-role is something that we might consider high priority if that is not working properly.

Quoted 5 lines

Thanks for your answer,
Thomas

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw
In reply to a message not in the archive

Hi Thomas,

Quoted 12 lines · Eisenkolb Thomas

Hello,

Thanks for the answer.

I have recorded logs of the exact use cases which I have to realize.

The following MAC-Addresses of the devices are important:
- Embedded Linux device: "78-C4-0E-80-07-CD"
- Smartphone: "4C-D6-A9-48-CA-0C"
- Sensor device: "88-6B-0F-94-C2-38"

Quoted 4 lines

I wanted to shorten the logs that no information gets lost.

To produce this log I did the following operations in chronological order:
1) start btmgt tool (embedded linux)

You shouldn't need to btmgmt for these use cases, bluetoothctl can manage advertisements.

Quoted 10 lines

2) call btmgt info (embedded linux)
3) Register advertising instances (embedded linux as peripheral)
4) Scan for advertising devices (Smartphone as central)
5) Stop scan for advertising devices(Smartphone as central)
6) Connect to embedded linux device (Smartphone as central) -> established
7) Start scan for advertising devices(embedded linux as central)
8) Stop scan for advertising devices(embedded linux as central)
9) Connect to sensor(embedded linux as central)
-> Failed

I don't see the connection request, perhaps it doesn't happen because we never found it while scanning? Does the connection timeout?

Quoted 7 lines

10) Disconnect from embedded Linux(Smartphone as central)
11) Connect to sensor(embedded linux as central)
-> established
12) Connect to embedded linux device(Smartphone as central) -> failed
13) Tray again connect to embedded linux device(Smartphone as central) -> failed

Same thing here, perhaps bluetoothd logs would tell why it has failed.

Quoted 3 lines

There are three log files in the attachments which have been recorded concurrent. One from "btmgt", "bluetoothctl" and "btmon".

Don't mix btmgmt with bluetoothd, btmgmt is more of a debug tool for testing the kernel interface directly instead of using D-Bus but using both is not recommended.

Quoted 2 lines

As you will see in the logs from the sight of the embedded device I was just able to establish one connection concurrent. Whether peripheral connection or a central connection but not both at the same time.

I see a lot of reports which means we are scanning but it looks like there is never a connection attempt, except for the ones that does succeed.

Quoted 1 line

If the embedded device acts just as central device, it is possible to establish more connections to different sensors at the same time.

That is really weird because the only difference is that you would not be advertising, this could be a problem with the controller though, have you tried any other controller to see if it has the same behaviour?

Quoted 43 lines

Thanks for your help.

Best Regards,
Thomas

Hi Thomas,

Quoted 10 lines · Eisenkolb Thomas

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

Quoted 6 lines

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?

BlueZ should work as dual roles already, if it doesn't there could bugs or the controller preventing commands to work properly.

Quoted 1 line

If yes, can you give me some hints what I have to consider to get this case working?

Do you have HCI logs of the problem(s)?

Quoted 1 line

If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Most of upstream effort is on mesh and updates to include 5.0 features, but dual-role is something that we might consider high priority if that is not working properly.

Quoted 5 lines

Thanks for your answer,
Thomas

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw
Quoted 15 lines

Hi Thomas,

Quoted 12 lines · Eisenkolb Thomas

Hello,

Thanks for the answer.

I have recorded logs of the exact use cases which I have to realize.

The following MAC-Addresses of the devices are important:
- Embedded Linux device: "78-C4-0E-80-07-CD"
- Smartphone: "4C-D6-A9-48-CA-0C"
- Sensor device: "88-6B-0F-94-C2-38"

Quoted 6 lines
Quoted 4 lines

I wanted to shorten the logs that no information gets lost.

To produce this log I did the following operations in chronological order:
1) start btmgt tool (embedded linux)

You shouldn't need to btmgmt for these use cases, bluetoothctl can manage advertisements.

Thanks for the hint. I just started btmgmt to get detailed information about my system in the btmon log.

Quoted 12 lines
Quoted 11 lines

2) call btmgt info (embedded linux)
3) Register advertising instances (embedded linux as peripheral)
4) Scan for advertising devices (Smartphone as central)
5) Stop scan for advertising devices(Smartphone as central)
6) Connect to embedded linux device (Smartphone as central) -> established
7) Start scan for advertising devices(embedded linux as central)
8) Stop scan for advertising devices(embedded linux as central)
9) Connect to sensor(embedded linux as central)
-> Failed

Quoted 2 lines

I don't see the connection request, perhaps it doesn't happen because we never found it while scanning? Does the connection timeout?

Bluetoothctl.log:
The Sensor device is found while scanning. It in line 78.
The connection attempt is visible in the same log in line 103 and also the error that occurred in line 105.

In btmon.log the device was first time discovered at line 3451 and then every 1/2 second.
Discovery gets disabled at line 11824.
After that there should be the connection attempt hci command as it can be seen in Bluetoothctl.log.
In line 11885 the used device is added to the whitelist which seems to success.(At this place I expected to get an connection attempt)

As you said this is strange because no connection attempt reaches the hci interface.

Quoted 1 line
Quoted 1 line

10) Disconnect from embedded Linux(Smartphone as central)

This MGMT Event is at line 12587. The smartphone successfully disconnected from the embedded linux device.

Quoted 2 lines
Quoted 2 lines

11) Connect to sensor(embedded linux as central) -> established

The successful connection event to the sensor is at line 12735.

Quoted 6 lines
Quoted 4 lines

12) Connect to embedded linux device(Smartphone as central) -> failed
13) Tray again connect to embedded linux device(Smartphone as central) -> failed

Same thing here, perhaps bluetoothd logs would tell why it has failed.

Yes this is also strange.
For this I will have a look at the bluetoothd logs.

Quoted 6 lines
Quoted 4 lines

There are three log files in the attachments which have been recorded concurrent. One from "btmgt", "bluetoothctl" and "btmon".

Don't mix btmgmt with bluetoothd, btmgmt is more of a debug tool for testing the kernel interface directly instead of using D-Bus but using both is not recommended.

Thanks for the hint. For future I will just use bluetoothctl.

Quoted 5 lines
Quoted 3 lines

As you will see in the logs from the sight of the embedded device I was just able to establish one connection concurrent. Whether peripheral connection or a central connection but not both at the same time.

I see a lot of reports which means we are scanning but it looks like there is never a connection attempt, except for the ones that does succeed.

I fully agree. I just see the attempt in the logs of bluetoothctl but no attempt reaches the hci interface. Is it in general from the blueZ side possible to have a central and a peripheral connection opened parallel at the same time? I just get more than one connections to peripherals at the same time and this works fine.

Quoted 4 lines
Quoted 2 lines

If the embedded device acts just as central device, it is possible to establish more connections to different sensors at the same time.

That is really weird because the only difference is that you would not be advertising, this could be a problem with the controller though, have you tried any other controller to see if it has the same behaviour?

Actually I am using the SPB209A Module from HD Wireless.
I don't have any other module that supports Bluetooth >= 4.1(As I found this is the minimum required standard that supports concurrent BLE roles)

Quoted 42 lines
Quoted 42 lines

Thanks for your help.

Best Regards,
Thomas

Hi Thomas,

Quoted 10 lines · Eisenkolb Thomas

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

Quoted 6 lines

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?

BlueZ should work as dual roles already, if it doesn't there could bugs or the controller preventing commands to work properly.

Quoted 1 line

If yes, can you give me some hints what I have to consider to get this case working?

Do you have HCI logs of the problem(s)?

Quoted 1 line

If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Most of upstream effort is on mesh and updates to include 5.0 features, but dual-role is something that we might consider high priority if that is not working properly.

Quoted 5 lines

Thanks for your answer,
Thomas

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Best Regards,
Thomas Eisenkolb

#5 lore raw
In reply to Luiz Augusto von Dentz

Hello Luiz,

I have now tried the same procedure with my desktop linux pc instead of the embedded linux device. The result is the same but I think in the logs is now more useful information.

It is also a Bluetooth 4.2 hardware but this time with an intel chipset.

I have tried two cases(the same procedure as before).
1) first I established a connection from the smartphone to the desktop(desktop as peripheral device)
2) try to establish a connection from desktop to the sensor(desktop as central device) using the command "connect 88:...." in blutoothctl tool while the connection between smartphone and desktop is still established The device was successfully discovered and is still available and waiting for connection.
a) desktop starts passive device scan.
b) sensor sends scan response.
c) after the scan response is received, desktop disables the device scan
d) no further action at hci interface(expected le connection attempt command)
e) bluetoothctl runs into timeout and logs "Failed to connect: org.bluez.Error.Failed"

After that I disconnected the smartphone from the desktop and did the same as mentioned in point 2.
The only difference in this case is that the connection attempt command is immediately sent after the passive device scan is disabled(point 2.c).

Maybe this is more helpful than the last answer.

Should I set any special flags that I get it to work?

Thanks.

Best Regards,
Thomas Eisenkolb

Hi Thomas,

Quoted 10 lines · Eisenkolb Thomas

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

Quoted 6 lines

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?

BlueZ should work as dual roles already, if it doesn't there could bugs or the controller preventing commands to work properly.

Quoted 1 line

If yes, can you give me some hints what I have to consider to get this case working?

Do you have HCI logs of the problem(s)?

Quoted 1 line

If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Most of upstream effort is on mesh and updates to include 5.0 features, but dual-role is something that we might consider high priority if that is not working properly.

Quoted 5 lines

Thanks for your answer,
Thomas

--
Luiz Augusto von Dentz

[bluetooth]# list
Controller 28:16:AD:A1:8C:E4 linux-host [default]
[CHG] Controller 28:16:AD:A1:8C:E4 DiscoverableTimeout: 0x00000000 [CHG] Controller 28:16:AD:A1:8C:E4 Pairable: no
[CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001112-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001801-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001106-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00000f49-9100-4a18-be29-0d27fb00b1e5 [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001105-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001104-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00005005-0000-1000-8000-0002ee000001 [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00000f49-9200-4a18-be29-0d27fb00b1e5 [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001133-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001132-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 SupportedInstances: 0x03
[CHG] Controller 28:16:AD:A1:8C:E4 ActiveInstances: 0x02
[CHG] Controller 28:16:AD:A1:8C:E4 SupportedInstances: 0x03
[CHG] Controller 28:16:AD:A1:8C:E4 ActiveInstances: 0x02
[NEW] Device 6E:8B:61:1D:3C:0E 6E-8B-61-1D-3C-0E
[CHG] Device 6E:8B:61:1D:3C:0E Trusted: yes
[NEW] Primary Service

        /org/bluez/hci0/dev_6E_8B_61_1D_3C_0E/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic
        /org/bluez/hci0/dev_6E_8B_61_1D_3C_0E/service0001/char0002                                                  
        00002a05-0000-1000-8000-00805f9b34fb                                                                        
        Service Changed                                                                                             

[CHG] Device 6E:8B:61:1D:3C:0E UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Device 6E:8B:61:1D:3C:0E UUIDs: 00001801-0000-1000-8000-00805f9b34fb [CHG] Device 6E:8B:61:1D:3C:0E ServicesResolved: yes
[CHG] Device 6E:8B:61:1D:3C:0E Name: Samsung Galaxy S7 edge
[CHG] Device 6E:8B:61:1D:3C:0E Alias: Samsung Galaxy S7 edge [6E-8B-61-1D-3C-0E]# scan on
Discovery started
[CHG] Controller 28:16:AD:A1:8C:E4 Discovering: yes
[NEW] Device 88:6B:0F:4D:F8:8C KalibrierProduktion
[CHG] Device 88:6B:0F:4D:F8:8C Trusted: yes
[NEW] Device 7F:26:92:B3:8E:B1 7F-26-92-B3-8E-B1
[CHG] Device 7F:26:92:B3:8E:B1 Trusted: yes
[NEW] Device 88:6B:0F:94:C2:38 RC Panel BT
[CHG] Device 88:6B:0F:94:C2:38 Trusted: yes
[CHG] Device 7F:26:92:B3:8E:B1 RSSI: -74
[CHG] Device 7F:26:92:B3:8E:B1 AdvertisingFlags:
00 .
[NEW] Device 55:AF:6B:8B:31:AA 55-AF-6B-8B-31-AA
[CHG] Device 55:AF:6B:8B:31:AA Trusted: yes
[NEW] Device 48:82:F8:83:53:67 48-82-F8-83-53-67
[CHG] Device 48:82:F8:83:53:67 Trusted: yes
[NEW] Device 78:C4:0E:80:08:3D 78-C4-0E-80-08-3D
[CHG] Device 78:C4:0E:80:08:3D Trusted: yes
[6E-8B-61-1D-3C-0E]# scan off
[CHG] Device 78:C4:0E:80:08:3D RSSI is nil
[CHG] Device 48:82:F8:83:53:67 RSSI is nil
[CHG] Device 55:AF:6B:8B:31:AA RSSI is nil
[CHG] Device 88:6B:0F:94:C2:38 RSSI is nil
[CHG] Device 7F:26:92:B3:8E:B1 RSSI is nil
[CHG] Device 88:6B:0F:4D:F8:8C RSSI is nil
Discovery stopped
[CHG] Controller 28:16:AD:A1:8C:E4 Discovering: no [6E-8B-61-1D-3C-0E]# connect 88:6B:0F:94:C2:38
Attempting to connect to 88:6B:0F:94:C2:38
[CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001112-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001801-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001106-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001105-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001104-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00005005-0000-1000-8000-0002ee000001 [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001133-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 UUIDs: 00001132-0000-1000-8000-00805f9b34fb [CHG] Controller 28:16:AD:A1:8C:E4 SupportedInstances: 0x05
[CHG] Controller 28:16:AD:A1:8C:E4 ActiveInstances: 0x00
Failed to connect: org.bluez.Error.Failed
[6E-8B-61-1D-3C-0E]# connect 88:6B:0F:94:C2:38
Attempting to connect to 88:6B:0F:94:C2:38
Failed to connect: org.bluez.Error.Failed
[6E-8B-61-1D-3C-0E]# connect 88:6B:0F:94:C2:38
Attempting to connect to 88:6B:0F:94:C2:38
Failed to connect: org.bluez.Error.Failed
[DEL] Device 88:6B:0F:4D:F8:8C KalibrierProduktion
[DEL] Device 7F:26:92:B3:8E:B1 7F-26-92-B3-8E-B1
[DEL] Device 55:AF:6B:8B:31:AA 55-AF-6B-8B-31-AA
[DEL] Device 48:82:F8:83:53:67 48-82-F8-83-53-67
[DEL] Device 78:C4:0E:80:08:3D 78-C4-0E-80-08-3D
[CHG] Device 6E:8B:61:1D:3C:0E ServicesResolved: no
[CHG] Device 6E:8B:61:1D:3C:0E Connected: no
[DEL] Characteristic

        /org/bluez/hci0/dev_6E_8B_61_1D_3C_0E/service0001/char0002
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[DEL] Primary Service
        /org/bluez/hci0/dev_6E_8B_61_1D_3C_0E/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile

[DEL] Device 6E:8B:61:1D:3C:0E Samsung Galaxy S7 edge [bluetooth]# connect 88:6B:0F:94:C2:38 Attempting to connect to 88:6B:0F:94:C2:38 [CHG] Device 88:6B:0F:94:C2:38 Connected: yes Connection successful
[NEW] Primary Service

        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006
        5bea16fb-a785-49d5-a3e4-4c7412e72df1
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0007
        5bea16fb-a785-49d5-a3e4-4c7412e72df2
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0009
        5bea16fb-a785-49d5-a3e4-4c7412e72df3
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char000b
        5bea16fb-a785-49d5-a3e4-4c7412e72df4
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char000d
        5bea16fb-a785-49d5-a3e4-4c7412e72a29
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char000f
        5bea16fb-a785-49d5-a3e4-4c7412e72a24
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0011
        5bea16fb-a785-49d5-a3e4-4c7412e72a25
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0013
        5bea16fb-a785-49d5-a3e4-4c7412e72a26
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0015
        5bea16fb-a785-49d5-a3e4-4c7412e72a27
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0017
        5bea16fb-a785-49d5-a3e4-4c7412e72a28
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0019
        5bea16fb-a785-49d5-a3e4-4c7412e72a19
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0006/char0019/desc001b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c
        6d480f49-91d3-4a18-be29-0d27fb00b1e5
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char001d
        11c3876c-9bda-42cc-a30b-1be83c8059d2
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char001d/desc001f
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char0020
        11c3876c-9bda-42cc-a30b-1be83c8059d3
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char0020/desc0022
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char0023
        11c3876c-9bda-42cc-a30b-1be83c8059d4
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service001c/char0023/desc0025
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0026
        1d14d6ee-fd63-4fa1-bfa4-8f47b42119f0
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0026/char0027
        f7bf3564-fb6d-4e53-88a4-5e37e0326063
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service0026/char0029
        984227f3-34fc-4045-a5d0-2c581f81a153
        Vendor specific
[NEW] Primary Service
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service002b
        1d14d6ee-fd63-4fa1-bfa4-8f47b42119f1
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service002b/char002c
        f7bf3564-fb6d-4e53-88a4-5e37e0326064
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_88_6B_0F_94_C2_38/service002b/char002e
        984227f3-34fc-4045-a5d0-2c581f81a154
        Vendor specific

[CHG] Device 88:6B:0F:94:C2:38 UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Device 88:6B:0F:94:C2:38 UUIDs: 1d14d6ee-fd63-4fa1-bfa4-8f47b42119f0 [CHG] Device 88:6B:0F:94:C2:38 UUIDs: 1d14d6ee-fd63-4fa1-bfa4-8f47b42119f1 [CHG] Device 88:6B:0F:94:C2:38 UUIDs: 5bea16fb-a785-49d5-a3e4-4c7412e72df1 [CHG] Device 88:6B:0F:94:C2:38 UUIDs: 6d480f49-91d3-4a18-be29-0d27fb00b1e5 [CHG] Device 88:6B:0F:94:C2:38 ServicesResolved: yes
[CHG] Device 88:6B:0F:94:C2:38 Appearance: 0x0180
[RC Panel BT]# disconnect
Attempting to disconnect from 88:6B:0F:94:C2:38
[CHG] Device 88:6B:0F:94:C2:38 ServicesResolved: no
Successful disconnected
[CHG] Device 88:6B:0F:94:C2:38 Connected: no
[bluetooth]# exit

HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 #182 [hci0] 42.633052

        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 30.000 msec (0x0030)
        Own address type: Public (0x00)
        Filter policy: Ignore not in white list (0x01)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #183 [hci0] 42.634057

      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                                                 #184 [hci0] 42.634137
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #185 [hci0] 42.635063

      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 33 #186 [hci0] 43.062955

      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 88:6B:0F:94:C2:38 (Bluegiga Technologies OY)
        Data length: 21
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        128-bit Service UUIDs (partial): 1 entry
          Vendor specific (6d480f49-91d3-4a18-be29-0d27fb00b1e5)
        RSSI: -62 dBm (0xc2)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                                                 #187 [hci0] 84.461373
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #188 [hci0] 84.462878

      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
Quoted 1 line

HCI Event: Disconnect Complete (0x05) plen 4 #189 [hci0] 90.966847

        Status: Success (0x00)
        Handle: 3585
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0004} [hci0] 90.966908
        LE Address: 72:D6:27:F0:FB:A3 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0003} [hci0] 90.966908
        LE Address: 72:D6:27:F0:FB:A3 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0002} [hci0] 90.966908
        LE Address: 72:D6:27:F0:FB:A3 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0001} [hci0] 90.966908
        LE Address: 72:D6:27:F0:FB:A3 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                                                                             #190 [hci0] 98.088842
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 30.000 msec (0x0030)
        Own address type: Public (0x00)
        Filter policy: Ignore not in white list (0x01)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #191 [hci0] 98.089843

      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                                                 #192 [hci0] 98.089898
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #193 [hci0] 98.090844

      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 33 #194 [hci0] 98.824017

      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 88:6B:0F:94:C2:38 (Bluegiga Technologies OY)
        Data length: 21
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        128-bit Service UUIDs (partial): 1 entry
          Vendor specific (6d480f49-91d3-4a18-be29-0d27fb00b1e5)
        RSSI: -71 dBm (0xb9)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                                                 #195 [hci0] 98.824101
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #196 [hci0] 98.827834

      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                                                                                                              #197 [hci0] 98.827924
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: 88:6B:0F:94:C2:38 (Bluegiga Technologies OY)
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4 #198 [hci0] 98.829788

      LE Create Connection (0x08|0x000d) ncmd 2
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 19 #199 [hci0] 100.334843

      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 3585
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: 88:6B:0F:94:C2:38 (Bluegiga Technologies OY)
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x00
#6 lore raw

Hi Thomas,

Quoted 8 lines · Eisenkolb Thomas

Hello Luiz,

I have now tried the same procedure with my desktop linux pc instead of the embedded linux device. The result is the same but I think in the logs is now more useful information.

It is also a Bluetooth 4.2 hardware but this time with an intel chipset.

Quoted 9 lines

I have tried two cases(the same procedure as before).
1) first I established a connection from the smartphone to the desktop(desktop as peripheral device)
2) try to establish a connection from desktop to the sensor(desktop as central device) using the command "connect 88:...." in blutoothctl tool while the connection between smartphone and desktop is still established The device was successfully discovered and is still available and waiting for connection.
a) desktop starts passive device scan.
b) sensor sends scan response.
c) after the scan response is received, desktop disables the device scan
d) no further action at hci interface(expected le connection attempt command)
e) bluetoothctl runs into timeout and logs "Failed to connect: org.bluez.Error.Failed"

Perhaps it is because of the following code in the kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/hci_event.c#n5082

Now I wonder it wouldn't be better to remove that line and just let the controller reject it if it don't support connections while being a slave.

Quoted 50 lines

After that I disconnected the smartphone from the desktop and did the same as mentioned in point 2.
The only difference in this case is that the connection attempt command is immediately sent after the passive device scan is disabled(point 2.c).

Maybe this is more helpful than the last answer.

Should I set any special flags that I get it to work?

Thanks.

Best Regards,
Thomas Eisenkolb

Hi Thomas,

Quoted 10 lines · Eisenkolb Thomas

Hello,

I am working with blueZ 5.50 on a linux embedded device with kernel 4.14.

Now I have to implement a use case where the linux embedded device communicates as a central device with a few sensors through Bluetooth LE characteristics and at the same time it should advertise some data and accept at least one incoming connection from a Smartphone as a peripheral device for maintenance cases.

I haven't found any information about blueZ is supporting both LE roles at the same time.
I have already tried it now for 2 days to get this use case to work and I found a few limitations for which I didn't find any solution.

Quoted 6 lines

I was not able to advertise any data while my device had an active connection to a peripheral device.
Also while the Smartphone is connected to my embedded device(peripheral), I don't receive any advertised Data from any sensor and I cannot connect to any sensor.

The Bluetooth Hardware Module which I am using on the embedded Linux System supports Bluetooth 4.2. From the Bluetooth Standard I have found that concurrent use of both Bluetooth Low Energy Roles should be supported since Bluetooth 4.1.

Is it possible from blueZ Stack side to implement this use-case?

BlueZ should work as dual roles already, if it doesn't there could bugs or the controller preventing commands to work properly.

Quoted 1 line

If yes, can you give me some hints what I have to consider to get this case working?

Do you have HCI logs of the problem(s)?

Quoted 1 line

If no, have you got a timeline when it will be supported or is this no planned to implement in near future?

Most of upstream effort is on mesh and updates to include 5.0 features, but dual-role is something that we might consider high priority if that is not working properly.

Quoted 5 lines

Thanks for your answer,
Thomas

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz