The following commit has been merged in the master branch:
commit fad1a2e23b9bf99c5523ea89b44b53ac026588b5
Author: Nicolas Dandrimont <nicolas.dandrim...@crans.org>
Date:   Thu May 19 22:50:41 2011 +0200

    Add patch to fix libusb initialization

diff --git a/debian/changelog b/debian/changelog
index 039c04a..a65c681 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,9 @@ ocaml-usb (1.2.0-1) unstable; urgency=low
     - Bump required Lwt version to 2.3.0
     - Drop 0001-Move-the-cmxs-rule-to-Before_rules.patch
   * Make the -dev package depend on libusb-1.0-0-dev
+  * Add patch to fix the initialization of libusb
 
- -- Nicolas Dandrimont <nicolas.dandrim...@crans.org>  Thu, 19 May 2011 
22:40:33 +0200
+ -- Nicolas Dandrimont <nicolas.dandrim...@crans.org>  Thu, 19 May 2011 
22:49:34 +0200
 
 ocaml-usb (1.0-1) unstable; urgency=low
 
diff --git 
a/debian/patches/0001-Register-the-pollfds-created-before-the-handlers-are.patch
 
b/debian/patches/0001-Register-the-pollfds-created-before-the-handlers-are.patch
new file mode 100644
index 0000000..0340bda
--- /dev/null
+++ 
b/debian/patches/0001-Register-the-pollfds-created-before-the-handlers-are.patch
@@ -0,0 +1,41 @@
+From: Nicolas Dandrimont <nicolas.dandrim...@crans.org>
+Date: Thu, 19 May 2011 22:47:16 +0200
+Subject: Register the pollfds created before the handlers are registered
+
+Patch forwarded (and applied) upstream in
+https://forge.ocamlcore.org/plugins/scmdarcs/cgi-bin/darcsweb.cgi?r=ocaml-usb/ocaml-usb;a=commit;h=20110519163209-c41ad-dd065e2dac213cf793b1cf9a3ee193bea88177cc.gz
+https://forge.ocamlcore.org/plugins/scmdarcs/cgi-bin/darcsweb.cgi?r=ocaml-usb/ocaml-usb;a=commit;h=20110519193825-c41ad-4b108fe46b693e4b262442602c8f761bd5bedbd4.gz
+---
+ src/usb_stubs.c |   15 +++++++++++++++
+ 1 files changed, 15 insertions(+), 0 deletions(-)
+
+diff --git a/src/usb_stubs.c b/src/usb_stubs.c
+index b9f0e9d..a072c7f 100644
+--- a/src/usb_stubs.c
++++ b/src/usb_stubs.c
+@@ -140,9 +140,24 @@ static void ml_usb_remove_pollfd(int fd, void *user_data)
+ 
+ CAMLprim value ml_usb_init()
+ {
++
++  const struct libusb_pollfd** pollfds = NULL;
++
++  int i = 0;
++
+   int res = libusb_init(NULL);
+   if (res) ml_usb_error(res, "init");
+ 
++  pollfds = libusb_get_pollfds(NULL);
++
++
++  if (pollfds) {
++    for (i = 0; pollfds[i] != NULL; i++ ) {
++      ml_usb_add_pollfd(pollfds[i]->fd, pollfds[i]->events, NULL);
++    }
++    free(pollfds);
++  }
++
+   libusb_set_pollfd_notifiers(NULL,
+                               ml_usb_add_pollfd,
+                               ml_usb_remove_pollfd,
+-- 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ced054b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Register-the-pollfds-created-before-the-handlers-are.patch

-- 
ocaml-usb packaging

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to