summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-11-24 10:52:13 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-11-24 10:52:13 +0000
commitdbc5591e59e94430789d9b4bf7ceb898757a8bcb (patch)
treef200d5cedef88fd14f4a42005bea7e9145da28b9 /sys
parenta6961d473193183fd729bd608dfd3b09157e9c20 (diff)
Allow for any baud rate within a range rather than
having a fixed list of rates.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/uslcom.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/sys/dev/usb/uslcom.c b/sys/dev/usb/uslcom.c
index 647222506f2..9b74e786303 100644
--- a/sys/dev/usb/uslcom.c
+++ b/sys/dev/usb/uslcom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uslcom.c,v 1.16 2007/10/11 18:33:15 deraadt Exp $ */
+/* $OpenBSD: uslcom.c,v 1.17 2007/11/24 10:52:12 jsg Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -346,32 +346,17 @@ uslcom_param(void *vsc, int portno, struct termios *t)
usb_device_request_t req;
int data;
- switch (t->c_ospeed) {
- case 600:
- case 1200:
- case 1800:
- case 2400:
- case 4800:
- case 9600:
- case 19200:
- case 38400:
- case 57600:
- case 115200:
- case 230400:
- case 460800:
- case 921600:
- req.bmRequestType = USLCOM_WRITE;
- req.bRequest = USLCOM_BAUD_RATE;
- USETW(req.wValue, USLCOM_BAUD_REF / t->c_ospeed);
- USETW(req.wIndex, portno);
- USETW(req.wLength, 0);
- err = usbd_do_request(sc->sc_udev, &req, NULL);
- if (err)
- return (EIO);
- break;
- default:
+ if (t->c_ospeed <= 0 || t->c_ospeed > 921600)
return (EINVAL);
- }
+
+ req.bmRequestType = USLCOM_WRITE;
+ req.bRequest = USLCOM_BAUD_RATE;
+ USETW(req.wValue, USLCOM_BAUD_REF / t->c_ospeed);
+ USETW(req.wIndex, portno);
+ USETW(req.wLength, 0);
+ err = usbd_do_request(sc->sc_udev, &req, NULL);
+ if (err)
+ return (EIO);
if (ISSET(t->c_cflag, CSTOPB))
data = USLCOM_STOP_BITS_2;