static int u3g_sierra_reinit(usbd_device_handle dev) { /* Some Sierra devices presents themselves as a umass device with * Windows drivers on it. After installation of the driver, it * reinits into a * 3G serial device. */ usb_device_request_t req; usb_config_descriptor_t *cdesc; /* Get the config descriptor */ cdesc = usbd_get_config_descriptor(dev); if (cdesc == NULL) return (UMATCH_NONE); req.bmRequestType = UT_VENDOR; req.bRequest = UR_SET_INTERFACE; USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); USETW(req.wIndex, UHF_PORT_CONNECTION); USETW(req.wLength, 0); (void) usbd_do_request(dev, &req, 0); return (UMATCH_HIGHEST); /* Match to prevent umass from attaching */ }
static int u3g_huawei_reinit(usbd_device_handle dev) { /* The Huawei device presents itself as a umass device with Windows * drivers on it. After installation of the driver, it reinits into a * 3G serial device. */ usb_device_request_t req; usb_config_descriptor_t *cdesc; /* Get the config descriptor */ cdesc = usbd_get_config_descriptor(dev); if (cdesc == NULL) return (UMATCH_NONE); /* One iface means umass mode, more than 1 (4 usually) means 3G mode */ if (cdesc->bNumInterface > 1) return (UMATCH_VENDOR_PRODUCT); req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_FEATURE; USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); USETW(req.wIndex, UHF_PORT_SUSPEND); USETW(req.wLength, 0); (void) usbd_do_request(dev, &req, 0); return (UMATCH_HIGHEST); /* Match to prevent umass from attaching */ }
void uslcom_set(void *vsc, int portno, int reg, int onoff) { struct uslcom_softc *sc = vsc; usb_device_request_t req; int ctl; switch (reg) { case UCOM_SET_DTR: ctl = onoff ? USLCOM_CTRL_DTR_ON : 0; ctl |= USLCOM_CTRL_DTR_SET; break; case UCOM_SET_RTS: ctl = onoff ? USLCOM_CTRL_RTS_ON : 0; ctl |= USLCOM_CTRL_RTS_SET; break; case UCOM_SET_BREAK: uslcom_break(sc, portno, onoff); return; default: return; } req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); USETW(req.wIndex, portno); USETW(req.wLength, 0); usbd_do_request(sc->sc_udev, &req, NULL); }
usbd_status umodem_set_comm_feature(struct umodem_softc *sc, int feature, int state) { usb_device_request_t req; usbd_status err; usb_cdc_abstract_state_t ast; DPRINTF(("umodem_set_comm_feature: feature=%d state=%d\n", feature, state)); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SET_COMM_FEATURE; USETW(req.wValue, feature); USETW(req.wIndex, sc->sc_ctl_iface_no); USETW(req.wLength, UCDC_ABSTRACT_STATE_LENGTH); USETW(ast.wState, state); err = usbd_do_request(sc->sc_udev, &req, &ast); if (err) { DPRINTF(("umodem_set_comm_feature: feature=%d, err=%s\n", feature, usbd_errstr(err))); return (err); } return (USBD_NORMAL_COMPLETION); }
int obsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint) { struct usb_ctl_request req; int fd, err; if ((fd = _bus_open(handle->dev->bus_number)) < 0) return _errno_to_libusb(errno); usbi_dbg(""); req.ucr_addr = handle->dev->device_address; req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT; req.ucr_request.bRequest = UR_CLEAR_FEATURE; USETW(req.ucr_request.wValue, UF_ENDPOINT_HALT); USETW(req.ucr_request.wIndex, endpoint); USETW(req.ucr_request.wLength, 0); if (ioctl(fd, USB_REQUEST, &req) < 0) { err = errno; close(fd); return _errno_to_libusb(err); } close(fd); return (LIBUSB_SUCCESS); }
void uipaq_rts(struct uipaq_softc* sc, int onoff) { usb_device_request_t req; usbd_status err; int retries = 3; DPRINTF(("%s: uipaq_rts: onoff=%x\n", device_xname(sc->sc_dev), onoff)); /* Avoid sending unnecessary requests */ if (onoff && (sc->sc_lcr & UCDC_LINE_RTS)) return; if (!onoff && !(sc->sc_lcr & UCDC_LINE_RTS)) return; req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SET_CONTROL_LINE_STATE; sc->sc_lcr = onoff ? sc->sc_lcr | UCDC_LINE_RTS : sc->sc_lcr & ~UCDC_LINE_RTS; USETW(req.wValue, sc->sc_lcr); USETW(req.wIndex, 0x0); USETW(req.wLength, 0); while (retries) { err = usbd_do_request(sc->sc_udev, &req, NULL); if (!err) break; retries--; } }
void uipaq_dtr(struct uipaq_softc* sc, int onoff) { usb_device_request_t req; usbd_status err; int retries = 3; DPRINTF(("%s: uipaq_dtr: onoff=%x\n", device_xname(sc->sc_dev), onoff)); /* Avoid sending unnecessary requests */ if (onoff && (sc->sc_lcr & UCDC_LINE_DTR)) return; if (!onoff && !(sc->sc_lcr & UCDC_LINE_DTR)) return; /* Other parameters depend on reg */ req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SET_CONTROL_LINE_STATE; sc->sc_lcr = onoff ? sc->sc_lcr | UCDC_LINE_DTR : sc->sc_lcr & ~UCDC_LINE_DTR; USETW(req.wValue, sc->sc_lcr); USETW(req.wIndex, 0x0); USETW(req.wLength, 0); /* Fire off the request a few times if necessary */ while (retries) { err = usbd_do_request(sc->sc_udev, &req, NULL); if (!err) break; retries--; } }
usbd_status usbd_get_string_desc(usbd_device_handle dev, juint8_t sindex, jint16_t langid, usb_string_descriptor_t *sdesc, juint32_t *sizep) { usb_device_request_t req; usbd_status err; juint32_t actlen; req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_STRING, sindex); USETW(req.wIndex, langid); USETW(req.wLength, 2); /* only size byte first */ err = usbd_do_request_flags(dev, &req, (void *)sdesc, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); if (err) return (err); if (actlen < 2) return (USBD_SHORT_XFER); USETW(req.wLength, sdesc->bLength); /* the whole string */ err = usbd_do_request_flags(dev, &req, (void *)sdesc, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); if (err) return (err); if (actlen != sdesc->bLength) { DBG_E(DHOST_SUBR, ("usbd_get_string_desc: expected %d, " "got %ld\n", sdesc->bLength, actlen)); } *sizep = actlen; return (USBD_NORMAL_COMPLETION); }
usbd_status umodem_set_line_coding(struct umodem_softc *sc, usb_cdc_line_state_t *state) { usb_device_request_t req; usbd_status err; DPRINTF(("umodem_set_line_coding: rate=%d fmt=%d parity=%d bits=%d\n", UGETDW(state->dwDTERate), state->bCharFormat, state->bParityType, state->bDataBits)); if (memcmp(state, &sc->sc_line_state, UCDC_LINE_STATE_LENGTH) == 0) { DPRINTF(("umodem_set_line_coding: already set\n")); return (USBD_NORMAL_COMPLETION); } req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SET_LINE_CODING; USETW(req.wValue, 0); USETW(req.wIndex, sc->sc_ctl_iface_no); USETW(req.wLength, UCDC_LINE_STATE_LENGTH); err = usbd_do_request(sc->sc_udev, &req, state); if (err) { DPRINTF(("umodem_set_line_coding: failed, err=%s\n", usbd_errstr(err))); return (err); } sc->sc_line_state = *state; return (USBD_NORMAL_COMPLETION); }
/* * usb-control (bmRequestType bRequest wValue wIndex wLength 'buffer device - count) */ void mu_usb_control() { struct usb_ctl_request ucr; int fd; #define req ucr.ucr_request req.bmRequestType = SP[6]; req.bRequest = SP[5]; USETW(req.wValue, SP[4]); USETW(req.wIndex, ST3); USETW(req.wLength, ST2); ucr.ucr_data = (void *)ST1; ucr.ucr_addr = 0; ucr.ucr_flags = (req.bmRequestType == UT_READ_DEVICE) ? USBD_SHORT_XFER_OK : 0; fd = TOP; DROP(6); if (ioctl(fd, USB_DO_REQUEST, &ucr) == -1) { TOP = 0; /* count of bytes transferred */ return abort_strerror(); } TOP = ucr.ucr_actlen; /* actual length transferred */ }
int uhidev_get_report(struct uhidev_softc *sc, int type, int id, void *data, int len) { usb_device_request_t req; char *buf = data; usbd_status err; int actlen; if (id > 0) { len++; buf = malloc(len, M_TEMP, M_WAITOK|M_ZERO); } req.bmRequestType = UT_READ_CLASS_INTERFACE; req.bRequest = UR_GET_REPORT; USETW2(req.wValue, type, id); USETW(req.wIndex, sc->sc_ifaceno); USETW(req.wLength, len); err = usbd_do_request_flags(sc->sc_udev, &req, buf, 0, &actlen, USBD_DEFAULT_TIMEOUT); if (err != USBD_NORMAL_COMPLETION && err != USBD_SHORT_XFER) actlen = -1; /* Skip the reportID. */ if (id > 0) { memcpy(data, buf + 1, len - 1); free(buf, M_TEMP, len); } return (actlen); }
Static usbd_status uvscom_readstat(struct uvscom_softc *sc) { usb_device_request_t req; usbd_status err; uint16_t r; DPRINTF(("%s: send readstat\n", USBDEVNAME(sc->sc_ucom.sc_dev))); req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = UVSCOM_READ_STATUS; USETW(req.wValue, 0); USETW(req.wIndex, 0); USETW(req.wLength, 2); err = usbd_do_request(sc->sc_ucom.sc_udev, &req, &r); if (err) { printf("%s: uvscom_readstat: %s\n", USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err)); return (err); } DPRINTF(("%s: uvscom_readstat: r = %d\n", USBDEVNAME(sc->sc_ucom.sc_dev), r)); return (USBD_NORMAL_COMPLETION); }
usbd_status usbd_get_string_desc(struct usbd_device *dev, int sindex, int langid, usb_string_descriptor_t *sdesc, int *sizep) { usb_device_request_t req; usbd_status err; int actlen; req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_STRING, sindex); USETW(req.wIndex, langid); USETW(req.wLength, 2); /* size and descriptor type first */ err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); if (err) return (err); if (actlen < 2) return (USBD_SHORT_XFER); USETW(req.wLength, sdesc->bLength); /* the whole string */ err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); if (err) return (err); if (actlen != sdesc->bLength) { DPRINTFN(-1, ("usbd_get_string_desc: expected %d, got %d\n", sdesc->bLength, actlen)); } *sizep = actlen; return (USBD_NORMAL_COMPLETION); }
int uhidev_set_report(struct uhidev_softc *sc, int type, int id, void *data, int len) { usb_device_request_t req; char *buf = data; int actlen = len; /* Prepend the reportID. */ if (id > 0) { len++; buf = malloc(len, M_TEMP, M_WAITOK); buf[0] = id; memcpy(buf + 1, data, len - 1); } req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UR_SET_REPORT; USETW2(req.wValue, type, id); USETW(req.wIndex, sc->sc_ifaceno); USETW(req.wLength, len); if (usbd_do_request(sc->sc_udev, &req, buf)) actlen = -1; if (id > 0) free(buf, M_TEMP, len); return (actlen); }
int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout) { struct usb_ctl_request req; int ret; if (usb_debug >= 3) fprintf(stderr, "usb_control_msg: %d %d %d %d %p %d %d\n", requesttype, request, value, index, bytes, size, timeout); req.ucr_request.bmRequestType = requesttype; req.ucr_request.bRequest = request; USETW(req.ucr_request.wValue, value); USETW(req.ucr_request.wIndex, index); USETW(req.ucr_request.wLength, size); req.ucr_data = bytes; req.ucr_flags = USBD_SHORT_XFER_OK; ret = ioctl(dev->fd, USB_SET_TIMEOUT, &timeout); #if (__NetBSD__ || __OpenBSD__) if (ret < 0 && errno != EINVAL) #else if (ret < 0) #endif USB_ERROR_STR(-errno, "error setting timeout: %s", strerror(errno)); ret = ioctl(dev->fd, USB_DO_REQUEST, &req); if (ret < 0) USB_ERROR_STR(-errno, "error sending control message: %s", strerror(errno)); return UGETW(req.ucr_request.wLength); }
int test_sync_control(char *dev) { struct usb_request_block urb; char buf[2]; int fd, err; if ((fd = open(dev, O_RDWR)) < 0) return (-1); urb.urb_addr = 0; urb.urb_endpt = 0; urb.urb_request.bmRequestType = UT_READ_DEVICE; urb.urb_request.bRequest = UR_GET_STATUS; USETW(urb.urb_request.wValue, 0); USETW(urb.urb_request.wIndex, 0); USETW(urb.urb_request.wLength, 2); urb.urb_data = &buf; urb.urb_flags = USBD_SYNCHRONOUS; urb.urb_actlen = 2; urb.urb_timeout = USBD_DEFAULT_TIMEOUT; urb.urb_read = 1; if (ioctl(fd, USB_DO_REQUEST, &urb)) { err = errno; close(fd); return (err); } close(fd); return (0); }
void umct_set_baudrate(struct umct_softc *sc, u_int rate) { usb_device_request_t req; uDWord arate; u_int val; if (sc->sc_product == USB_PRODUCT_MCT_SITECOM_USB232 || sc->sc_product == USB_PRODUCT_BELKIN_F5U109) { switch (rate) { case 300: val = 0x01; break; case 600: val = 0x02; break; case 1200: val = 0x03; break; case 2400: val = 0x04; break; case 4800: val = 0x06; break; case 9600: val = 0x08; break; case 19200: val = 0x09; break; case 38400: val = 0x0a; break; case 57600: val = 0x0b; break; case 115200: val = 0x0c; break; default: val = -1; break; } } else { val = UMCT_BAUD_RATE(rate); } USETDW(arate, val); req.bmRequestType = UMCT_SET_REQUEST; req.bRequest = REQ_SET_BAUD_RATE; USETW(req.wValue, 0); USETW(req.wIndex, sc->sc_iface_number); USETW(req.wLength, LENGTH_BAUD_RATE); (void)usbd_do_request(sc->sc_udev, &req, arate); /* XXX should check */ }
static inline void ufoma_setup_msg_req(struct ufoma_softc *sc, usb_device_request_t *req) { req->bmRequestType = UT_READ_CLASS_INTERFACE; req->bRequest = UCDC_GET_ENCAPSULATED_RESPONSE; USETW(req->wIndex, sc->sc_ctl_iface_no); USETW(req->wValue, 0); USETW(req->wLength, UFOMA_CMD_BUF_SIZE); }
static void uhso_mux_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct uhso_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; struct usb_device_request req; struct uhso_tty *ht; int actlen, len; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); UHSO_DPRINTF(3, "status %d\n", USB_GET_STATE(xfer)); ht = usbd_xfer_get_priv(xfer); UHSO_DPRINTF(3, "ht=%p open=%d\n", ht, ht->ht_open); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: /* Got data, send to ucom */ pc = usbd_xfer_get_frame(xfer, 1); len = usbd_xfer_frame_len(xfer, 1); UHSO_DPRINTF(3, "got %d bytes on mux port %d\n", len, ht->ht_muxport); if (len <= 0) { usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]); break; } /* Deliver data if the TTY is open, discard otherwise */ if (ht->ht_open) ucom_put_data(&sc->sc_ucom[ht->ht_muxport], pc, 0, len); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: memset(&req, 0, sizeof(struct usb_device_request)); req.bmRequestType = UT_READ_CLASS_INTERFACE; req.bRequest = UCDC_GET_ENCAPSULATED_RESPONSE; USETW(req.wValue, 0); USETW(req.wIndex, ht->ht_muxport); USETW(req.wLength, 1024); pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_in(pc, 0, &req, sizeof(req)); usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); usbd_xfer_set_frame_len(xfer, 1, 1024); usbd_xfer_set_frames(xfer, 2); usbd_transfer_submit(xfer); break; default: UHSO_DPRINTF(0, "error: %s\n", usbd_errstr(error)); if (error == USB_ERR_CANCELLED) break; usbd_xfer_set_stall(xfer); goto tr_setup; } }
static void uhso_mux_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct uhso_softc *sc = usbd_xfer_softc(xfer); struct uhso_tty *ht; struct usb_page_cache *pc; struct usb_device_request req; int actlen; struct usb_page_search res; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); ht = usbd_xfer_get_priv(xfer); UHSO_DPRINTF(3, "status=%d, using mux port %d\n", USB_GET_STATE(xfer), ht->ht_muxport); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: UHSO_DPRINTF(3, "wrote %zd data bytes to muxport %d\n", actlen - sizeof(struct usb_device_request) , ht->ht_muxport); /* FALLTHROUGH */ case USB_ST_SETUP: pc = usbd_xfer_get_frame(xfer, 1); if (ucom_get_data(&sc->sc_ucom[ht->ht_muxport], pc, 0, 32, &actlen)) { usbd_get_page(pc, 0, &res); memset(&req, 0, sizeof(struct usb_device_request)); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SEND_ENCAPSULATED_COMMAND; USETW(req.wValue, 0); USETW(req.wIndex, ht->ht_muxport); USETW(req.wLength, actlen); pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_in(pc, 0, &req, sizeof(req)); usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); usbd_xfer_set_frame_len(xfer, 1, actlen); usbd_xfer_set_frames(xfer, 2); UHSO_DPRINTF(3, "Prepared %d bytes for transmit " "on muxport %d\n", actlen, ht->ht_muxport); usbd_transfer_submit(xfer); } break; default: UHSO_DPRINTF(0, "error: %s\n", usbd_errstr(error)); if (error == USB_ERR_CANCELLED) break; break; } }
/* From FreeBSD's usbdi_util.c */ usbd_status usbd_set_idle(usbd_interface_handle iface, int duration, int id) { usb_interface_descriptor_t *ifd = usbd_get_interface_descriptor(iface); usbd_device_handle dev; usb_device_request_t req; usbd_interface2device_handle(iface, &dev); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UR_SET_IDLE; USETW2(req.wValue, duration, id); USETW(req.wIndex, ifd->bInterfaceNumber); USETW(req.wLength, 0); return (usbd_do_request(dev, &req, 0)); }
usbd_status usbd_get_config(usbd_device_handle dev, u_int8_t *conf) { usb_device_request_t req; req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_CONFIG; USETW(req.wValue, 0); USETW(req.wIndex, 0); USETW(req.wLength, 1); return (usbd_do_request(dev, &req, conf)); }
static usbd_status usbd_set_config(usbd_device_handle dev, int conf) { usb_device_request_t req; req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_CONFIG; USETW(req.wValue, conf); USETW(req.wIndex, 0); USETW(req.wLength, 0); return (usbd_do_request(dev, &req, 0)); }
usbd_status usbd_set_port_feature(usbd_device_handle dev, int port, int sel) { usb_device_request_t req; req.bmRequestType = UT_WRITE_CLASS_OTHER; req.bRequest = UR_SET_FEATURE; USETW(req.wValue, sel); USETW(req.wIndex, port); USETW(req.wLength, 0); return (usbd_do_request(dev, &req, 0)); }
usbd_status usbd_clear_hub_feature(usbd_device_handle dev, int sel) { usb_device_request_t req; req.bmRequestType = UT_WRITE_CLASS_DEVICE; req.bRequest = UR_CLEAR_FEATURE; USETW(req.wValue, sel); USETW(req.wIndex, 0); USETW(req.wLength, 0); return (usbd_do_request(dev, &req, 0)); }
usbd_status usbd_get_port_status(usbd_device_handle dev, int port, usb_port_status_t *ps) { usb_device_request_t req; req.bmRequestType = UT_READ_CLASS_OTHER; req.bRequest = UR_GET_STATUS; USETW(req.wValue, 0); USETW(req.wIndex, port); USETW(req.wLength, sizeof *ps); return (usbd_do_request(dev, &req, ps)); }
usbd_status usbd_set_address(usbd_device_handle dev, int addr) { usb_device_request_t req; req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_ADDRESS; USETW(req.wValue, addr); USETW(req.wIndex, 0); USETW(req.wLength, 0); return usbd_do_request(dev, &req, 0); }
usbd_status usbd_get_hub_status(usbd_device_handle dev, usb_hub_status_t *st) { usb_device_request_t req; req.bmRequestType = UT_READ_CLASS_DEVICE; req.bRequest = UR_GET_STATUS; USETW(req.wValue, 0); USETW(req.wIndex, 0); USETW(req.wLength, sizeof(usb_hub_status_t)); return (usbd_do_request(dev, &req, st)); }
/* From FreeBSD's usbdi_util.c */ usbd_status usbd_set_protocol(usbd_interface_handle iface, int report) { usb_interface_descriptor_t *id = usbd_get_interface_descriptor(iface); usbd_device_handle dev; usb_device_request_t req; usbd_interface2device_handle(iface, &dev); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UR_SET_PROTOCOL; USETW(req.wValue, report); USETW(req.wIndex, id->bInterfaceNumber); USETW(req.wLength, 0); return (usbd_do_request(dev, &req, 0)); }
usbd_status usbd_get_report_descriptor(usbd_device_handle dev, int ifcno, int size, void *d) { usb_device_request_t req; req.bmRequestType = UT_READ_INTERFACE; req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_REPORT, 0); /* report id should be 0 */ USETW(req.wIndex, ifcno); USETW(req.wLength, size); return (usbd_do_request(dev, &req, d)); }