libusb10.c (199575) | libusb10.c (200424) |
---|---|
1/* $FreeBSD: head/lib/libusb/libusb10.c 199575 2009-11-20 08:57:25Z thompsa $ */ | 1/* $FreeBSD: head/lib/libusb/libusb10.c 200424 2009-12-12 00:24:30Z scf $ */ |
2/*- 3 * Copyright (c) 2009 Sylvestre Gallon. All rights reserved. 4 * Copyright (c) 2009 Hans Petter Selasky. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 364 unchanged lines hidden (view full) --- 374 if (ctx == NULL) 375 return (NULL); /* be NULL safe */ 376 377 DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid enter"); 378 379 if ((i = libusb_get_device_list(ctx, &devs)) < 0) 380 return (NULL); 381 | 2/*- 3 * Copyright (c) 2009 Sylvestre Gallon. All rights reserved. 4 * Copyright (c) 2009 Hans Petter Selasky. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 364 unchanged lines hidden (view full) --- 374 if (ctx == NULL) 375 return (NULL); /* be NULL safe */ 376 377 DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid enter"); 378 379 if ((i = libusb_get_device_list(ctx, &devs)) < 0) 380 return (NULL); 381 |
382 pdev = NULL; 383 | |
384 for (j = 0; j < i; j++) { 385 pdev = devs[j]->os_priv; 386 pdesc = libusb20_dev_get_device_desc(pdev); 387 /* 388 * NOTE: The USB library will automatically swap the 389 * fields in the device descriptor to be of host 390 * endian type! 391 */ 392 if (pdesc->idVendor == vendor_id && 393 pdesc->idProduct == product_id) { 394 if (libusb_open(devs[j], &pdev) < 0) 395 pdev = NULL; 396 break; 397 } 398 } | 382 for (j = 0; j < i; j++) { 383 pdev = devs[j]->os_priv; 384 pdesc = libusb20_dev_get_device_desc(pdev); 385 /* 386 * NOTE: The USB library will automatically swap the 387 * fields in the device descriptor to be of host 388 * endian type! 389 */ 390 if (pdesc->idVendor == vendor_id && 391 pdesc->idProduct == product_id) { 392 if (libusb_open(devs[j], &pdev) < 0) 393 pdev = NULL; 394 break; 395 } 396 } |
397 if (j == i) 398 pdev = NULL; |
|
399 400 libusb_free_device_list(devs, 1); 401 DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave"); 402 return (pdev); 403} 404 405void 406libusb_close(struct libusb20_device *pdev) --- 953 unchanged lines hidden --- | 399 400 libusb_free_device_list(devs, 1); 401 DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave"); 402 return (pdev); 403} 404 405void 406libusb_close(struct libusb20_device *pdev) --- 953 unchanged lines hidden --- |