Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/dev/usb Pull up following revision(s) (requested by s...



details:   https://anonhg.NetBSD.org/src/rev/a8822e819dbb
branches:  netbsd-7
changeset: 799694:a8822e819dbb
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Nov 08 05:17:40 2015 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #1027):
        sys/dev/usb/uplcom.c: revision 1.76
Don't pretend to do zero length IN control transfers as dwctwo(4)
(correctly according to usb 2.0 specification 8.5.3) uses IN status stage
when no (zero length) data stage.  Instead read into a 1 byte array.
My uplcom(4) now works on RPI.

diffstat:

 sys/dev/usb/uplcom.c |  40 ++++++++++++++++++++++++----------------
 1 files changed, 24 insertions(+), 16 deletions(-)

diffs (76 lines):

diff -r 7088e5fa7944 -r a8822e819dbb sys/dev/usb/uplcom.c
--- a/sys/dev/usb/uplcom.c      Sun Nov 08 02:08:18 2015 +0000
+++ b/sys/dev/usb/uplcom.c      Sun Nov 08 05:17:40 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $      */
+/*     $NetBSD: uplcom.c,v 1.74.2.2 2015/11/08 05:17:40 riz Exp $      */
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.2.2 2015/11/08 05:17:40 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -499,21 +499,20 @@
        uint8_t         request;
        uint16_t        value;
        uint16_t        index;
-       uint16_t        length;
 };
 
 static const struct pl2303x_init pl2303x[] = {
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0, 0 },
-       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,    0, 0 },
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0, 0 },
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8383,    0, 0 },
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0, 0 },
-       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,    1, 0 },
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0, 0 },
-       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8383,    0, 0 },
-       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      0,    1, 0 },
-       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      1,    0, 0 },
-       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      2, 0x44, 0 }
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0 },
+       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,    0 },
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0 },
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8383,    0 },
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0 },
+       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,    1 },
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8484,    0 },
+       { UT_READ_VENDOR_DEVICE,  UPLCOM_SET_REQUEST, 0x8383,    0 },
+       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      0,    1 },
+       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      1,    0 },
+       { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST,      2, 0x44 }
 };
 #define N_PL2302X_INIT  (sizeof(pl2303x)/sizeof(pl2303x[0]))
 
@@ -525,13 +524,22 @@
        int i;
 
        for (i = 0; i < N_PL2302X_INIT; i++) {
+               char buf[1];
+               void *b;
+
                req.bmRequestType = pl2303x[i].req_type;
                req.bRequest = pl2303x[i].request;
                USETW(req.wValue, pl2303x[i].value);
                USETW(req.wIndex, pl2303x[i].index);
-               USETW(req.wLength, pl2303x[i].length);
+               if (UT_GET_DIR(req.bmRequestType) == UT_READ) {
+                       b = buf;
+                       USETW(req.wLength, sizeof(buf));
+               } else {
+                       b = NULL;
+                       USETW(req.wLength, 0);
+               }
 
-               err = usbd_do_request(sc->sc_udev, &req, 0);
+               err = usbd_do_request(sc->sc_udev, &req, b);
                if (err) {
                        aprint_error_dev(sc->sc_dev,
                            "uplcom_pl2303x_init failed: %s\n",



Home | Main Index | Thread Index | Old Index