[PATCH] android/hal-health: Clear NONBLOCK flag from fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Java expects file descriptor passed with channel_state_cb() to be
blocking.
---
 android/hal-health.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/android/hal-health.c b/android/hal-health.c
index 858d499..2ff19ab 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -19,6 +19,8 @@
 #include <stddef.h>
 #include <string.h>
 #include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "hal-log.h"
 #include "hal.h"
@@ -44,6 +46,13 @@ static void handle_app_registration_state(void *buf, uint16_t len, int fd)
 static void handle_channel_state(void *buf, uint16_t len, int fd)
 {
 	struct hal_ev_health_channel_state *ev = buf;
+	int flags;
+
+	if ((flags = fcntl(fd, F_GETFL, 0)) < 0)
+		flags = 0;
+
+	fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
+
 
 	if (cbacks->channel_state_cb)
 		cbacks->channel_state_cb(ev->app_id, (bt_bdaddr_t *) ev->bdaddr,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux