1 /* $NetBSD: uslsa.c,v 1.23 2016/12/16 14:56:34 maya 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.23 2016/12/16 14:56:34 maya 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 }; 148 149 static int uslsa_match(device_t, cfdata_t, void *); 150 static void uslsa_attach(device_t, device_t, void *); 151 static void uslsa_childdet(device_t, device_t); 152 static int uslsa_detach(device_t, int); 153 static int uslsa_activate(device_t, enum devact); 154 155 CFATTACH_DECL2_NEW(uslsa, sizeof(struct uslsa_softc), uslsa_match, 156 uslsa_attach, uslsa_detach, uslsa_activate, NULL, uslsa_childdet); 157 158 static int 159 uslsa_match(device_t parent, cfdata_t match, void *aux) 160 { 161 const struct usbif_attach_arg *uiaa = aux; 162 163 if (usb_lookup(uslsa_devs, uiaa->uiaa_vendor, uiaa->uiaa_product) 164 != NULL) 165 return UMATCH_VENDOR_PRODUCT; 166 else 167 return UMATCH_NONE; 168 } 169 170 static void 171 uslsa_attach(device_t parent, device_t self, void *aux) 172 { 173 struct uslsa_softc *sc; 174 const struct usbif_attach_arg *uiaa = aux; 175 const usb_interface_descriptor_t *id; 176 const usb_endpoint_descriptor_t *ed; 177 char *devinfop; 178 struct ucom_attach_args ucaa; 179 int i; 180 181 sc = device_private(self); 182 183 sc->sc_dev = self; 184 sc->sc_udev = uiaa->uiaa_device; 185 sc->sc_iface = uiaa->uiaa_iface; 186 187 aprint_naive("\n"); 188 aprint_normal("\n"); 189 190 devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); 191 aprint_normal_dev(self, "%s\n", devinfop); 192 usbd_devinfo_free(devinfop); 193 194 id = usbd_get_interface_descriptor(sc->sc_iface); 195 196 sc->sc_ifnum = id->bInterfaceNumber; 197 198 ucaa.ucaa_info = "Silicon Labs CP210x"; 199 ucaa.ucaa_portno = UCOM_UNK_PORTNO; 200 ucaa.ucaa_ibufsize = USLSA_BUFSIZE; 201 ucaa.ucaa_obufsize = USLSA_BUFSIZE; 202 ucaa.ucaa_ibufsizepad = USLSA_BUFSIZE; 203 ucaa.ucaa_opkthdrlen = 0; 204 ucaa.ucaa_device = sc->sc_udev; 205 ucaa.ucaa_iface = sc->sc_iface; 206 ucaa.ucaa_methods = &uslsa_methods; 207 ucaa.ucaa_arg = sc; 208 209 usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); 210 211 ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; 212 for (i = 0; i < id->bNumEndpoints; i++) { 213 int addr, dir, attr; 214 215 ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); 216 if (ed == NULL) { 217 aprint_error_dev(self, 218 "could not read endpoint descriptor\n"); 219 sc->sc_dying = true; 220 return; 221 } 222 addr = ed->bEndpointAddress; 223 dir = UE_GET_DIR(ed->bEndpointAddress); 224 attr = ed->bmAttributes & UE_XFERTYPE; 225 if (dir == UE_DIR_IN && attr == UE_BULK) { 226 ucaa.ucaa_bulkin = addr; 227 } else if (dir == UE_DIR_OUT && attr == UE_BULK) { 228 ucaa.ucaa_bulkout = addr; 229 } else { 230 aprint_error_dev(self, "unexpected endpoint\n"); 231 } 232 } 233 aprint_debug_dev(sc->sc_dev, "EPs: in=%#x out=%#x\n", 234 ucaa.ucaa_bulkin, ucaa.ucaa_bulkout); 235 if ((ucaa.ucaa_bulkin == -1) || (ucaa.ucaa_bulkout == -1)) { 236 aprint_error_dev(self, "could not find endpoints\n"); 237 sc->sc_dying = true; 238 return; 239 } 240 241 sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, 242 ucomprint, ucomsubmatch); 243 244 if (!pmf_device_register(self, NULL, NULL)) 245 aprint_error_dev(self, "couldn't establish power handler\n"); 246 247 return; 248 } 249 250 static int 251 uslsa_activate(device_t self, enum devact act) 252 { 253 struct uslsa_softc *sc = device_private(self); 254 255 switch (act) { 256 case DVACT_DEACTIVATE: 257 sc->sc_dying = true; 258 return 0; 259 default: 260 return EOPNOTSUPP; 261 } 262 } 263 264 static void 265 uslsa_childdet(device_t self, device_t child) 266 { 267 struct uslsa_softc *sc = device_private(self); 268 269 KASSERT(sc->sc_subdev == child); 270 sc->sc_subdev = NULL; 271 } 272 273 static int 274 uslsa_detach(device_t self, int flags) 275 { 276 struct uslsa_softc *sc = device_private(self); 277 int rv = 0; 278 279 DPRINTF((self, "%s(%p, %#x)\n", __func__, self, flags)); 280 281 sc->sc_dying = true; 282 283 if (sc->sc_subdev != NULL) { 284 rv = config_detach(sc->sc_subdev, flags); 285 } 286 287 usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); 288 289 return (rv); 290 } 291 292 static int 293 uslsa_usbd_errno(usbd_status status) 294 { 295 switch (status) { 296 case USBD_NORMAL_COMPLETION: 297 return 0; 298 case USBD_STALLED: 299 return EINVAL; 300 default: 301 return EIO; 302 } 303 } 304 305 static void 306 uslsa_get_status(void *vsc, int portno, u_char *lsr, u_char *msr) 307 { 308 struct uslsa_softc *sc; 309 usb_device_request_t req; 310 usbd_status status; 311 uint8_t mdmsts; 312 313 sc = vsc; 314 315 DPRINTF((sc->sc_dev, "%s(%p, %d, ....)\n", __func__, vsc, portno)); 316 317 if (sc->sc_dying) { 318 return; 319 } 320 321 req.bmRequestType = UT_READ_VENDOR_INTERFACE; 322 req.bRequest = SLSA_R_GET_MDMSTS; 323 USETW(req.wValue, 0); 324 USETW(req.wIndex, sc->sc_ifnum); 325 USETW(req.wLength, SLSA_RL_GET_MDMSTS); 326 327 status = usbd_do_request(sc->sc_udev, &req, &mdmsts); 328 if (status != USBD_NORMAL_COMPLETION) { 329 device_printf(sc->sc_dev, "%s: GET_MDMSTS %s\n", 330 __func__, usbd_errstr(status)); 331 return; 332 } 333 334 DPRINTF((sc->sc_dev, "%s: GET_MDMSTS %#x\n", __func__, mdmsts)); 335 336 if (lsr != NULL) { 337 *lsr = 0; 338 } 339 340 if (msr != NULL) { 341 *msr = 0; 342 *msr |= ISSET(mdmsts, SLSA_MDMSTS_CTS) ? UMSR_CTS : 0; 343 *msr |= ISSET(mdmsts, SLSA_MDMSTS_DSR) ? UMSR_DSR : 0; 344 *msr |= ISSET(mdmsts, SLSA_MDMSTS_RI) ? UMSR_RI : 0; 345 *msr |= ISSET(mdmsts, SLSA_MDMSTS_DCD) ? UMSR_DCD : 0; 346 } 347 } 348 349 static void 350 uslsa_set(void *vsc, int portno, int reg, int onoff) 351 { 352 struct uslsa_softc *sc; 353 354 sc = vsc; 355 356 DPRINTF((sc->sc_dev, "%s(%p, %d, %d, %d)\n", __func__, vsc, portno, 357 reg, onoff)); 358 359 if (sc->sc_dying) { 360 return; 361 } 362 363 switch (reg) { 364 case UCOM_SET_DTR: 365 if (uslsa_request_set(sc, SLSA_R_SET_MHS, 366 SLSA_RV_SET_MHS_DTR_MASK | 367 (onoff ? SLSA_RV_SET_MHS_DTR : 0))) { 368 device_printf(sc->sc_dev, "SET_MHS/DTR failed\n"); 369 } 370 break; 371 case UCOM_SET_RTS: 372 if (uslsa_request_set(sc, SLSA_R_SET_MHS, 373 SLSA_RV_SET_MHS_RTS_MASK | 374 (onoff ? SLSA_RV_SET_MHS_RTS : 0))) { 375 device_printf(sc->sc_dev, "SET_MHS/RTS failed\n"); 376 } 377 break; 378 case UCOM_SET_BREAK: 379 if (uslsa_request_set(sc, SLSA_R_SET_BREAK, 380 (onoff ? SLSA_RV_SET_BREAK_ENABLE : 381 SLSA_RV_SET_BREAK_DISABLE))) { 382 device_printf(sc->sc_dev, "SET_BREAK failed\n"); 383 } 384 break; 385 default: 386 break; 387 } 388 } 389 390 static int 391 uslsa_param(void *vsc, int portno, struct termios *t) 392 { 393 struct uslsa_softc *sc; 394 usb_device_request_t req; 395 usbd_status status; 396 uint16_t value; 397 uint32_t baud; 398 int ret; 399 400 sc = vsc; 401 402 DPRINTF((sc->sc_dev, "%s(%p, %d, %p)\n", __func__, vsc, portno, t)); 403 404 if (sc->sc_dying) { 405 return EIO; 406 } 407 408 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 409 req.bRequest = SLSA_R_SET_BAUDRATE; 410 USETW(req.wValue, 0); 411 USETW(req.wIndex, sc->sc_ifnum); 412 USETW(req.wLength, 4); 413 414 baud = t->c_ospeed; 415 status = usbd_do_request(sc->sc_udev, &req, &baud); 416 if (status != USBD_NORMAL_COMPLETION) { 417 /* fallback method for devices that don't know SET_BAUDRATE */ 418 /* hope we calculate it right */ 419 device_printf(sc->sc_dev, "%s: set baudrate %d, failed %s," 420 " using set bauddiv\n", 421 __func__, baud, usbd_errstr(status)); 422 423 value = SLSA_RV_BAUDDIV(t->c_ospeed); 424 if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) 425 != 0) { 426 device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n", 427 __func__); 428 return ret; 429 } 430 } 431 432 value = 0; 433 434 if (ISSET(t->c_cflag, CSTOPB)) { 435 value |= SLSA_RV_LINE_CTL_STOP_2; 436 } else { 437 value |= SLSA_RV_LINE_CTL_STOP_1; 438 } 439 440 if (ISSET(t->c_cflag, PARENB)) { 441 if (ISSET(t->c_cflag, PARODD)) { 442 value |= SLSA_RV_LINE_CTL_PARITY_ODD; 443 } else { 444 value |= SLSA_RV_LINE_CTL_PARITY_EVEN; 445 } 446 } else { 447 value |= SLSA_RV_LINE_CTL_PARITY_NONE; 448 } 449 450 switch (ISSET(t->c_cflag, CSIZE)) { 451 case CS5: 452 value |= SLSA_RV_LINE_CTL_LEN_5; 453 break; 454 case CS6: 455 value |= SLSA_RV_LINE_CTL_LEN_6; 456 break; 457 case CS7: 458 value |= SLSA_RV_LINE_CTL_LEN_7; 459 break; 460 case CS8: 461 value |= SLSA_RV_LINE_CTL_LEN_8; 462 break; 463 } 464 465 DPRINTF((sc->sc_dev, "%s: setting LINE_CTL to 0x%x\n", 466 __func__, value)); 467 if ((ret = uslsa_request_set(sc, SLSA_R_SET_LINE_CTL, value)) != 0) { 468 device_printf(sc->sc_dev, "SET_LINE_CTL failed\n"); 469 return ret; 470 } 471 472 if ((ret = uslsa_set_flow(sc, t->c_cflag, t->c_iflag)) != 0) { 473 device_printf(sc->sc_dev, "SET_LINE_CTL failed\n"); 474 } 475 476 return ret; 477 } 478 479 static int 480 uslsa_ioctl(void *vsc, int portno, u_long cmd, void *data, int flag, proc_t *p) 481 { 482 struct uslsa_softc *sc; 483 484 sc = vsc; 485 486 switch (cmd) { 487 case TIOCMGET: 488 ucom_status_change(device_private(sc->sc_subdev)); 489 return EPASSTHROUGH; 490 default: 491 return EPASSTHROUGH; 492 } 493 494 return 0; 495 } 496 497 static int 498 uslsa_open(void *vsc, int portno) 499 { 500 struct uslsa_softc *sc; 501 502 sc = vsc; 503 504 DPRINTF((sc->sc_dev, "%s(%p, %d)\n", __func__, vsc, portno)); 505 506 if (sc->sc_dying) { 507 return EIO; 508 } 509 510 return uslsa_request_set(sc, SLSA_R_IFC_ENABLE, 511 SLSA_RV_IFC_ENABLE_ENABLE); 512 } 513 514 static void 515 uslsa_close(void *vsc, int portno) 516 { 517 struct uslsa_softc *sc; 518 519 sc = vsc; 520 521 DPRINTF((sc->sc_dev, "%s(%p, %d)\n", __func__, vsc, portno)); 522 523 if (sc->sc_dying) { 524 return; 525 } 526 527 (void)uslsa_request_set(sc, SLSA_R_IFC_ENABLE, 528 SLSA_RV_IFC_ENABLE_DISABLE); 529 } 530 531 static int 532 uslsa_request_set(struct uslsa_softc * sc, uint8_t request, uint16_t value) 533 { 534 usb_device_request_t req; 535 usbd_status status; 536 537 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 538 req.bRequest = request; 539 USETW(req.wValue, value); 540 USETW(req.wIndex, sc->sc_ifnum); 541 USETW(req.wLength, 0); 542 543 status = usbd_do_request(sc->sc_udev, &req, NULL); 544 545 return uslsa_usbd_errno(status); 546 } 547 548 static int 549 uslsa_set_flow(struct uslsa_softc *sc, tcflag_t cflag, tcflag_t iflag) 550 { 551 struct slsa_fcs fcs; 552 usb_device_request_t req; 553 uint32_t ulControlHandshake; 554 uint32_t ulFlowReplace; 555 usbd_status status; 556 557 DPRINTF((sc->sc_dev, "%s(%p, %#x, %#x)\n", __func__, sc, cflag, iflag)); 558 559 req.bmRequestType = UT_READ_VENDOR_INTERFACE; 560 req.bRequest = SLSA_R_GET_FLOW; 561 USETW(req.wValue, 0); 562 USETW(req.wIndex, sc->sc_ifnum); 563 USETW(req.wLength, SLSA_RL_GET_FLOW); 564 565 status = usbd_do_request(sc->sc_udev, &req, &fcs); 566 if (status != USBD_NORMAL_COMPLETION) { 567 device_printf(sc->sc_dev, "%s: GET_FLOW %s\n", 568 __func__, usbd_errstr(status)); 569 return uslsa_usbd_errno(status); 570 } 571 572 ulControlHandshake = le32toh(fcs.ulControlHandshake); 573 ulFlowReplace = le32toh(fcs.ulFlowReplace); 574 575 if (ISSET(cflag, CRTSCTS)) { 576 ulControlHandshake = 577 SERIAL_CTS_HANDSHAKE | __SHIFTIN(1, SERIAL_DTR_MASK); 578 ulFlowReplace = __SHIFTIN(2, SERIAL_RTS_MASK); 579 } else { 580 ulControlHandshake = __SHIFTIN(1, SERIAL_DTR_MASK); 581 ulFlowReplace = __SHIFTIN(1, SERIAL_RTS_MASK); 582 } 583 584 fcs.ulControlHandshake = htole32(ulControlHandshake); 585 fcs.ulFlowReplace = htole32(ulFlowReplace); 586 587 req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; 588 req.bRequest = SLSA_R_SET_FLOW; 589 USETW(req.wValue, 0); 590 USETW(req.wIndex, sc->sc_ifnum); 591 USETW(req.wLength, SLSA_RL_SET_FLOW); 592 593 status = usbd_do_request(sc->sc_udev, &req, &fcs); 594 595 return uslsa_usbd_errno(status); 596 } 597