Skip to contentSkip to conversation

gatt: Fix sending indications with proxy

PATCH Applied Yunhan Wang 2 participants 5 messages Oct 3, 2017 – Oct 5, 2017 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gatt: Fix sending indications with proxy

When using AcquireNotify with indication, the proxy needs to be filled in send_notification_to_devices so as to get indication confirmation in applciation.

---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gatt-database.c +1 -1
index 0c84b2569..47304704a 100644
@@ -1831,7 +1831,7 @@ static bool pipe_io_read(struct io *io, void *user_data)
 				buf, bytes_read,
 				gatt_db_attribute_get_handle(chrc->ccc),
 				chrc->props & BT_GATT_CHRC_PROP_INDICATE,
-				NULL);
+				chrc->proxy);
 
 	return true;
 }
Signature · 1 line
2.14.2.822.g60be5d43e6-goog
#1 lore raw

Hi Yunhan,

Quoted 21 lines · Yunhan Wang

When using AcquireNotify with indication, the proxy needs to be filled in send_notification_to_devices so as to get indication confirmation in applciation.

---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gatt-database.c +1 -2
index 0c84b2569..47304704a 100644
@@ -1831,7 +1831,7 @@ static bool pipe_io_read(struct io *io, void *user_data)
                                buf, bytes_read,
                                gatt_db_attribute_get_handle(chrc->ccc),
                                chrc->props & BT_GATT_CHRC_PROP_INDICATE,
-                               NULL);
+                               chrc->proxy);
 
        return true;
 }
--
Quoted 1 line

2.14.2.822.g60be5d43e6-goog

Im not sure this the correct fix, the reason why the proxy is NULL is because the fd is being used for io, though the confirmation has no effect on the flow control Id expect some inband signalling in this case but that might actually require something like a socketpair in order to be able to write confirmation back.

Signature · 1 line
Luiz Augusto von Dentz
#2 lore raw

Hi, Luiz

Quoted 21 lines · Luiz Augusto von Dentz

Hi Yunhan,

Quoted 18 lines · Yunhan Wang

When using AcquireNotify with indication, the proxy needs to be filled in send_notification_to_devices so as to get indication confirmation in applciation.

---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gatt-database.c +1 -1
index 0c84b2569..47304704a 100644
@@ -1831,7 +1831,7 @@ static bool pipe_io_read(struct io *io, void *user_data)
                                buf, bytes_read,
                                gatt_db_attribute_get_handle(chrc->ccc),
                                chrc->props & BT_GATT_CHRC_PROP_INDICATE,
-                               NULL);
+                               chrc->proxy);
 
Quoted 11 lines
Quoted 4 lines
src/gatt-database.c +0 -1
        return true;
 }
--

2.14.2.822.g60be5d43e6-goog

Im not sure this the correct fix, the reason why the proxy is NULL is because the fd is being used for io, though the confirmation has no effect on the flow control Id expect some inband signalling in this case but that might actually require something like a socketpair in order to be able to write confirmation back.

I think pipe_io_read should be pretty similar to property_changed_cb
in https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n2103,
both are used to handle the written value from application. Therefore, send_notification_to_devices should be fine here with proxy. For "socketpair", I guess you concern is Confirm? If Confirm is defined in application, then confirmation should be able to be sent back to application. If Confirm is not defined, it should be also fine in
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n883.

Quoted 2 lines

--
Luiz Augusto von Dentz

Thanks
Best wishes
Yunhan

#3 lore raw

Hi, Luiz

With this change, all are working fine via using AcquireWrite and AcquireNotify now in my end. I have not yet see any issue so far. Any other concern or better idea?

Thanks
Best wishes
Yunhan

Quoted 50 lines · Yunhan Wang

Hi, Luiz

Quoted 21 lines · Luiz Augusto von Dentz

Hi Yunhan,

Quoted 18 lines · Yunhan Wang

When using AcquireNotify with indication, the proxy needs to be filled in send_notification_to_devices so as to get indication confirmation in applciation.

---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gatt-database.c +1 -1
index 0c84b2569..47304704a 100644
@@ -1831,7 +1831,7 @@ static bool pipe_io_read(struct io *io, void *user_data)
                                buf, bytes_read,
                                gatt_db_attribute_get_handle(chrc->ccc),
                                chrc->props & BT_GATT_CHRC_PROP_INDICATE,
-                               NULL);
+                               chrc->proxy);
 
Quoted 11 lines
Quoted 4 lines
src/gatt-database.c +0 -1
        return true;
 }
--

2.14.2.822.g60be5d43e6-goog

Im not sure this the correct fix, the reason why the proxy is NULL is because the fd is being used for io, though the confirmation has no effect on the flow control Id expect some inband signalling in this case but that might actually require something like a socketpair in order to be able to write confirmation back.

I think pipe_io_read should be pretty similar to property_changed_cb
in https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n2103,
both are used to handle the written value from application. Therefore, send_notification_to_devices should be fine here with proxy. For "socketpair", I guess you concern is Confirm? If Confirm is defined in application, then confirmation should be able to be sent back to application. If Confirm is not defined, it should be also fine in
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n883.

Quoted 2 lines

--
Luiz Augusto von Dentz

Thanks
Best wishes
Yunhan

maintainer Applied
#4 lore raw

Hi Yunhan,

Quoted 6 lines · Yunhan Wang

Hi, Luiz

With this change, all are working fine via using AcquireWrite and AcquireNotify now in my end. I have not yet see any issue so far. Any other concern or better idea?

Quoted 51 lines

Thanks
Best wishes
Yunhan

Quoted 46 lines · Yunhan Wang

Hi, Luiz

Quoted 21 lines · Luiz Augusto von Dentz

Hi Yunhan,

Quoted 18 lines · Yunhan Wang

When using AcquireNotify with indication, the proxy needs to be filled in send_notification_to_devices so as to get indication confirmation in applciation.

---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gatt-database.c +1 -1
index 0c84b2569..47304704a 100644
@@ -1831,7 +1831,7 @@ static bool pipe_io_read(struct io *io, void *user_data)
                                buf, bytes_read,
                                gatt_db_attribute_get_handle(chrc->ccc),
                                chrc->props & BT_GATT_CHRC_PROP_INDICATE,
-                               NULL);
+                               chrc->proxy);
 
Quoted 11 lines
Quoted 4 lines
src/gatt-database.c +0 -1
        return true;
 }
--

2.14.2.822.g60be5d43e6-goog

Im not sure this the correct fix, the reason why the proxy is NULL is because the fd is being used for io, though the confirmation has no effect on the flow control Id expect some inband signalling in this case but that might actually require something like a socketpair in order to be able to write confirmation back.

I think pipe_io_read should be pretty similar to property_changed_cb
in https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n2103,
both are used to handle the written value from application. Therefore, send_notification_to_devices should be fine here with proxy. For "socketpair", I guess you concern is Confirm? If Confirm is defined in application, then confirmation should be able to be sent back to application. If Confirm is not defined, it should be also fine in
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n883.

Quoted 2 lines

--
Luiz Augusto von Dentz

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz