diff options
-rw-r--r-- | examples/dpfp.c | 7 | ||||
-rw-r--r-- | examples/dpfp_threaded.c | 15 | ||||
-rw-r--r-- | examples/lsusb.c | 1 |
3 files changed, 5 insertions, 18 deletions
diff --git a/examples/dpfp.c b/examples/dpfp.c index e4594e8..04b42ed 100644 --- a/examples/dpfp.c +++ b/examples/dpfp.c @@ -416,9 +416,7 @@ static void sighandler(int signum) int main(void) { -#ifndef __MINGW32__ struct sigaction sigact; -#endif int r = 1; r = libusb_init(NULL); @@ -458,17 +456,12 @@ int main(void) if (r < 0) goto out_deinit; -#ifndef __MINGW32__ sigact.sa_handler = sighandler; sigemptyset(&sigact.sa_mask); sigact.sa_flags = 0; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigaction(SIGQUIT, &sigact, NULL); -#else - signal(SIGINT, sighandler); - signal(SIGTERM, sighandler); -#endif while (!do_exit) { r = libusb_handle_events(NULL); diff --git a/examples/dpfp_threaded.c b/examples/dpfp_threaded.c index 7c36ab9..54e5ae3 100644 --- a/examples/dpfp_threaded.c +++ b/examples/dpfp_threaded.c @@ -92,7 +92,6 @@ static void *poll_thread_main(void *arg) printf("poll thread shutting down\n"); pthread_exit(NULL); - return NULL; } static int find_dpfp_device(void) @@ -199,7 +198,7 @@ static int set_mode_async(unsigned char data) if (!buf) return -ENOMEM; - + transfer = libusb_alloc_transfer(0); if (!transfer) { free(buf); @@ -238,7 +237,7 @@ static int do_sync_intr(unsigned char *data) } static int sync_intr(unsigned char type) -{ +{ int r; unsigned char data[INTR_LENGTH]; @@ -424,7 +423,7 @@ static int alloc_transfers(void) img_transfer = libusb_alloc_transfer(0); if (!img_transfer) return -ENOMEM; - + irq_transfer = libusb_alloc_transfer(0); if (!irq_transfer) return -ENOMEM; @@ -444,9 +443,7 @@ static void sighandler(int signum) int main(void) { -#ifndef __MINGW32__ struct sigaction sigact; -#endif int r = 1; r = libusb_init(NULL); @@ -477,17 +474,13 @@ int main(void) goto out_deinit; /* async from here onwards */ -#ifndef __MINGW32__ + sigact.sa_handler = sighandler; sigemptyset(&sigact.sa_mask); sigact.sa_flags = 0; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigaction(SIGQUIT, &sigact, NULL); -#else - signal(SIGINT, sighandler); - signal(SIGTERM, sighandler); -#endif r = pthread_create(&poll_thread, NULL, poll_thread_main, NULL); if (r) diff --git a/examples/lsusb.c b/examples/lsusb.c index 735bd8a..317adf0 100644 --- a/examples/lsusb.c +++ b/examples/lsusb.c @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <sys/types.h> #include <libusb/libusb.h> |