Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/dev/usb Pull up following revision(s) (requested by r...
details: https://anonhg.NetBSD.org/src/rev/9a29765bde93
branches: netbsd-6
changeset: 777057:9a29765bde93
user: snj <snj%NetBSD.org@localhost>
date: Tue May 10 23:10:59 2016 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #1381):
sys/dev/usb/uslsa.c: revision 1.19
Improve support for the CP2104. This particular device has a higher maximum
baud rate and thus the SLSA_R_SET_BAUDDIV sets the wrong rate.
Changed to code to use the SLSA_R_SET_BAUDRATE command and providing a
fallback for the old SLSA_R_SET_BAUDDIV command if the device doesn't
recognize the command. Unknown yet if the CP2101 has this command or not.
diffstat:
sys/dev/usb/uslsa.c | 34 ++++++++++++++++++++++++++--------
1 files changed, 26 insertions(+), 8 deletions(-)
diffs (64 lines):
diff -r cb61e0e66ffe -r 9a29765bde93 sys/dev/usb/uslsa.c
--- a/sys/dev/usb/uslsa.c Sun May 08 22:06:34 2016 +0000
+++ b/sys/dev/usb/uslsa.c Tue May 10 23:10:59 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.18 2012/01/14 21:15:48 jakllsch Exp $ */
+/* $NetBSD: uslsa.c,v 1.18.2.1 2016/05/10 23:10:59 snj Exp $ */
/* from ugensa.c */
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.18 2012/01/14 21:15:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.18.2.1 2016/05/10 23:10:59 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -388,8 +388,11 @@
uslsa_param(void *vsc, int portno, struct termios *t)
{
struct uslsa_softc *sc;
+ usb_device_request_t req;
+ usbd_status status;
+ uint16_t value;
+ uint32_t baud;
int ret;
- uint16_t value;
sc = vsc;
@@ -399,12 +402,27 @@
return EIO;
}
- value = SLSA_RV_BAUDDIV(t->c_ospeed);
+ req.bmRequestType = UT_WRITE_VENDOR_INTERFACE;
+ req.bRequest = SLSA_R_SET_BAUDRATE;
+ USETW(req.wValue, 0);
+ USETW(req.wIndex, sc->sc_ifnum);
+ USETW(req.wLength, 4);
- if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) != 0) {
- device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n",
- __func__);
- return ret;
+ baud = t->c_ospeed;
+ status = usbd_do_request(sc->sc_udev, &req, &baud);
+ if (status != USBD_NORMAL_COMPLETION) {
+ /* fallback method for devices that don't know SET_BAUDRATE */
+ /* hope we calculate it right */
+ device_printf(sc->sc_dev, "%s: set baudrate %d, failed %s,"
+ " using set bauddiv\n",
+ __func__, baud, usbd_errstr(status));
+
+ value = SLSA_RV_BAUDDIV(t->c_ospeed);
+ if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) != 0) {
+ device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n",
+ __func__);
+ return ret;
+ }
}
value = 0;
Home |
Main Index |
Thread Index |
Old Index