Lines Matching +full:no +full:- +full:temp +full:- +full:support

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
29 * This file contains sub-routines to build up USB descriptors from
133 if (error != 0 || req->newptr == NULL) in sysctl_hw_usb_template_power()
144 /*------------------------------------------------------------------------*
148 *------------------------------------------------------------------------*/
154 if (sd->bLength < 2) { in usb_decode_str_desc()
159 for (i = 0; i < buflen - 1 && i < (sd->bLength / 2) - 1; i++) in usb_decode_str_desc()
160 buf[i] = UGETW(sd->bString[i]); in usb_decode_str_desc()
165 /*------------------------------------------------------------------------*
170 *------------------------------------------------------------------------*/
182 if (error != 0 || req->newptr == NULL) in usb_temp_sysctl()
192 /*------------------------------------------------------------------------*
197 *------------------------------------------------------------------------*/
199 usb_make_raw_desc(struct usb_temp_setup *temp, in usb_make_raw_desc() argument
210 if (temp->buf) { in usb_make_raw_desc()
211 dst = USB_ADD_BYTES(temp->buf, temp->size); in usb_make_raw_desc()
223 ud->bMasterInterface += in usb_make_raw_desc()
224 temp->bInterfaceNumber; in usb_make_raw_desc()
225 ud->bSlaveInterface[0] += in usb_make_raw_desc()
226 temp->bInterfaceNumber; in usb_make_raw_desc()
237 iad->bFirstInterface += in usb_make_raw_desc()
238 temp->bInterfaceNumber; in usb_make_raw_desc()
250 ccd->bDataInterface += in usb_make_raw_desc()
251 temp->bInterfaceNumber; in usb_make_raw_desc()
254 temp->size += len; in usb_make_raw_desc()
258 /*------------------------------------------------------------------------*
264 *------------------------------------------------------------------------*/
266 usb_make_endpoint_desc(struct usb_temp_setup *temp, in usb_make_endpoint_desc() argument
277 old_size = temp->size; in usb_make_endpoint_desc()
279 ea = (ted->bEndpointAddress & (UE_ADDR | UE_DIR_IN | UE_DIR_OUT)); in usb_make_endpoint_desc()
280 et = (ted->bmAttributes & UE_XFERTYPE); in usb_make_endpoint_desc()
284 temp->size += sizeof(*ed) + 2; in usb_make_endpoint_desc()
286 temp->size += sizeof(*ed); in usb_make_endpoint_desc()
290 rd = ted->ppRawDesc; in usb_make_endpoint_desc()
293 usb_make_raw_desc(temp, *rd); in usb_make_endpoint_desc()
297 if (ted->pPacketSize == NULL) { in usb_make_endpoint_desc()
299 temp->err = USB_ERR_INVAL; in usb_make_endpoint_desc()
302 mps = ted->pPacketSize->mps[temp->usb_speed]; in usb_make_endpoint_desc()
305 temp->err = USB_ERR_INVAL; in usb_make_endpoint_desc()
316 if (temp->buf) { in usb_make_endpoint_desc()
317 ed = USB_ADD_BYTES(temp->buf, old_size); in usb_make_endpoint_desc()
319 ed->bLength = sizeof(*ed) + 2; in usb_make_endpoint_desc()
321 ed->bLength = sizeof(*ed); in usb_make_endpoint_desc()
322 ed->bDescriptorType = UDESC_ENDPOINT; in usb_make_endpoint_desc()
323 ed->bEndpointAddress = ea; in usb_make_endpoint_desc()
324 ed->bmAttributes = ted->bmAttributes; in usb_make_endpoint_desc()
325 USETW(ed->wMaxPacketSize, mps); in usb_make_endpoint_desc()
329 if (ted->pIntervals && in usb_make_endpoint_desc()
330 ted->pIntervals->bInterval[temp->usb_speed]) { in usb_make_endpoint_desc()
331 ed->bInterval = in usb_make_endpoint_desc()
332 ted->pIntervals->bInterval[temp->usb_speed]; in usb_make_endpoint_desc()
337 ed->bInterval = 0; /* not used */ in usb_make_endpoint_desc()
340 switch (temp->usb_speed) { in usb_make_endpoint_desc()
343 ed->bInterval = 1; /* 1 ms */ in usb_make_endpoint_desc()
346 ed->bInterval = 4; /* 1 ms */ in usb_make_endpoint_desc()
351 switch (temp->usb_speed) { in usb_make_endpoint_desc()
354 ed->bInterval = 1; /* 1 ms */ in usb_make_endpoint_desc()
357 ed->bInterval = 1; /* 125 us */ in usb_make_endpoint_desc()
364 temp->bNumEndpoints++; in usb_make_endpoint_desc()
367 /*------------------------------------------------------------------------*
373 *------------------------------------------------------------------------*/
375 usb_make_interface_desc(struct usb_temp_setup *temp, in usb_make_interface_desc() argument
385 old_size = temp->size; in usb_make_interface_desc()
386 temp->size += sizeof(*id); in usb_make_interface_desc()
390 if (tid->isAltInterface == 0) { in usb_make_interface_desc()
391 temp->bAlternateSetting = 0; in usb_make_interface_desc()
392 temp->bInterfaceNumber++; in usb_make_interface_desc()
394 temp->bAlternateSetting++; in usb_make_interface_desc()
399 rd = tid->ppRawDesc; in usb_make_interface_desc()
403 usb_make_raw_desc(temp, *rd); in usb_make_interface_desc()
409 temp->bNumEndpoints = 0; in usb_make_interface_desc()
413 ted = tid->ppEndpoints; in usb_make_interface_desc()
416 usb_make_endpoint_desc(temp, *ted); in usb_make_interface_desc()
424 if (temp->buf) { in usb_make_interface_desc()
425 id = USB_ADD_BYTES(temp->buf, old_size); in usb_make_interface_desc()
426 id->bLength = sizeof(*id); in usb_make_interface_desc()
427 id->bDescriptorType = UDESC_INTERFACE; in usb_make_interface_desc()
428 id->bInterfaceNumber = temp->bInterfaceNumber; in usb_make_interface_desc()
429 id->bAlternateSetting = temp->bAlternateSetting; in usb_make_interface_desc()
430 id->bNumEndpoints = temp->bNumEndpoints; in usb_make_interface_desc()
431 id->bInterfaceClass = tid->bInterfaceClass; in usb_make_interface_desc()
432 id->bInterfaceSubClass = tid->bInterfaceSubClass; in usb_make_interface_desc()
433 id->bInterfaceProtocol = tid->bInterfaceProtocol; in usb_make_interface_desc()
434 id->iInterface = tid->iInterface; in usb_make_interface_desc()
438 /*------------------------------------------------------------------------*
444 *------------------------------------------------------------------------*/
446 usb_make_config_desc(struct usb_temp_setup *temp, in usb_make_config_desc() argument
456 old_size = temp->size; in usb_make_config_desc()
457 temp->size += sizeof(*cd); in usb_make_config_desc()
461 temp->bInterfaceNumber = 0xFF; in usb_make_config_desc()
462 temp->bAlternateSetting = 0; in usb_make_config_desc()
466 tid = tcd->ppIfaceDesc; in usb_make_config_desc()
469 usb_make_interface_desc(temp, *tid); in usb_make_config_desc()
477 if (temp->buf) { in usb_make_config_desc()
478 cd = USB_ADD_BYTES(temp->buf, old_size); in usb_make_config_desc()
481 old_size = temp->size - old_size; in usb_make_config_desc()
483 cd->bLength = sizeof(*cd); in usb_make_config_desc()
484 cd->bDescriptorType = UDESC_CONFIG; in usb_make_config_desc()
485 USETW(cd->wTotalLength, old_size); in usb_make_config_desc()
486 cd->bNumInterface = temp->bInterfaceNumber + 1; in usb_make_config_desc()
487 cd->bConfigurationValue = temp->bConfigurationValue; in usb_make_config_desc()
488 cd->iConfiguration = tcd->iConfiguration; in usb_make_config_desc()
489 cd->bmAttributes = tcd->bmAttributes; in usb_make_config_desc()
492 cd->bMaxPower = power / 2; /* 2 mA units */ in usb_make_config_desc()
493 cd->bmAttributes |= UC_REMOTE_WAKEUP; in usb_make_config_desc()
495 cd->bmAttributes |= UC_BUS_POWERED; in usb_make_config_desc()
496 cd->bmAttributes &= ~UC_SELF_POWERED; in usb_make_config_desc()
498 cd->bmAttributes &= ~UC_BUS_POWERED; in usb_make_config_desc()
499 cd->bmAttributes |= UC_SELF_POWERED; in usb_make_config_desc()
504 /*------------------------------------------------------------------------*
509 *------------------------------------------------------------------------*/
511 usb_make_device_desc(struct usb_temp_setup *temp, in usb_make_device_desc() argument
520 old_size = temp->size; in usb_make_device_desc()
521 temp->size += sizeof(*utd); in usb_make_device_desc()
525 temp->bConfigurationValue = 1; in usb_make_device_desc()
526 tcd = tdd->ppConfigDesc; in usb_make_device_desc()
529 usb_make_config_desc(temp, *tcd); in usb_make_device_desc()
530 temp->bConfigurationValue++; in usb_make_device_desc()
539 if (temp->buf) { in usb_make_device_desc()
540 utd = USB_ADD_BYTES(temp->buf, old_size); in usb_make_device_desc()
543 utd->tdd = tdd; in usb_make_device_desc()
546 utd->udd.bLength = sizeof(utd->udd); in usb_make_device_desc()
547 utd->udd.bDescriptorType = UDESC_DEVICE; in usb_make_device_desc()
548 utd->udd.bDeviceClass = tdd->bDeviceClass; in usb_make_device_desc()
549 utd->udd.bDeviceSubClass = tdd->bDeviceSubClass; in usb_make_device_desc()
550 utd->udd.bDeviceProtocol = tdd->bDeviceProtocol; in usb_make_device_desc()
551 USETW(utd->udd.idVendor, tdd->idVendor); in usb_make_device_desc()
552 USETW(utd->udd.idProduct, tdd->idProduct); in usb_make_device_desc()
553 USETW(utd->udd.bcdDevice, tdd->bcdDevice); in usb_make_device_desc()
554 utd->udd.iManufacturer = tdd->iManufacturer; in usb_make_device_desc()
555 utd->udd.iProduct = tdd->iProduct; in usb_make_device_desc()
556 utd->udd.iSerialNumber = tdd->iSerialNumber; in usb_make_device_desc()
557 utd->udd.bNumConfigurations = temp->bConfigurationValue - 1; in usb_make_device_desc()
561 * don't support any other speeds by setting in usb_make_device_desc()
566 utd->udq.bLength = sizeof(utd->udq); in usb_make_device_desc()
567 utd->udq.bDescriptorType = UDESC_DEVICE_QUALIFIER; in usb_make_device_desc()
568 utd->udq.bDeviceClass = tdd->bDeviceClass; in usb_make_device_desc()
569 utd->udq.bDeviceSubClass = tdd->bDeviceSubClass; in usb_make_device_desc()
570 utd->udq.bDeviceProtocol = tdd->bDeviceProtocol; in usb_make_device_desc()
571 utd->udq.bNumConfigurations = 0; in usb_make_device_desc()
572 USETW(utd->udq.bcdUSB, 0x0200); in usb_make_device_desc()
573 utd->udq.bMaxPacketSize0 = 0; in usb_make_device_desc()
575 switch (temp->usb_speed) { in usb_make_device_desc()
577 USETW(utd->udd.bcdUSB, 0x0110); in usb_make_device_desc()
578 utd->udd.bMaxPacketSize = 8; in usb_make_device_desc()
581 USETW(utd->udd.bcdUSB, 0x0110); in usb_make_device_desc()
582 utd->udd.bMaxPacketSize = 32; in usb_make_device_desc()
585 USETW(utd->udd.bcdUSB, 0x0200); in usb_make_device_desc()
586 utd->udd.bMaxPacketSize = 64; in usb_make_device_desc()
589 USETW(utd->udd.bcdUSB, 0x0250); in usb_make_device_desc()
590 utd->udd.bMaxPacketSize = 255; /* 512 bytes */ in usb_make_device_desc()
593 USETW(utd->udd.bcdUSB, 0x0300); in usb_make_device_desc()
594 utd->udd.bMaxPacketSize = 9; /* 2**9 = 512 bytes */ in usb_make_device_desc()
597 temp->err = USB_ERR_INVAL; in usb_make_device_desc()
603 /*------------------------------------------------------------------------*
609 *------------------------------------------------------------------------*/
616 return (pf->support_control); in usb_hw_ep_match()
618 if ((pf->support_in && ep_dir_in) || in usb_hw_ep_match()
619 (pf->support_out && !ep_dir_in)) { in usb_hw_ep_match()
620 if ((pf->support_interrupt && (ep_type == UE_INTERRUPT)) || in usb_hw_ep_match()
621 (pf->support_isochronous && (ep_type == UE_ISOCHRONOUS)) || in usb_hw_ep_match()
622 (pf->support_bulk && (ep_type == UE_BULK))) { in usb_hw_ep_match()
629 /*------------------------------------------------------------------------*
637 * Else: Failure. No match.
638 *------------------------------------------------------------------------*/
645 uint16_t temp; in usb_hw_ep_find_match() local
655 if ((!ep->needs_in) && (!ep->needs_out)) { in usb_hw_ep_find_match()
658 if (ep->needs_ep_type == UE_CONTROL) { in usb_hw_ep_find_match()
662 if (ep->needs_in) { in usb_hw_ep_find_match()
673 (ues->methods->get_hw_ep_profile) (ues->udev, &pf, n); in usb_hw_ep_find_match()
678 /* check if IN-endpoint is reserved */ in usb_hw_ep_find_match()
679 if (dir_in || pf->is_simplex) { in usb_hw_ep_find_match()
680 if (ues->bmInAlloc[n / 8] & (1 << (n % 8))) { in usb_hw_ep_find_match()
685 /* check if OUT-endpoint is reserved */ in usb_hw_ep_find_match()
686 if (dir_out || pf->is_simplex) { in usb_hw_ep_find_match()
687 if (ues->bmOutAlloc[n / 8] & (1 << (n % 8))) { in usb_hw_ep_find_match()
693 if (pf->is_simplex == is_simplex) { in usb_hw_ep_find_match()
698 if (!usb_hw_ep_match(pf, ep->needs_ep_type, dir_in)) { in usb_hw_ep_find_match()
704 max_frame_size = pf->max_in_frame_size; in usb_hw_ep_find_match()
706 max_frame_size = pf->max_out_frame_size; in usb_hw_ep_find_match()
709 if (max_frame_size >= ep->max_frame_size) { in usb_hw_ep_find_match()
710 temp = (max_frame_size - ep->max_frame_size); in usb_hw_ep_find_match()
711 if (distance > temp) { in usb_hw_ep_find_match()
712 distance = temp; in usb_hw_ep_find_match()
714 ep->pf = pf; in usb_hw_ep_find_match()
722 pf = ep->pf; in usb_hw_ep_find_match()
724 /* reserve IN-endpoint */ in usb_hw_ep_find_match()
726 ues->bmInAlloc[best_n / 8] |= in usb_hw_ep_find_match()
728 ep->hw_endpoint_in = best_n | UE_DIR_IN; in usb_hw_ep_find_match()
729 ep->needs_in = 0; in usb_hw_ep_find_match()
731 /* reserve OUT-endpoint */ in usb_hw_ep_find_match()
733 ues->bmOutAlloc[best_n / 8] |= in usb_hw_ep_find_match()
735 ep->hw_endpoint_out = best_n | UE_DIR_OUT; in usb_hw_ep_find_match()
736 ep->needs_out = 0; in usb_hw_ep_find_match()
743 /*------------------------------------------------------------------------*
752 *------------------------------------------------------------------------*/
767 uint16_t temp; in usb_hw_ep_get_needs() local
770 ep_iface = ues->ep_max; in usb_hw_ep_get_needs()
771 ep_curr = ues->ep_max; in usb_hw_ep_get_needs()
772 ep_end = ues->ep + USB_EP_MAX; in usb_hw_ep_get_needs()
773 ep_max = ues->ep_max; in usb_hw_ep_get_needs()
775 speed = usbd_get_speed(ues->udev); in usb_hw_ep_get_needs()
779 while ((desc = usb_desc_foreach(ues->cd, desc))) { in usb_hw_ep_get_needs()
780 if ((desc->bDescriptorType == UDESC_INTERFACE) && in usb_hw_ep_get_needs()
781 (desc->bLength >= sizeof(*id))) { in usb_hw_ep_get_needs()
784 if (id->bAlternateSetting == 0) { in usb_hw_ep_get_needs()
792 if ((desc->bDescriptorType == UDESC_ENDPOINT) && in usb_hw_ep_get_needs()
793 (desc->bLength >= sizeof(*ed))) { in usb_hw_ep_get_needs()
799 ues->ep_max = ep_max; in usb_hw_ep_get_needs()
803 temp = (ed->bmAttributes & UE_XFERTYPE); in usb_hw_ep_get_needs()
805 if (temp == ep_type) { in usb_hw_ep_get_needs()
810 wMaxPacketSize = UGETW(ed->wMaxPacketSize); in usb_hw_ep_get_needs()
814 temp = (wMaxPacketSize >> 11) & 3; in usb_hw_ep_get_needs()
816 if (temp == 1) { in usb_hw_ep_get_needs()
826 ep_no = (ed->bEndpointAddress & UE_ADDR); in usb_hw_ep_get_needs()
829 (ues->methods->get_hw_ep_profile) in usb_hw_ep_get_needs()
830 (ues->udev, &pf, ep_no); in usb_hw_ep_get_needs()
832 /* HW profile does not exist - failure */ in usb_hw_ep_get_needs()
839 ues->bmInAlloc[ep_no / 8] |= in usb_hw_ep_get_needs()
841 ues->bmOutAlloc[ep_no / 8] |= in usb_hw_ep_get_needs()
843 if ((pf->max_in_frame_size < wMaxPacketSize) || in usb_hw_ep_get_needs()
844 (pf->max_out_frame_size < wMaxPacketSize)) { in usb_hw_ep_get_needs()
849 } else if (ed->bEndpointAddress & UE_DIR_IN) { in usb_hw_ep_get_needs()
850 ues->bmInAlloc[ep_no / 8] |= in usb_hw_ep_get_needs()
852 if (pf->max_in_frame_size < wMaxPacketSize) { in usb_hw_ep_get_needs()
858 ues->bmOutAlloc[ep_no / 8] |= in usb_hw_ep_get_needs()
860 if (pf->max_out_frame_size < wMaxPacketSize) { in usb_hw_ep_get_needs()
869 ep_curr->max_frame_size) { in usb_hw_ep_get_needs()
872 if (ed->bEndpointAddress & UE_DIR_IN) { in usb_hw_ep_get_needs()
873 ed->bEndpointAddress = in usb_hw_ep_get_needs()
874 ep_curr->hw_endpoint_in; in usb_hw_ep_get_needs()
876 ed->bEndpointAddress = in usb_hw_ep_get_needs()
877 ep_curr->hw_endpoint_out; in usb_hw_ep_get_needs()
882 if (ep_curr->max_frame_size < wMaxPacketSize) { in usb_hw_ep_get_needs()
883 ep_curr->max_frame_size = wMaxPacketSize; in usb_hw_ep_get_needs()
885 if (temp == UE_CONTROL) { in usb_hw_ep_get_needs()
886 ep_curr->needs_in = 1; in usb_hw_ep_get_needs()
887 ep_curr->needs_out = 1; in usb_hw_ep_get_needs()
889 if (ed->bEndpointAddress & UE_DIR_IN) { in usb_hw_ep_get_needs()
890 ep_curr->needs_in = 1; in usb_hw_ep_get_needs()
892 ep_curr->needs_out = 1; in usb_hw_ep_get_needs()
895 ep_curr->needs_ep_type = ep_type; in usb_hw_ep_get_needs()
906 /*------------------------------------------------------------------------*
915 *------------------------------------------------------------------------*/
931 methods = udev->bus->methods; in usb_hw_ep_resolve()
933 if (methods->get_hw_ep_profile == NULL) in usb_hw_ep_resolve()
936 if (desc->bDescriptorType == UDESC_DEVICE) { in usb_hw_ep_resolve()
937 if (desc->bLength < sizeof(*dd)) in usb_hw_ep_resolve()
943 (methods->get_hw_ep_profile) (udev, &pf, 0); in usb_hw_ep_resolve()
949 "support control\n"); in usb_hw_ep_resolve()
952 mps = dd->bMaxPacketSize; in usb_hw_ep_resolve()
954 if (udev->speed == USB_SPEED_FULL) { in usb_hw_ep_resolve()
960 if (pf->max_in_frame_size >= mps) { in usb_hw_ep_resolve()
972 dd->bMaxPacketSize = mps; in usb_hw_ep_resolve()
979 /* Check if we support the specified wMaxPacketSize */ in usb_hw_ep_resolve()
980 if (pf->max_in_frame_size < mps) { in usb_hw_ep_resolve()
986 if (desc->bDescriptorType != UDESC_CONFIG) in usb_hw_ep_resolve()
988 if (desc->bLength < sizeof(*(ues->cd))) in usb_hw_ep_resolve()
991 ues = udev->scratch.hw_ep_scratch; in usb_hw_ep_resolve()
995 ues->ep_max = ues->ep; in usb_hw_ep_resolve()
996 ues->cd = (void *)desc; in usb_hw_ep_resolve()
997 ues->methods = methods; in usb_hw_ep_resolve()
998 ues->udev = udev; in usb_hw_ep_resolve()
1009 for (ep = ues->ep; ep != ues->ep_max; ep++) { in usb_hw_ep_resolve()
1010 while (ep->needs_in || ep->needs_out) { in usb_hw_ep_resolve()
1023 ues->ep_max = ues->ep; in usb_hw_ep_resolve()
1037 /*------------------------------------------------------------------------*
1041 * NULL: No USB template device descriptor found.
1043 *------------------------------------------------------------------------*/
1047 if (udev->usb_template_ptr == NULL) { in usb_temp_get_tdd()
1050 return (udev->usb_template_ptr->tdd); in usb_temp_get_tdd()
1053 /*------------------------------------------------------------------------*
1057 * NULL: No USB device descriptor found.
1059 *------------------------------------------------------------------------*/
1065 if (udev->usb_template_ptr == NULL) { in usb_temp_get_device_desc()
1068 dd = &udev->usb_template_ptr->udd; in usb_temp_get_device_desc()
1069 if (dd->bDescriptorType != UDESC_DEVICE) { in usb_temp_get_device_desc()
1076 /*------------------------------------------------------------------------*
1080 * NULL: No USB device_qualifier descriptor found.
1082 *------------------------------------------------------------------------*/
1088 if (udev->usb_template_ptr == NULL) { in usb_temp_get_qualifier_desc()
1091 dq = &udev->usb_template_ptr->udq; in usb_temp_get_qualifier_desc()
1092 if (dq->bDescriptorType != UDESC_DEVICE_QUALIFIER) { in usb_temp_get_qualifier_desc()
1099 /*------------------------------------------------------------------------*
1103 * NULL: No USB config descriptor found.
1105 *------------------------------------------------------------------------*/
1112 uint16_t temp; in usb_temp_get_config_desc() local
1114 if (udev->usb_template_ptr == NULL) { in usb_temp_get_config_desc()
1117 dd = &udev->usb_template_ptr->udd; in usb_temp_get_config_desc()
1118 cd = (void *)(udev->usb_template_ptr + 1); in usb_temp_get_config_desc()
1120 if (index >= dd->bNumConfigurations) { in usb_temp_get_config_desc()
1124 while (index--) { in usb_temp_get_config_desc()
1125 if (cd->bDescriptorType != UDESC_CONFIG) { in usb_temp_get_config_desc()
1129 temp = UGETW(cd->wTotalLength); in usb_temp_get_config_desc()
1130 cd = USB_ADD_BYTES(cd, temp); in usb_temp_get_config_desc()
1134 *pLength = UGETW(cd->wTotalLength); in usb_temp_get_config_desc()
1139 /*------------------------------------------------------------------------*
1143 * NULL: No vendor descriptor found.
1145 *------------------------------------------------------------------------*/
1156 if (tdd->getVendorDesc == NULL) { in usb_temp_get_vendor_desc()
1159 return ((tdd->getVendorDesc) (req, plen)); in usb_temp_get_vendor_desc()
1162 /*------------------------------------------------------------------------*
1166 * NULL: No string descriptor found.
1168 *------------------------------------------------------------------------*/
1179 if (tdd->getStringDesc == NULL) { in usb_temp_get_string_desc()
1182 return ((tdd->getStringDesc) (lang_id, string_index)); in usb_temp_get_string_desc()
1185 /*------------------------------------------------------------------------*
1189 * NULL: No USB HUB descriptor found.
1191 *------------------------------------------------------------------------*/
1198 /*------------------------------------------------------------------------*
1203 *------------------------------------------------------------------------*/
1214 switch (req->bmRequestType) { in usb_temp_get_desc()
1216 switch (req->bRequest) { in usb_temp_get_desc()
1223 switch (req->bRequest) { in usb_temp_get_desc()
1234 switch (req->wValue[1]) { in usb_temp_get_desc()
1236 if (req->wValue[0]) { in usb_temp_get_desc()
1242 if (udev->speed != USB_SPEED_HIGH) { in usb_temp_get_desc()
1245 if (req->wValue[0]) { in usb_temp_get_desc()
1251 if (udev->speed != USB_SPEED_HIGH) { in usb_temp_get_desc()
1256 &len, req->wValue[0]); in usb_temp_get_desc()
1260 UGETW(req->wIndex), req->wValue[0]); in usb_temp_get_desc()
1267 if (req->wValue[0]) { in usb_temp_get_desc()
1293 /*------------------------------------------------------------------------*
1303 *------------------------------------------------------------------------*/
1321 uts = udev->scratch.temp_setup; in usb_temp_setup()
1325 uts->usb_speed = udev->speed; in usb_temp_setup()
1326 uts->self_powered = udev->flags.self_powered; in usb_temp_setup()
1332 if (uts->err) { in usb_temp_setup()
1337 if (uts->size == 0) { in usb_temp_setup()
1338 uts->err = USB_ERR_INVAL; in usb_temp_setup()
1342 uts->buf = usbd_alloc_config_desc(udev, uts->size); in usb_temp_setup()
1345 * This helps when porting the software to non-FreeBSD in usb_temp_setup()
1348 if (uts->buf == NULL) { in usb_temp_setup()
1350 uts->err = USB_ERR_NOMEM; in usb_temp_setup()
1355 uts->size = 0; in usb_temp_setup()
1362 udev->usb_template_ptr = uts->buf; in usb_temp_setup()
1364 if (uts->err) { in usb_temp_setup()
1372 uts->err = usb_hw_ep_resolve(udev, buf); in usb_temp_setup()
1373 if (uts->err) { in usb_temp_setup()
1376 usbd_errstr(uts->err)); in usb_temp_setup()
1384 uts->err = usb_hw_ep_resolve(udev, buf); in usb_temp_setup()
1385 if (uts->err) { in usb_temp_setup()
1388 usbd_errstr(uts->err)); in usb_temp_setup()
1393 error = uts->err; in usb_temp_setup()
1401 /*------------------------------------------------------------------------*
1406 *------------------------------------------------------------------------*/
1410 usbd_free_config_desc(udev, udev->usb_template_ptr); in usb_temp_unsetup()
1411 udev->usb_template_ptr = NULL; in usb_temp_unsetup()