diff --git a/usr.sbin/btattach/btattach.c b/usr.sbin/btattach/btattach.c index ded5415764d0..51410f2b4553 100644 --- a/usr.sbin/btattach/btattach.c +++ b/usr.sbin/btattach/btattach.c @@ -1,4 +1,4 @@ -/* $NetBSD: btattach.c,v 1.6 2010/02/17 09:49:41 plunky Exp $ */ +/* $NetBSD: btattach.c,v 1.7 2010/03/08 17:41:11 kiyohara Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -27,7 +27,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008 Iain Hibbert. All rights reserved."); -__RCSID("$NetBSD: btattach.c,v 1.6 2010/02/17 09:49:41 plunky Exp $"); +__RCSID("$NetBSD: btattach.c,v 1.7 2010/03/08 17:41:11 kiyohara Exp $"); #include #include @@ -64,7 +64,7 @@ const struct devtype types[] = { .name = "bcsp", .line = "bcsp", .descr = "Generic BlueCore Serial Protocol", - .cflag = CRTSCTS, + .cflag = CRTSCTS | PARENB, .speed = B57600, }, { @@ -150,21 +150,26 @@ main(int argc, char *argv[]) const struct devtype *type; struct termios tio; unsigned int init_speed, speed; - tcflag_t cflag; + tcflag_t cflag, Cflag; int fd, ch, i; const char *name; char *ptr; init_speed = 0; cflag = CLOCAL; + Cflag = 0; name = "btuart"; - while ((ch = getopt(argc, argv, "dfi:op")) != -1) { + while ((ch = getopt(argc, argv, "dFfi:oPp")) != -1) { switch (ch) { case 'd': opt_debug++; break; + case 'F': + Cflag |= CRTSCTS; + break; + case 'f': cflag |= CRTSCTS; break; @@ -180,6 +185,10 @@ main(int argc, char *argv[]) cflag |= (PARENB | PARODD); break; + case 'P': + Cflag |= PARENB; + break; + case 'p': cflag |= PARENB; break; @@ -228,6 +237,7 @@ main(int argc, char *argv[]) cfmakeraw(&tio); tio.c_cflag |= (cflag | type->cflag); + tio.c_cflag &= ~Cflag; if (cfsetspeed(&tio, init_speed) < 0 || tcsetattr(fd, TCSANOW, &tio) < 0 @@ -276,13 +286,15 @@ usage(void) size_t i; fprintf(stderr, - "Usage: %s [-dfop] [-i speed] [type] tty speed\n" + "Usage: %s [-dFfoPp] [-i speed] [type] tty speed\n" "\n" "Where:\n" "\t-d debug mode (no detach, dump io)\n" + "\t-F disable flow control\n" "\t-f enable flow control\n" "\t-i speed init speed\n" "\t-o odd parity\n" + "\t-P no parity\n" "\t-p even parity\n" "\n" "Known types:\n"