Documentation: fix hotplug example
authorMarkus Heidelberg <markus.heidelberg@web.de>
Sun, 2 Feb 2014 14:41:20 +0000 (15:41 +0100)
committerLudovic Rousseau <ludovic.rousseau+github@gmail.com>
Sun, 2 Feb 2014 14:51:07 +0000 (15:51 +0100)
* add a missing call to libusb_handle_events_completed()
* add a missing argument to libusb_hotplug_deregister_callback()

libusb/hotplug.c
libusb/version_nano.h

index 7c6331a..eba8f98 100644 (file)
  *
  * The following code provides an example of the usage of the hotplug interface:
 \code
+#include <stdio.h>
+#include <stdlib.h>
+#include <libusb.h>
+
 static int count = 0;
 
 int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
@@ -131,10 +135,11 @@ int main (void) {
   }
 
   while (count < 2) {
+    libusb_handle_events_completed(NULL, NULL);
     usleep(10000);
   }
 
-  libusb_hotplug_deregister_callback(handle);
+  libusb_hotplug_deregister_callback(NULL, handle);
   libusb_exit(NULL);
 
   return 0;
index a1aac70..2132f37 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10867
+#define LIBUSB_NANO 10868