bluez-utils 3.9: Add patch to handle EINTR while being attached to uart properly.
authorPaul Sokolovsky <pmiscml@gmail.com>
Mon, 12 Feb 2007 18:32:28 +0000 (18:32 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Mon, 12 Feb 2007 18:32:28 +0000 (18:32 +0000)
* EINTR is not really an error, but a Unix (mis)feature, and requires special
handling (i.e. retrying). Bluez authors/maintainers really should do a bit of trivial
Unix programming reading before wring BT stacks.
* Specifically EINTR happens when resuming from suspend. So, with this patch
(and assuming there're no weird APM scripts), configured BT finally survives
suspend/resume (tested on h4000). Hurrah!

packages/bluez/bluez-utils.inc
packages/bluez/bluez-utils/handle-eintr.patch [new file with mode: 0644]
packages/bluez/bluez-utils_3.9.bb

index 912c419..21cbea1 100644 (file)
@@ -11,7 +11,8 @@ LICENSE = "GPL"
 SRC_URI = "http://bluez.sourceforge.net/download/bluez-utils-${PV}.tar.gz \
        file://hcid.conf \
        file://02dtl1_cs.sh \
-       file://hciattach-ti-bts.patch;patch=1"
+       file://hciattach-ti-bts.patch;patch=1 \
+        file://handle-eintr.patch;patch=1"
 
 # Almost all serial CF cards w/ manfid 0x0000,0x0000 seem to use the bcs protocol
 # Let's default to that instead of 'any' until further notice...
diff --git a/packages/bluez/bluez-utils/handle-eintr.patch b/packages/bluez/bluez-utils/handle-eintr.patch
new file mode 100644 (file)
index 0000000..effe5d9
--- /dev/null
@@ -0,0 +1,23 @@
+--- bluez-utils-3.9.org/tools/hciattach.c      2007-01-28 20:16:48.000000000 +0000
++++ bluez-utils-3.9/tools/hciattach.c  2007-02-12 16:50:49.000000000 +0000
+@@ -1135,7 +1256,7 @@
+ int main(int argc, char *argv[])
+ {
+       struct uart_t *u = NULL;
+-      int detach, printpid, opt, i, n, ld;
++      int detach, printpid, opt, i, n, ld, err;
+       int to = 5; 
+       int init_speed = 0;
+       int send_break = 0;
+@@ -1286,7 +1414,10 @@
+       while (!__io_canceled) {
+               p.revents = 0;
+-              if (poll(&p, 1, 500))
++              err = poll(&p, 1, 500);
++              if (err < 0 && errno == EINTR)
++                      continue;
++              if (err)
+                       break;
+       }