libusb10.c (8fa0b743820f61c661ba5f3ea0e3be0dc137910e) libusb10.c (748205a3703147c4587ea21e78bfdb84037df076)
1/* $FreeBSD$ */
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:

--- 317 unchanged lines hidden (view full) ---

326 }
327 }
328
329out:
330 libusb_free_config_descriptor(pdconf);
331 return (ret);
332}
333
1/* $FreeBSD$ */
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:

--- 317 unchanged lines hidden (view full) ---

326 }
327 }
328
329out:
330 libusb_free_config_descriptor(pdconf);
331 return (ret);
332}
333
334int
335libusb_get_max_iso_packet_size(libusb_device *dev, uint8_t endpoint)
336{
337 int multiplier;
338 int ret;
339
340 ret = libusb_get_max_packet_size(dev, endpoint);
341
342 switch (libusb20_dev_get_speed(dev->os_priv)) {
343 case LIBUSB20_SPEED_LOW:
344 case LIBUSB20_SPEED_FULL:
345 break;
346 default:
347 if (ret > -1) {
348 multiplier = (1 + ((ret >> 11) & 3));
349 if (multiplier > 3)
350 multiplier = 3;
351 ret = (ret & 0x7FF) * multiplier;
352 }
353 break;
354 }
355 return (ret);
356}
357
334libusb_device *
335libusb_ref_device(libusb_device *dev)
336{
337 if (dev == NULL)
338 return (NULL); /* be NULL safe */
339
340 CTX_LOCK(dev->ctx);
341 dev->refcnt++;

--- 1181 unchanged lines hidden ---
358libusb_device *
359libusb_ref_device(libusb_device *dev)
360{
361 if (dev == NULL)
362 return (NULL); /* be NULL safe */
363
364 CTX_LOCK(dev->ctx);
365 dev->refcnt++;

--- 1181 unchanged lines hidden ---