1 /* $NetBSD: uslsa.c,v 1.25 2017/12/22 14:41:55 jakllsch Exp $ */ 2 3 /* from ugensa.c */ 4 5 /* 6 * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. 7 * All rights reserved. 8 * 9 * This code is derived from software contributed to The NetBSD Foundation 10 * by Roland C. Dowdeswell <elric@netbsd.org>. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* 35 * Copyright (c) 2007, 2009 Jonathan A. Kollasch. 36 * All rights reserved. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 1. Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * 2. Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in the 45 * documentation and/or other materials provided with the distribution. 46 * 47 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 48 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 49 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 50 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 51 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 52 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 53 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 54 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 55 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 56 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 57 * 58 */ 59 60 #include <sys/cdefs.h> 61 __KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.25 2017/12/22 14:41:55 jakllsch Exp $"); 62 63 #ifdef _KERNEL_OPT 64 #include "opt_usb.h" 65 #endif 66 67 #include <sys/param.h> 68 #include <sys/systm.h> 69 #include <sys/kernel.h> 70 #include <sys/device.h> 71 #include <sys/conf.h> 72 #include <sys/tty.h> 73 74 #include <dev/usb/usb.h> 75 76 #include <dev/usb/usbdi.h> 77 #include <dev/usb/usbdi_util.h> 78 #include <dev/usb/usbdevs.h> 79 80 #include <dev/usb/ucomvar.h> 81 82 #include <dev/usb/uslsareg.h> 83 84 #include <fs/unicode.h> 85 86 #ifdef USLSA_DEBUG 87 #define DPRINTF(x) if (uslsadebug) device_printf x 88 int uslsadebug = 0; 89 #else 90 #define DPRINTF(x) 91 #endif 92 93 struct uslsa_softc { 94 device_t sc_dev; /* base device */ 95 device_t sc_subdev; /* ucom device */ 96 struct usbd_device * sc_udev; /* usb device */ 97 struct usbd_interface * sc_iface; /* interface */ 98 uint8_t sc_ifnum; /* interface number */ 99 bool sc_dying; /* disconnecting */ 100 }; 101 102 static void uslsa_get_status(void *sc, int, u_char *, u_char *); 103 static void uslsa_set(void *, int, int, int); 104 static int uslsa_param(void *, int, struct termios *); 105 static int uslsa_ioctl(void *, int, u_long, void *, int, proc_t *); 106 107 static int uslsa_open(void *, int); 108 static void uslsa_close(void *, int); 109 110 static int uslsa_usbd_errno(usbd_status); 111 static int uslsa_request_set(struct uslsa_softc *, uint8_t, uint16_t); 112 static int uslsa_set_flow(struct uslsa_softc *, tcflag_t, tcflag_t); 113 114 static const struct ucom_methods uslsa_methods = { 115 .ucom_get_status = uslsa_get_status, 116 .ucom_set = uslsa_set, 117 .ucom_param = uslsa_param, 118 .ucom_ioctl = uslsa_ioctl, 119 .ucom_open = uslsa_open, 120 .ucom_close = uslsa_close, 121 .ucom_read = NULL, 122 .ucom_write = NULL, 123 }; 124 125 #define USLSA_CONFIG_INDEX 0 126 #define USLSA_IFACE_INDEX 0 127 #define USLSA_BUFSIZE 256 128 129 static const struct usb_devno uslsa_devs[] = { 130 { USB_VENDOR_BALTECH, USB_PRODUCT_BALTECH_CARDREADER }, 131 { USB_VENDOR_DYNASTREAM, USB_PRODUCT_DYNASTREAM_ANTDEVBOARD }, 132 { USB_VENDOR_JABLOTRON, USB_PRODUCT_JABLOTRON_PC60B }, 133 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_ARGUSISP }, 134 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CRUMB128 }, 135 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_DEGREECONT }, 136 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_DESKTOPMOBILE }, 137 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_IPLINK1220 }, 138 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_HARP }, 139 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_JTAG }, 140 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_LIN }, 141 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_POLOLU }, 142 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP210X_1 }, 143 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP210X_2 }, 144 { USB_VENDOR_SILABS, USB_PRODUCT_SILABS_SUNNTO }, 145 { USB_VENDOR_SILABS2, USB_PRODUCT_SILABS2_DCU11CLONE }, 146 { USB_VENDOR_USI, USB_PRODUCT_USI_MC60 }, 147 { USB_VENDOR_WMR, USB_PRODUCT_WMR_RIGBLASTER }, 148 }; 149 150 static int uslsa_match(device_t, cfdata_t, void *); 151 static void uslsa_attach(device_t, device_t, void *); 152 static void uslsa_childdet(device_t, device_t); 153 static int uslsa_detach(device_t, int); 154 static int uslsa_activate(device_t, enum devact); 155 156 CFATTACH_DECL2_NEW(uslsa, sizeof(struct uslsa_softc), uslsa_match, 157 uslsa_attach, uslsa_detach, uslsa_activate, NULL, uslsa_childdet); 158 159 static int 160 uslsa_match(device_t parent, cfdata_t match, void *aux) 161 { 162 const struct usbif_attach_arg *uiaa = aux; 163 164 if (usb_lookup(uslsa_devs, uiaa->uiaa_vendor, uiaa->uiaa_product) 165 != NULL) 166 return UMATCH_VENDOR_PRODUCT; 167 else 168 return UMATCH_NONE; 169 } 170 171 static void 172 uslsa_attach(device_t parent, device_t self, void *aux) 173 { 174 struct uslsa_softc *sc; 175 const struct usbif_attach_arg *uiaa = aux; 176 const usb_interface_descriptor_t *id; 177 const usb_endpoint_descriptor_t *ed; 178 char *devinfop; 179 struct ucom_attach_args ucaa; 180 int i; 181 182 sc = device_private(self); 183 184 sc->sc_dev = self; 185 sc->sc_udev = uiaa->uiaa_device; 186 sc->sc_iface = uiaa->uiaa_iface; 187 188 aprint_naive("\n"); 189 aprint_normal("\n"); 190 191 devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); 192 aprint_normal_dev(self, "%s\n", devinfop); 193 usbd_devinfo_free(devinfop); 194 195 id = usbd_get_interface_descriptor(sc->sc_iface); 196 197 sc->sc_ifnum = id->bInterfaceNumber; 198 199 ucaa.ucaa_info = "Silicon Labs CP210x"; 200 ucaa.ucaa_portno = UCOM_UNK_PORTNO; 201 ucaa.ucaa_ibufsize = USLSA_BUFSIZE; 202 ucaa.ucaa_obufsize = USLSA_BUFSIZE; 203 ucaa.ucaa_ibufsizepad = USLSA_BUFSIZE; 204 ucaa.ucaa_opkthdrlen = 0; 205 ucaa.ucaa_device = sc->sc_udev; 206 ucaa.ucaa_iface = sc->sc_iface; 207 ucaa.ucaa_methods = &uslsa_methods; 208 ucaa.ucaa_arg = sc; 209 210 usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); 211 212 ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; 213 for (i = 0; i < id->bNumEndpoints; i++) { 214 int addr, dir, attr; 215 216 ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); 217 if (ed == NULL) { 218 aprint_error_dev(self, 219 "could not read endpoint descriptor\n"); 220 sc->sc_dying = true; 221 return; 222 } 223 addr = ed->bEndpointAddress; 224 dir = UE_GET_DIR(ed->bEndpointAddress); 225 attr = ed->bmAttributes & UE_XFERTYPE; 226 if (dir == UE_DIR_IN && attr == UE_BULK) { 227 ucaa.ucaa_bulkin = addr; 228 } else if (dir == UE_DIR_OUT && attr == UE_BULK) { 229 ucaa.ucaa_bulkout = addr; 230 } else { 231 aprint_error_dev(self, "unexpected endpoint\n"); 232 } 233 } 234 aprint_debug_dev(sc->sc_dev, "EPs: in=%#x out=%#x\n", 235 ucaa.ucaa_bulkin, ucaa.ucaa_bulkout); 236 if ((ucaa.ucaa_bulkin == -1) || (ucaa.ucaa_bulkout == -1)) { 237 aprint_error_dev(self, "could not find endpoints\n"); 238 sc->sc_dying = true; 239 return; 240 } 241 242 sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, 243 ucomprint, ucomsubmatch); 244 245 if (!pmf_device_register(self, NULL, NULL)) 246 aprint_error_dev(self, "couldn't establish power handler\n"); 247 248 return; 249 } 250 251 static int 252 uslsa_activate(device_t self, enum devact act) 253 { 254 struct uslsa_softc *sc = device_private(self); 255 256 switch (act) { 257 case DVACT_DEACTIVATE: 258 sc->sc_dying = true; 259 return 0; 260 default: 261 return EOPNOTSUPP; 262 } 263 } 264 265 static void 266 uslsa_childdet(device_t self, device_t child) 267 { 268 struct uslsa_softc *sc = device_private(self); 269 270 KASSERT(sc->sc_subdev == child); 271 sc->sc_subdev = NULL; 272 } 273 274 static int 275 uslsa_detach(device_t self, int flags) 276 { 277 struct uslsa_softc *sc = device_private(self); 278 int rv = 0; 279 280 DPRINTF((self, "%s(%p, %#x)\n", __func__, self, flags)); 281 282 sc->sc_dying = true; 283 284 if (sc->sc_subdev != NULL) { 285 rv = config_detach(sc->sc_subdev, flags); 286 } 287 288 usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); 289 290 return (rv); 291 } 292 293 static int 294 uslsa_usbd_errno(usbd_status status) 295 { 296 switch (status) { 297 case USBD_NORMAL_COMPLETION: 298 return 0; 299 case USBD_STALLED: 300 return EINVAL; 301 default: 302 return EIO; 303 } 304 } 305 306 static void 307 uslsa_get_status(void *vsc, int portno, u_char *lsr, u_char *msr) 308 { 309 struct uslsa_softc *sc; 310 usb_device_request_t req; 311 usbd_status status; 312 uint8_t mdmsts; 313 314 sc = vsc; 315 316 DPRINTF((sc->sc_dev, "%s(%p, %d, ....)\n", __func__, vsc, portno)); 317 318 if (sc->sc_dying) { 319 return; 320 } 321 322 req.bmRequestType = UT_READ_VENDOR_INTERFACE; 323 req.bRequest = SLSA_R_GET_MDMSTS; 324 USETW(req.wValue, 0); 325 USETW(req.wIndex, sc->sc_ifnum); 326 USETW(req.wLength, SLSA_RL_GET_MDMSTS); 327 328 status = usbd_do_request(sc->sc_udev, &req, &mdmsts); 329 if (status != USBD_NORMAL_COMPLETION) { 330 device_printf(sc->sc_dev, "%s: GET_MDMSTS %s\n", 331 __func__, usbd_errstr(status)); 332 return; 333 } 334 335 DPRINTF((sc->sc_dev, "%s: GET_MDMSTS %#x\n", __func__, mdmsts)); 336 337 if (lsr != NULL) { 338 *lsr = 0; 339 } 340 341 if (msr != NULL) { 342 *msr = 0; 343 *msr |= ISSET(mdmsts, SLSA_MDMSTS_CTS) ? UMSR_CTS : 0; 344 *msr |= ISSET(mdmsts, SLSA_MDMSTS_DSR) ? UMSR_DSR : 0; 345 *msr |= ISSET(mdmsts, SLSA_MDMSTS_RI) ? UMSR_RI : 0; 346 *msr |= ISSET(mdmsts, SLSA_MDMSTS_DCD) ? UMSR_DCD : 0; 347 } 348 } 349 350 static void 351 uslsa_set(void *vsc, int portno, int reg, int onoff) 352 { 353 struct uslsa_softc *sc; 354 355 sc = vsc; 356 357 DPRINTF((sc->sc_dev, "%s(%p, %d, %d, %d)\n", __func__, vsc, portno, 358 reg, onoff)); 359 360 if (sc->sc_dying) { 361 return; 362 } 363 364 switch (reg) { 365 case UCOM_SET_DTR: 366 if (uslsa_request_set(sc, SLSA_R_SET_MHS, 367 SLSA_RV_SET_MHS_DTR_MASK | 368 (onoff ? SLSA_RV_SET_MHS_DTR : 0))) { 369 device_printf(sc->sc_dev, "SET_MHS/DTR failed\n"); 370 } 371 break; 372 case UCOM_SET_RTS: 373 if (uslsa_request_set(sc, SLSA_R_SET_MHS, 374 SLSA_RV_SET_MHS_RTS_MASK | 375 (onoff ? SLSA_RV_SET_MHS_RTS : 0))) { 376 device_printf(sc->sc_dev, "SET_MHS/RTS failed\n"); 377 } 378 break; 379 case UCOM_SET_BREAK: 380 if (uslsa_request_set(sc, SLSA_R_SET_BREAK, 381 (onoff ? SLSA_RV_SET_BREAK_ENABLE : 382 SLSA_RV_SET_BREAK_DISABLE))) { 383 device_printf(sc->sc_dev, "SET_BREAK failed\n"); 384 } 385 break; 386 default: 387 break; 388 } 389 } 390 391 static int 392 uslsa_param(void *vsc, int portno, struct termios *t) 393 { 394 struct uslsa_softc *sc; 395 usb_device_request_t req; 396 usbd_status status; 397 uint16_t value; 398 uint32_t baud; 399 int ret; 400 401 sc = vsc; 402 403 DPRINTF((sc->sc_dev, "%s(%p, %d, %p)\n", __func__, vsc, portno, t)); 404 405 if (sc->sc_dying) { 406 return EIO; 407 } 408 409 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 410 req.bRequest = SLSA_R_SET_BAUDRATE; 411 USETW(req.wValue, 0); 412 USETW(req.wIndex, sc->sc_ifnum); 413 USETW(req.wLength, 4); 414 415 baud = t->c_ospeed; 416 status = usbd_do_request(sc->sc_udev, &req, &baud); 417 if (status != USBD_NORMAL_COMPLETION) { 418 /* fallback method for devices that don't know SET_BAUDRATE */ 419 /* hope we calculate it right */ 420 device_printf(sc->sc_dev, "%s: set baudrate %d, failed %s," 421 " using set bauddiv\n", 422 __func__, baud, usbd_errstr(status)); 423 424 value = SLSA_RV_BAUDDIV(t->c_ospeed); 425 if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) 426 != 0) { 427 device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n", 428 __func__); 429 return ret; 430 } 431 } 432 433 value = 0; 434 435 if (ISSET(t->c_cflag, CSTOPB)) { 436 value |= SLSA_RV_LINE_CTL_STOP_2; 437 } else { 438 value |= SLSA_RV_LINE_CTL_STOP_1; 439 } 440 441 if (ISSET(t->c_cflag, PARENB)) { 442 if (ISSET(t->c_cflag, PARODD)) { 443 value |= SLSA_RV_LINE_CTL_PARITY_ODD; 444 } else { 445 value |= SLSA_RV_LINE_CTL_PARITY_EVEN; 446 } 447 } else { 448 value |= SLSA_RV_LINE_CTL_PARITY_NONE; 449 } 450 451 switch (ISSET(t->c_cflag, CSIZE)) { 452 case CS5: 453 value |= SLSA_RV_LINE_CTL_LEN_5; 454 break; 455 case CS6: 456 value |= SLSA_RV_LINE_CTL_LEN_6; 457 break; 458 case CS7: 459 value |= SLSA_RV_LINE_CTL_LEN_7; 460 break; 461 case CS8: 462 value |= SLSA_RV_LINE_CTL_LEN_8; 463 break; 464 } 465 466 DPRINTF((sc->sc_dev, "%s: setting LINE_CTL to 0x%x\n", 467 __func__, value)); 468 if ((ret = uslsa_request_set(sc, SLSA_R_SET_LINE_CTL, value)) != 0) { 469 device_printf(sc->sc_dev, "SET_LINE_CTL failed\n"); 470 return ret; 471 } 472 473 if ((ret = uslsa_set_flow(sc, t->c_cflag, t->c_iflag)) != 0) { 474 device_printf(sc->sc_dev, "SET_LINE_CTL failed\n"); 475 } 476 477 return ret; 478 } 479 480 static int 481 uslsa_ioctl(void *vsc, int portno, u_long cmd, void *data, int flag, proc_t *p) 482 { 483 struct uslsa_softc *sc; 484 485 sc = vsc; 486 487 switch (cmd) { 488 case TIOCMGET: 489 ucom_status_change(device_private(sc->sc_subdev)); 490 return EPASSTHROUGH; 491 default: 492 return EPASSTHROUGH; 493 } 494 495 return 0; 496 } 497 498 static int 499 uslsa_open(void *vsc, int portno) 500 { 501 struct uslsa_softc *sc; 502 503 sc = vsc; 504 505 DPRINTF((sc->sc_dev, "%s(%p, %d)\n", __func__, vsc, portno)); 506 507 if (sc->sc_dying) { 508 return EIO; 509 } 510 511 return uslsa_request_set(sc, SLSA_R_IFC_ENABLE, 512 SLSA_RV_IFC_ENABLE_ENABLE); 513 } 514 515 static void 516 uslsa_close(void *vsc, int portno) 517 { 518 struct uslsa_softc *sc; 519 520 sc = vsc; 521 522 DPRINTF((sc->sc_dev, "%s(%p, %d)\n", __func__, vsc, portno)); 523 524 if (sc->sc_dying) { 525 return; 526 } 527 528 (void)uslsa_request_set(sc, SLSA_R_IFC_ENABLE, 529 SLSA_RV_IFC_ENABLE_DISABLE); 530 } 531 532 static int 533 uslsa_request_set(struct uslsa_softc * sc, uint8_t request, uint16_t value) 534 { 535 usb_device_request_t req; 536 usbd_status status; 537 538 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 539 req.bRequest = request; 540 USETW(req.wValue, value); 541 USETW(req.wIndex, sc->sc_ifnum); 542 USETW(req.wLength, 0); 543 544 status = usbd_do_request(sc->sc_udev, &req, NULL); 545 546 return uslsa_usbd_errno(status); 547 } 548 549 static int 550 uslsa_set_flow(struct uslsa_softc *sc, tcflag_t cflag, tcflag_t iflag) 551 { 552 struct slsa_fcs fcs; 553 usb_device_request_t req; 554 uint32_t ulControlHandshake; 555 uint32_t ulFlowReplace; 556 usbd_status status; 557 558 DPRINTF((sc->sc_dev, "%s(%p, %#x, %#x)\n", __func__, sc, cflag, iflag)); 559 560 req.bmRequestType = UT_READ_VENDOR_INTERFACE; 561 req.bRequest = SLSA_R_GET_FLOW; 562 USETW(req.wValue, 0); 563 USETW(req.wIndex, sc->sc_ifnum); 564 USETW(req.wLength, SLSA_RL_GET_FLOW); 565 566 status = usbd_do_request(sc->sc_udev, &req, &fcs); 567 if (status != USBD_NORMAL_COMPLETION) { 568 device_printf(sc->sc_dev, "%s: GET_FLOW %s\n", 569 __func__, usbd_errstr(status)); 570 return uslsa_usbd_errno(status); 571 } 572 573 ulControlHandshake = le32toh(fcs.ulControlHandshake); 574 ulFlowReplace = le32toh(fcs.ulFlowReplace); 575 576 if (ISSET(cflag, CRTSCTS)) { 577 ulControlHandshake = 578 SERIAL_CTS_HANDSHAKE | __SHIFTIN(1, SERIAL_DTR_MASK); 579 ulFlowReplace = __SHIFTIN(2, SERIAL_RTS_MASK); 580 } else { 581 ulControlHandshake = __SHIFTIN(1, SERIAL_DTR_MASK); 582 ulFlowReplace = __SHIFTIN(1, SERIAL_RTS_MASK); 583 } 584 585 fcs.ulControlHandshake = htole32(ulControlHandshake); 586 fcs.ulFlowReplace = htole32(ulFlowReplace); 587 588 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 589 req.bRequest = SLSA_R_SET_FLOW; 590 USETW(req.wValue, 0); 591 USETW(req.wIndex, sc->sc_ifnum); 592 USETW(req.wLength, SLSA_RL_SET_FLOW); 593 594 status = usbd_do_request(sc->sc_udev, &req, &fcs); 595 596 return uslsa_usbd_errno(status); 597 } 598