Lines Matching +full:ps +full:- +full:speed

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
55 ent->next = begin; \
56 ent->next->prev = ent; \
58 ent->next = NULL; \
60 ent->prev = NULL; \
66 if (ent->prev) { \
67 ent->prev->next = ent->next; \
69 begin = ent->next; \
71 if (ent->next) { \
72 ent->next->prev = ent->prev; \
74 ent->prev = NULL; \
75 ent->next = NULL; \
116 uint8_t speed; in usb_get_transfer_by_ep_no() local
124 speed = libusb20_dev_get_speed(pdev); in usb_get_transfer_by_ep_no()
127 if (speed == LIBUSB20_SPEED_LOW) { in usb_get_transfer_by_ep_no()
129 } else if (speed == LIBUSB20_SPEED_FULL) { in usb_get_transfer_by_ep_no()
131 } else if (speed == LIBUSB20_SPEED_SUPER) { in usb_get_transfer_by_ep_no()
158 err = libusb20_dev_open(dev->dev, 16 * 2); in usb_open()
164 return (dev->dev); in usb_open()
171 * freed when the backend is re-scanned: in usb_open()
173 libusb20_be_dequeue_device(usb_backend, dev->dev); in usb_open()
175 return (dev->dev); in usb_open()
187 return (-1); in usb_close()
192 * when the backend is re-scanned: in usb_close()
215 return (-1); in usb_get_string()
224 return (-1); in usb_get_string()
236 return (-1); in usb_get_string_simple()
245 return (-1); in usb_get_string_simple()
257 return (-1); in usb_get_descriptor_by_endpoint()
274 return (-1); in usb_get_descriptor()
294 case 'b': /* 8-bit byte */ in usb_parse_descriptor()
298 * 16-bit word, convert from little endian to CPU in usb_parse_descriptor()
304 dp += ((dp - (uint8_t *)0) & 1); in usb_parse_descriptor()
309 * 32-bit dword, convert from little endian to CPU in usb_parse_descriptor()
316 dp += ((dp - (uint8_t *)0) & 1); in usb_parse_descriptor()
318 dp += ((dp - (uint8_t *)0) & 2); in usb_parse_descriptor()
324 return (sp - source); in usb_parse_descriptor()
328 usb_parse_extra(struct usb_parse_state *ps, uint8_t **pptr, int *plen) in usb_parse_extra() argument
333 ptr = ps->a.currextra->ptr; in usb_parse_extra()
334 len = ps->a.currextra->len; in usb_parse_extra()
336 if (ps->preparse == 0) { in usb_parse_extra()
337 memcpy(ps->b.currextra, ptr, len); in usb_parse_extra()
338 *pptr = ps->b.currextra; in usb_parse_extra()
341 ps->b.currextra += len; in usb_parse_extra()
346 usb_parse_endpoint(struct usb_parse_state *ps) in usb_parse_endpoint() argument
351 aep = ps->a.currep; in usb_parse_endpoint()
352 bep = ps->b.currep++; in usb_parse_endpoint()
354 if (ps->preparse == 0) { in usb_parse_endpoint()
356 bep->bLength = aep->desc.bLength; in usb_parse_endpoint()
357 bep->bDescriptorType = aep->desc.bDescriptorType; in usb_parse_endpoint()
358 bep->bEndpointAddress = aep->desc.bEndpointAddress; in usb_parse_endpoint()
359 bep->bmAttributes = aep->desc.bmAttributes; in usb_parse_endpoint()
360 bep->wMaxPacketSize = aep->desc.wMaxPacketSize; in usb_parse_endpoint()
361 bep->bInterval = aep->desc.bInterval; in usb_parse_endpoint()
362 bep->bRefresh = aep->desc.bRefresh; in usb_parse_endpoint()
363 bep->bSynchAddress = aep->desc.bSynchAddress; in usb_parse_endpoint()
365 ps->a.currextra = &aep->extra; in usb_parse_endpoint()
366 usb_parse_extra(ps, &bep->extra, &bep->extralen); in usb_parse_endpoint()
371 usb_parse_iface_sub(struct usb_parse_state *ps) in usb_parse_iface_sub() argument
377 aifc = ps->a.currifc; in usb_parse_iface_sub()
378 bifc = ps->b.currifc++; in usb_parse_iface_sub()
380 if (ps->preparse == 0) { in usb_parse_iface_sub()
382 bifc->bLength = aifc->desc.bLength; in usb_parse_iface_sub()
383 bifc->bDescriptorType = aifc->desc.bDescriptorType; in usb_parse_iface_sub()
384 bifc->bInterfaceNumber = aifc->desc.bInterfaceNumber; in usb_parse_iface_sub()
385 bifc->bAlternateSetting = aifc->desc.bAlternateSetting; in usb_parse_iface_sub()
386 bifc->bNumEndpoints = aifc->num_endpoints; in usb_parse_iface_sub()
387 bifc->bInterfaceClass = aifc->desc.bInterfaceClass; in usb_parse_iface_sub()
388 bifc->bInterfaceSubClass = aifc->desc.bInterfaceSubClass; in usb_parse_iface_sub()
389 bifc->bInterfaceProtocol = aifc->desc.bInterfaceProtocol; in usb_parse_iface_sub()
390 bifc->iInterface = aifc->desc.iInterface; in usb_parse_iface_sub()
391 bifc->endpoint = ps->b.currep; in usb_parse_iface_sub()
393 for (x = 0; x != aifc->num_endpoints; x++) { in usb_parse_iface_sub()
394 ps->a.currep = aifc->endpoints + x; in usb_parse_iface_sub()
395 usb_parse_endpoint(ps); in usb_parse_iface_sub()
398 ps->a.currextra = &aifc->extra; in usb_parse_iface_sub()
399 usb_parse_extra(ps, &bifc->extra, &bifc->extralen); in usb_parse_iface_sub()
404 usb_parse_iface(struct usb_parse_state *ps) in usb_parse_iface() argument
410 aifc = ps->a.currifc; in usb_parse_iface()
411 bifc = ps->b.currifcw++; in usb_parse_iface()
413 if (ps->preparse == 0) { in usb_parse_iface()
415 bifc->altsetting = ps->b.currifc; in usb_parse_iface()
416 bifc->num_altsetting = aifc->num_altsetting + 1; in usb_parse_iface()
418 usb_parse_iface_sub(ps); in usb_parse_iface()
420 for (x = 0; x != aifc->num_altsetting; x++) { in usb_parse_iface()
421 ps->a.currifc = aifc->altsetting + x; in usb_parse_iface()
422 usb_parse_iface_sub(ps); in usb_parse_iface()
428 usb_parse_config(struct usb_parse_state *ps) in usb_parse_config() argument
434 acfg = ps->a.currcfg; in usb_parse_config()
435 bcfg = ps->b.currcfg; in usb_parse_config()
437 if (ps->preparse == 0) { in usb_parse_config()
439 bcfg->bLength = acfg->desc.bLength; in usb_parse_config()
440 bcfg->bDescriptorType = acfg->desc.bDescriptorType; in usb_parse_config()
441 bcfg->wTotalLength = acfg->desc.wTotalLength; in usb_parse_config()
442 bcfg->bNumInterfaces = acfg->num_interface; in usb_parse_config()
443 bcfg->bConfigurationValue = acfg->desc.bConfigurationValue; in usb_parse_config()
444 bcfg->iConfiguration = acfg->desc.iConfiguration; in usb_parse_config()
445 bcfg->bmAttributes = acfg->desc.bmAttributes; in usb_parse_config()
446 bcfg->MaxPower = acfg->desc.bMaxPower; in usb_parse_config()
447 bcfg->interface = ps->b.currifcw; in usb_parse_config()
449 for (x = 0; x != acfg->num_interface; x++) { in usb_parse_config()
450 ps->a.currifc = acfg->interface + x; in usb_parse_config()
451 usb_parse_iface(ps); in usb_parse_config()
454 ps->a.currextra = &acfg->extra; in usb_parse_config()
455 usb_parse_extra(ps, &bcfg->extra, &bcfg->extralen); in usb_parse_config()
463 struct usb_parse_state ps; in usb_parse_configuration() local
471 return (-1); in usb_parse_configuration()
473 memset(&ps, 0, sizeof(ps)); in usb_parse_configuration()
475 ps.a.currcfg = libusb20_parse_config_desc(buffer); in usb_parse_configuration()
476 ps.b.currcfg = config; in usb_parse_configuration()
477 if (ps.a.currcfg == NULL) { in usb_parse_configuration()
479 return (-1); in usb_parse_configuration()
481 /* do the pre-parse */ in usb_parse_configuration()
482 ps.preparse = 1; in usb_parse_configuration()
483 usb_parse_config(&ps); in usb_parse_configuration()
485 a = ((uint8_t *)(ps.b.currifcw) - ((uint8_t *)0)); in usb_parse_configuration()
486 b = ((uint8_t *)(ps.b.currifc) - ((uint8_t *)0)); in usb_parse_configuration()
487 c = ((uint8_t *)(ps.b.currep) - ((uint8_t *)0)); in usb_parse_configuration()
488 d = ((uint8_t *)(ps.b.currextra) - ((uint8_t *)0)); in usb_parse_configuration()
494 free(ps.a.currcfg); in usb_parse_configuration()
495 return (-1); in usb_parse_configuration()
499 ps.b.currifcw = (void *)(ptr); in usb_parse_configuration()
500 ps.b.currifc = (void *)(ptr + a); in usb_parse_configuration()
501 ps.b.currep = (void *)(ptr + a + b); in usb_parse_configuration()
502 ps.b.currextra = (void *)(ptr + a + b + c); in usb_parse_configuration()
505 ps.preparse = 0; in usb_parse_configuration()
506 usb_parse_config(&ps); in usb_parse_configuration()
509 free(ps.a.currcfg); in usb_parse_configuration()
519 if (dev->config == NULL) { in usb_destroy_configuration()
522 for (c = 0; c != dev->descriptor.bNumConfigurations; c++) { in usb_destroy_configuration()
523 struct usb_config_descriptor *cf = &dev->config[c]; in usb_destroy_configuration()
525 if (cf->interface != NULL) { in usb_destroy_configuration()
526 free(cf->interface); in usb_destroy_configuration()
527 cf->interface = NULL; in usb_destroy_configuration()
531 free(dev->config); in usb_destroy_configuration()
532 dev->config = NULL; in usb_destroy_configuration()
554 if (dev->descriptor.bNumConfigurations == 0) { in usb_fetch_and_parse_descriptors()
558 size = dev->descriptor.bNumConfigurations * in usb_fetch_and_parse_descriptors()
561 dev->config = malloc(size); in usb_fetch_and_parse_descriptors()
562 if (dev->config == NULL) { in usb_fetch_and_parse_descriptors()
566 memset(dev->config, 0, size); in usb_fetch_and_parse_descriptors()
568 for (x = 0; x != dev->descriptor.bNumConfigurations; x++) { in usb_fetch_and_parse_descriptors()
570 error = (pdev->methods->get_config_desc_full) ( in usb_fetch_and_parse_descriptors()
577 usb_parse_configuration(dev->config + x, ptr); in usb_fetch_and_parse_descriptors()
597 return (-1); in usb_std_io()
601 return (-1); in usb_std_io()
628 return (-1); in usb_std_io()
635 libusb20_dev_wait_process((void *)dev, -1); in usb_std_io()
644 return (-ETIMEDOUT); in usb_std_io()
647 return (-ENXIO); in usb_std_io()
652 size -= actlen; in usb_std_io()
660 return (bytes - oldbytes); in usb_std_io()
715 return (-1); in usb_control_msg()
740 if (dev->config == NULL) { in usb_set_configuration()
741 return (-1); in usb_set_configuration()
744 if (i == dev->descriptor.bNumConfigurations) { in usb_set_configuration()
746 return (-1); in usb_set_configuration()
748 if ((dev->config + i)->bConfigurationValue == in usb_set_configuration()
758 return (-1); in usb_set_configuration()
768 pdev->claimed_interface = interface; in usb_claim_interface()
787 iface = pdev->claimed_interface; in usb_set_altinterface()
792 return (-1); in usb_set_altinterface()
800 /* emulate an endpoint reset through clear-STALL */ in usb_resetep()
811 return (-1); in usb_clear_halt()
826 return (-1); in usb_reset()
843 return (-1); in usb_check_connected()
889 udev = pdev->privLuData; in usb_find_devices()
905 return (-1); in usb_find_devices()
918 udev->bus = &usb_global_bus; in usb_find_devices()
920 snprintf(udev->filename, sizeof(udev->filename), in usb_find_devices()
927 udev->descriptor.bLength = sizeof(udev->descriptor); in usb_find_devices()
928 udev->descriptor.bDescriptorType = ddesc->bDescriptorType; in usb_find_devices()
929 udev->descriptor.bcdUSB = ddesc->bcdUSB; in usb_find_devices()
930 udev->descriptor.bDeviceClass = ddesc->bDeviceClass; in usb_find_devices()
931 udev->descriptor.bDeviceSubClass = ddesc->bDeviceSubClass; in usb_find_devices()
932 udev->descriptor.bDeviceProtocol = ddesc->bDeviceProtocol; in usb_find_devices()
933 udev->descriptor.bMaxPacketSize0 = ddesc->bMaxPacketSize0; in usb_find_devices()
934 udev->descriptor.idVendor = ddesc->idVendor; in usb_find_devices()
935 udev->descriptor.idProduct = ddesc->idProduct; in usb_find_devices()
936 udev->descriptor.bcdDevice = ddesc->bcdDevice; in usb_find_devices()
937 udev->descriptor.iManufacturer = ddesc->iManufacturer; in usb_find_devices()
938 udev->descriptor.iProduct = ddesc->iProduct; in usb_find_devices()
939 udev->descriptor.iSerialNumber = ddesc->iSerialNumber; in usb_find_devices()
940 udev->descriptor.bNumConfigurations = in usb_find_devices()
941 ddesc->bNumConfigurations; in usb_find_devices()
942 if (udev->descriptor.bNumConfigurations > USB_MAXCONFIG) { in usb_find_devices()
944 udev->descriptor.bNumConfigurations = USB_MAXCONFIG; in usb_find_devices()
946 udev->devnum = devnum++; in usb_find_devices()
948 udev->dev = pdev; in usb_find_devices()
949 pdev->privLuData = udev; in usb_find_devices()
960 return (devnum - 1); /* success */ in usb_find_devices()
970 return (pdev->privLuData); in usb_device()
989 return (-1); in usb_get_driver_np()
991 return (-1); in usb_get_driver_np()
997 return (-1); in usb_get_driver_np()
1016 return (-1); in usb_detach_kernel_driver_np()
1020 return (-1); in usb_detach_kernel_driver_np()