Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/libusb/src/examples/dpfp_threaded.c

Issue 19713005: Update libusb 1.0.9 to libusbx 1.0.16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * libusb example program to manipulate U.are.U 4000B fingerprint scanner. 2 * libusbx example program to manipulate U.are.U 4000B fingerprint scanner.
3 * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org> 3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
4 * 4 *
5 * Basic image capture program only, does not consider the powerup quirks or 5 * Basic image capture program only, does not consider the powerup quirks or
6 * the fact that image encryption may be enabled. Not expected to work 6 * the fact that image encryption may be enabled. Not expected to work
7 * flawlessly all of the time. 7 * flawlessly all of the time.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version. 12 * version 2.1 of the License, or (at your option) any later version.
13 * 13 *
14 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details. 17 * Lesser General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU Lesser General Public 19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software 20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */ 22 */
23 23
24 #include <errno.h> 24 #include <errno.h>
25 #include <pthread.h> 25 #include <pthread.h>
26 #include <signal.h> 26 #include <signal.h>
27 #include <string.h> 27 #include <string.h>
28 #include <stdio.h> 28 #include <stdio.h>
29 #include <stdlib.h> 29 #include <stdlib.h>
30 30
31 #include <libusb.h> 31 #include "libusb.h"
32 32
33 #define EP_INTR (1 | LIBUSB_ENDPOINT_IN) 33 #define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
34 #define EP_DATA (2 | LIBUSB_ENDPOINT_IN) 34 #define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
35 #define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN ) 35 #define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN )
36 #define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OU T) 36 #define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OU T)
37 #define USB_RQ 0x04 37 #define USB_RQ 0x04
38 #define INTR_LENGTH 64 38 #define INTR_LENGTH 64
39 39
40 enum { 40 enum {
41 MODE_INIT = 0x00, 41 MODE_INIT = 0x00,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 printf("async cb_mode_changed length=%d actual_length=%d\n", 188 printf("async cb_mode_changed length=%d actual_length=%d\n",
189 transfer->length, transfer->actual_length); 189 transfer->length, transfer->actual_length);
190 if (next_state() < 0) 190 if (next_state() < 0)
191 request_exit(2); 191 request_exit(2);
192 } 192 }
193 193
194 static int set_mode_async(unsigned char data) 194 static int set_mode_async(unsigned char data)
195 { 195 {
196 » unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); 196 » unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
197 struct libusb_transfer *transfer; 197 struct libusb_transfer *transfer;
198 198
199 if (!buf) 199 if (!buf)
200 return -ENOMEM; 200 return -ENOMEM;
201 201
202 transfer = libusb_alloc_transfer(0); 202 transfer = libusb_alloc_transfer(0);
203 if (!transfer) { 203 if (!transfer) {
204 free(buf); 204 free(buf);
205 return -ENOMEM; 205 return -ENOMEM;
206 } 206 }
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 libusb_free_transfer(irq_transfer); 535 libusb_free_transfer(irq_transfer);
536 set_mode(0); 536 set_mode(0);
537 set_hwstat(0x80); 537 set_hwstat(0x80);
538 out_release: 538 out_release:
539 libusb_release_interface(devh, 0); 539 libusb_release_interface(devh, 0);
540 out: 540 out:
541 libusb_close(devh); 541 libusb_close(devh);
542 libusb_exit(NULL); 542 libusb_exit(NULL);
543 return r >= 0 ? r : -r; 543 return r >= 0 ? r : -r;
544 } 544 }
545
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698