diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-06-24 23:01:51 -0500 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2008-06-26 22:42:59 -0500 |
commit | 1df713d622ab4f0b03aad72d903ac7beb8fb3b90 (patch) | |
tree | 60d12ab36c2a75dbb80104d956712e6f47c72990 /examples/dpfp.c | |
parent | 9818151c60a85aea6af24cb0996a92c3726c9864 (diff) | |
download | libusb-1df713d622ab4f0b03aad72d903ac7beb8fb3b90.tar.gz |
Introduce contexts to the API
Suggested by David Zeuthen. This allows multiple libraries in the same
process to independently use libusb without interfering.
Diffstat (limited to 'examples/dpfp.c')
-rw-r--r-- | examples/dpfp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/dpfp.c b/examples/dpfp.c index 7808184..bd9702a 100644 --- a/examples/dpfp.c +++ b/examples/dpfp.c @@ -67,7 +67,7 @@ static int do_exit = 0; static int find_dpfp_device(void) { - devh = libusb_open_device_with_vid_pid(0x05ba, 0x000a); + devh = libusb_open_device_with_vid_pid(NULL, 0x05ba, 0x000a); return devh ? 0 : -EIO; } @@ -347,7 +347,7 @@ static int init_capture(void) if (r < 0) { libusb_cancel_transfer(irq_transfer); while (irq_transfer) - if (libusb_handle_events() < 0) + if (libusb_handle_events(NULL) < 0) break; return r; } @@ -419,7 +419,7 @@ int main(void) struct sigaction sigact; int r = 1; - r = libusb_init(); + r = libusb_init(NULL); if (r < 0) { fprintf(stderr, "failed to initialise libusb\n"); exit(1); @@ -464,7 +464,7 @@ int main(void) sigaction(SIGQUIT, &sigact, NULL); while (!do_exit) { - r = libusb_handle_events(); + r = libusb_handle_events(NULL); if (r < 0) goto out_deinit; } @@ -484,7 +484,7 @@ int main(void) } while (irq_transfer || img_transfer) - if (libusb_handle_events() < 0) + if (libusb_handle_events(NULL) < 0) break; if (do_exit == 1) @@ -501,7 +501,7 @@ out_release: libusb_release_interface(devh, 0); out: libusb_close(devh); - libusb_exit(); + libusb_exit(NULL); return r >= 0 ? r : -r; } |