Skip to contentSkip to conversation

Bluetooth: Add HCI_RSSI_INVALID for unknown RSSI value

RFC In review Marcel Holtmann 3 participants 10 messages Dec 4, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

RFC 1/6 Bluetooth: Add HCI_RSSI_INVALID for unknown RSSI value

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
 include/net/bluetooth/hci.h | 1 +
 1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +1 -0
index 569c077778b6..b6f7be1eb919 100644
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127
 
 #define HCI_ROLE_MASTER		0x00
 #define HCI_ROLE_SLAVE		0x01
Signature · 1 line
1.9.3
#1 lore raw

Hi Marcel,

Quoted 13 lines · On Thursday 04 of December 2014 10:13:56 Marcel Holtmann wrote:

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
 include/net/bluetooth/hci.h | 1 +
 1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 4 lines
include/net/bluetooth/hci.h +0 -0
 #define HCI_ROLE_MASTER		0x00
 #define HCI_ROLE_SLAVE		0x01
 
Signature · 2 lines
Best regards, 
Szymon Janc
author maintainer
#2 lore raw

Hi Szymon,

Quoted 14 lines
Quoted 14 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644
@@ -412,6 +412,7 @@ enum {
 
Quoted 5 lines

include/net/bluetooth/hci.h enum { · line 415

Quoted 3 lines
include/net/bluetooth/hci.h +1 -0
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

we use it for the mgmt side of things and there it is whatever we want it to be.

Regards

Marcel

#3 lore raw

Hi Marcel,

Quoted 16 lines · On Thursday 04 of December 2014 11:13:08 Marcel Holtmann wrote:

Hi Szymon,

Quoted 14 lines
Quoted 14 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644
@@ -412,6 +412,7 @@ enum {
 
Quoted 7 lines
Quoted 5 lines

include/net/bluetooth/hci.h enum { · line 415

Quoted 3 lines
include/net/bluetooth/hci.h +1 -0
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Quoted 5 lines

Regards

Marcel

Signature · 2 lines
Best regards, 
Szymon Janc
#4 lore raw

Hi,

Quoted 25 lines · On Thursday 04 of December 2014 11:24:03 Szymon Janc wrote:

Hi Marcel,

Quoted 22 lines · On Thursday 04 of December 2014 11:13:08 Marcel Holtmann wrote:

Hi Szymon,

Quoted 19 lines
Quoted 13 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 4 lines
Quoted 1 line

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

Signature · 2 lines
Best regards, 
Szymon Janc
author maintainer
#5 lore raw

Hi Szymon,

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 13 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

I checked for LE. There is clearly says 127 means RSSI not available.

Regards

Marcel

#6 lore raw

Hi Marcel,

Quoted 22 lines · On Thursday 04 of December 2014 11:38:35 Marcel Holtmann wrote:

Hi Szymon,

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 13 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

I checked for LE. There is clearly says 127 means RSSI not available.

I meant that 0 RSSI is legal for both LE and BR/EDR but it is used in mgmt device found event as 'RSSI not available'.

Signature · 2 lines
Best regards, 
Szymon Janc
#7 lore raw

Hi Szymon,

Quoted 28 lines · Szymon Janc
Quoted 27 lines · On Thursday 04 of December 2014 11:38:35 Marcel Holtmann wrote:

Hi Szymon,

Quoted 25 lines
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644
@@ -412,6 +412,7 @@ enum {
 
Quoted 7 lines
Quoted 5 lines

include/net/bluetooth/hci.h enum { · line 415

Quoted 3 lines
include/net/bluetooth/hci.h +1 -0
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

I checked for LE. There is clearly says 127 means RSSI not available.

I meant that 0 RSSI is legal for both LE and BR/EDR but it is used in mgmt device found event as 'RSSI not available'.

On adapters that generate such events you will never see any other type of discovery results (because the HW isn't capable of it), so what the value is doesn't really matter if all the events have the same one. For consistency however we could change this from 0 to 127.

Johan

#8 lore raw

Hi Johan,

Quoted 35 lines · On Thursday 04 of December 2014 14:08:04 Johan Hedberg wrote:

Hi Szymon,

Quoted 32 lines · Szymon Janc
Quoted 30 lines · On Thursday 04 of December 2014 11:38:35 Marcel Holtmann wrote:

Hi Szymon,

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 13 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

I checked for LE. There is clearly says 127 means RSSI not available.

Quoted 7 lines
Quoted 2 lines

I meant that 0 RSSI is legal for both LE and BR/EDR but it is used in mgmt device found event as 'RSSI not available'.

On adapters that generate such events you will never see any other type of discovery results (because the HW isn't capable of it), so what the value is doesn't really matter if all the events have the same one. For consistency however we could change this from 0 to 127.

Wouldn't that affect on how daemon invalidate RSSI after discovery is finished? ie RSSI would change from 127 back to 0? At least on daemon side 0 RSSI was treated as special case.

Signature · 2 lines
Best regards, 
Szymon Janc
#9 lore raw

Hi Szymon,

Quoted 39 lines · Szymon Janc
Quoted 38 lines · On Thursday 04 of December 2014 14:08:04 Johan Hedberg wrote:

Hi Szymon,

Quoted 34 lines · Szymon Janc
Quoted 22 lines · On Thursday 04 of December 2014 11:38:35 Marcel Holtmann wrote:

Hi Szymon,

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 13 lines

The Bluetooth core specification defines the value 127 as invalid for RSSI values. So instead of hard coding it, lets add a constant for it.

---
include/net/bluetooth/hci.h | 1 +

1 file changed, 1 insertion(+)
include/net/bluetooth/hci.h +0 -0
index 569c077778b6..b6f7be1eb919 100644

include/net/bluetooth/hci.h enum { · line 415

Quoted 4 lines
include/net/bluetooth/hci.h +1 -0
@@ -412,6 +412,7 @@ enum {
 
 /* The core spec defines 127 as the "not available" value */
 #define HCI_TX_POWER_INVALID	127
+#define HCI_RSSI_INVALID	127

Isn't that value depending on command, event, link and controller type?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

we use it for the mgmt side of things and there it is whatever we want it to be.

At least for inquiry result (no RSSI) 0 is passed to mgmt_device_found() and that seems to be used by userspace as RSSI unavailable.

Which is strange btw, since both for LE and BR/EDR this is legal RSSI value...

I checked for LE. There is clearly says 127 means RSSI not available.

I meant that 0 RSSI is legal for both LE and BR/EDR but it is used in mgmt device found event as 'RSSI not available'.

Quoted 8 lines
Quoted 4 lines

On adapters that generate such events you will never see any other type of discovery results (because the HW isn't capable of it), so what the value is doesn't really matter if all the events have the same one. For consistency however we could change this from 0 to 127.

Wouldn't that affect on how daemon invalidate RSSI after discovery is finished? ie RSSI would change from 127 back to 0? At least on daemon side 0 RSSI was treated as special case.

That's a good point - I'd forgotten about that. It's fixable for future user space versions but changing the kernel behavior would break old user space versions.

Johan