Mercurial > illumos > illumos-gate
changeset 9354:9559ac454e7e
6763764 Support for FTDI USB Serial adapters
6798921 usbser mishandles some ioctls
4696628 USB serial needs properties to ignore CD
6821751 Add support for 921600 baud
line wrap: on
line diff
--- a/usr/src/cmd/bnu/line.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/bnu/line.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,18 +18,17 @@ * * CDDL HEADER END */ + /* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* This is a new line.c, which consists of line.c and culine.c +/* + * This is a new line.c, which consists of line.c and culine.c * merged together. */ @@ -69,19 +67,20 @@ {230400, B230400}, {307200, B307200}, {460800, B460800}, + {921600, B921600}, {0, 0} }; -#define PACKSIZE 64 -#define HEADERSIZE 6 +#define PACKSIZE 64 +#define HEADERSIZE 6 GLOBAL int - packsize = PACKSIZE, - xpacksize = PACKSIZE; + packsize = PACKSIZE, + xpacksize = PACKSIZE; -#define SNDFILE 'S' -#define RCVFILE 'R' -#define RESET 'X' +#define SNDFILE 'S' +#define RCVFILE 'R' +#define RESET 'X' #ifdef PKSPEEDUP GLOBAL int linebaudrate; /* for speedup hook in pk1.c */ @@ -111,7 +110,7 @@ * if spwant == 0, speed is untouched * type is unused, but needed for compatibility * - * return: + * return: * none */ /*ARGSUSED*/ @@ -135,9 +134,9 @@ ttbufs.c_oflag = ttbuf.c_oflag; ttbufs.c_iflag = ttbuf.c_iflag; ttbufs.c_cflag = ttbuf.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) ttbufs.c_cc[i] = ttbuf.c_cc[i]; - } + } } if (spwant > 0) { for (ps = spds; ps->sp_val; ps++) @@ -145,8 +144,8 @@ speed = ps->sp_name; break; } - if ( speed < 0 ) - DEBUG(5, "speed (%d) not supported\n", spwant); + if (speed < 0) + DEBUG(5, "speed (%d) not supported\n", spwant); ASSERT(speed >= 0, "BAD SPEED", "", spwant); ttbufs.c_cflag &= 0xffff0000; cfsetospeed(&ttbufs, speed); @@ -182,31 +181,31 @@ #endif /* NO_MODEM_CTRL */ ttbufs.c_cflag &= ~CLOCAL; - if ( !EQUALS(Progname, "uucico") ) { + if (!EQUALS(Progname, "uucico")) { /* set attributes associated with -h, -t, -e, and -o options */ ttbufs.c_iflag = (IGNPAR | IGNBRK | IXON | IXOFF); ttbufs.c_cc[VEOF] = '\1'; - ttbufs.c_cflag |= ( CREAD | (speed ? HUPCL : 0)); + ttbufs.c_cflag |= (CREAD | (speed ? HUPCL : 0)); - if ( line_8bit ) { - ttbufs.c_cflag |= CS8; - ttbufs.c_iflag &= ~ISTRIP; + if (line_8bit) { + ttbufs.c_cflag |= CS8; + ttbufs.c_iflag &= ~ISTRIP; } else { - if (Evenflag) { /*even parity -e */ - ttbufs.c_cflag &= ~PARODD; - } else if(Oddflag) { /*odd parity -o */ - ttbufs.c_cflag |= PARODD; - } - ttbufs.c_cflag |= CS7|PARENB; - ttbufs.c_iflag |= ISTRIP; + if (Evenflag) { /* even parity -e */ + ttbufs.c_cflag &= ~PARODD; + } else if (Oddflag) { /* odd parity -o */ + ttbufs.c_cflag |= PARODD; + } + ttbufs.c_cflag |= CS7|PARENB; + ttbufs.c_iflag |= ISTRIP; } - if(!Duplex) /*half duplex -h */ - ttbufs.c_iflag &= ~(IXON | IXOFF); - if(Terminal) /* -t */ - ttbufs.c_oflag |= (OPOST | ONLCR); + if (!Duplex) /* half duplex -h */ + ttbufs.c_iflag &= ~(IXON | IXOFF); + if (Terminal) /* -t */ + ttbufs.c_oflag |= (OPOST | ONLCR); } else { /* non-uucico */ ttbufs.c_cflag |= (CS8 | CREAD | (speed ? HUPCL : 0)); @@ -219,16 +218,14 @@ ttbuf.c_oflag = ttbufs.c_oflag; ttbuf.c_iflag = ttbufs.c_iflag; ttbuf.c_cflag = ttbufs.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) ttbuf.c_cc[i] = ttbufs.c_cc[i]; ASSERT((*Ioctl)(tty, TCSETAW, &ttbuf) >= 0, - "RETURN FROM fixline ioctl", "", errno); + "RETURN FROM fixline ioctl", "", errno); } else { ASSERT((*Ioctl)(tty, TCSETSW, &ttbufs) >= 0, - "RETURN FROM fixline ioctl", "", errno); + "RETURN FROM fixline ioctl", "", errno); } - - return; } GLOBAL void @@ -243,16 +240,14 @@ ttbuf.c_cflag |= HUPCL; (void) (*Ioctl)(dcf, TCSETAW, &ttbuf); } - return; } GLOBAL void ttygenbrk(fn) register int fn; { - if (isatty(fn)) + if (isatty(fn)) (void) (*Ioctl)(fn, TCSBRK, 0); - return; } @@ -268,10 +263,10 @@ static struct termio tbuf; static struct termios tbufs; int i, vtime, istermios, ospeed; - + DEBUG(2, "setline - %c\n", type); - if ((istermios = (*Ioctl)(Ifn, TCGETS, &tbufs)) < 0) { + if ((istermios = (*Ioctl)(Ifn, TCGETS, &tbufs)) < 0) { if ((*Ioctl)(Ifn, TCGETA, &tbuf) != 0) { return; } else { @@ -279,7 +274,7 @@ tbufs.c_oflag = tbuf.c_oflag; tbufs.c_iflag = tbuf.c_iflag; tbufs.c_cflag = tbuf.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) tbufs.c_cc[i] = tbuf.c_cc[i]; } } @@ -304,6 +299,7 @@ case B230400: case B307200: case B460800: + case B921600: case B9600: vtime = 1; break; @@ -323,59 +319,66 @@ tbuf.c_oflag = tbufs.c_oflag; tbuf.c_iflag = tbufs.c_iflag; tbuf.c_cflag = tbufs.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) tbuf.c_cc[i] = tbufs.c_cc[i]; - if ( (*Ioctl)(Ifn, TCSETAW, &tbuf) != 0 ) - DEBUG(4, "setline Ioctl failed errno=%d\n", errno); - } else { - if ( (*Ioctl)(Ifn, TCSETSW, &tbufs) != 0 ) - DEBUG(4, "setline Ioctl failed errno=%d\n", errno); - } + if ((*Ioctl)(Ifn, TCSETAW, &tbuf) != 0) + DEBUG(4, "setline Ioctl failed errno=%d\n", + errno); + } else { + if ((*Ioctl)(Ifn, TCSETSW, &tbufs) != 0) + DEBUG(4, + "setline Ioctl failed errno=%d\n", + errno); + } } break; case SNDFILE: case RESET: if (tbufs.c_cc[VMIN] != HEADERSIZE) { - tbufs.c_cc[VMIN] = HEADERSIZE; - if (istermios < 0) { - tbuf.c_lflag = tbufs.c_lflag; - tbuf.c_oflag = tbufs.c_oflag; - tbuf.c_iflag = tbufs.c_iflag; - tbuf.c_cflag = tbufs.c_cflag; - for(i = 0; i < NCC; i++) - tbuf.c_cc[i] = tbufs.c_cc[i]; - if ( (*Ioctl)(Ifn, TCSETAW, &tbuf) != 0 ) - DEBUG(4, "setline Ioctl failed errno=%d\n", errno); - } else { - if ( (*Ioctl)(Ifn, TCSETSW, &tbufs) != 0 ) - DEBUG(4, "setline Ioctl failed errno=%d\n", errno); - } + tbufs.c_cc[VMIN] = HEADERSIZE; + if (istermios < 0) { + tbuf.c_lflag = tbufs.c_lflag; + tbuf.c_oflag = tbufs.c_oflag; + tbuf.c_iflag = tbufs.c_iflag; + tbuf.c_cflag = tbufs.c_cflag; + for (i = 0; i < NCC; i++) + tbuf.c_cc[i] = tbufs.c_cc[i]; + if ((*Ioctl)(Ifn, TCSETAW, &tbuf) != 0) + DEBUG(4, + "setline Ioctl failed errno=%d\n", + errno); + } else { + if ((*Ioctl)(Ifn, TCSETSW, &tbufs) != 0) + DEBUG(4, + "setline Ioctl failed errno=%d\n", + errno); + } } break; } - return; } GLOBAL int savline() { if ((Saved_termios = (*Ioctl)(0, TCGETS, &Savettybs)) < 0) { - if ( (*Ioctl)(0, TCGETA, &Savettyb) != 0 ) { - Saved_line = FALSE; - } else { - Saved_line = TRUE; - Savettyb.c_cflag = (Savettyb.c_cflag & ~CS8) | CS7 | PARENB; - Savettyb.c_oflag |= OPOST; - Savettyb.c_lflag |= (ISIG|ICANON|ECHO); - } + if ((*Ioctl)(0, TCGETA, &Savettyb) != 0) { + Saved_line = FALSE; + } else { + Saved_line = TRUE; + Savettyb.c_cflag = + (Savettyb.c_cflag & ~CS8) | CS7 | PARENB; + Savettyb.c_oflag |= OPOST; + Savettyb.c_lflag |= (ISIG|ICANON|ECHO); + } } else { Saved_line = TRUE; Savettybs.c_cflag = (Savettybs.c_cflag & ~CS8) | CS7 | PARENB; Savettybs.c_oflag |= OPOST; Savettybs.c_lflag |= (ISIG|ICANON|ECHO); } - return(0); + return (0); } #ifdef SYTEK @@ -398,14 +401,14 @@ int i, ret, istermios; if ((istermios = (*Ioctl)(tty, TCGETS, &ttbufs)) < 0) { - if ( (*Ioctl)(tty, TCGETA, &ttbuf) != 0 ) { + if ((*Ioctl)(tty, TCGETA, &ttbuf) != 0) { return; } else { ttbufs.c_lflag = ttbuf.c_lflag; ttbufs.c_oflag = ttbuf.c_oflag; ttbufs.c_iflag = ttbuf.c_iflag; ttbufs.c_cflag = ttbuf.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) ttbufs.c_cc[i] = ttbuf.c_cc[i]; } } @@ -427,13 +430,12 @@ ttbuf.c_oflag = ttbufs.c_oflag; ttbuf.c_iflag = ttbufs.c_iflag; ttbuf.c_cflag = ttbufs.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) ttbuf.c_cc[i] = ttbufs.c_cc[i]; ret = (*Ioctl)(tty, TCSETAW, &ttbuf); } else ret = (*Ioctl)(tty, TCSETAWS &ttbufs); ASSERT(ret >= 0, "RETURN FROM sytfixline", "", ret); - return; } GLOBAL void @@ -443,13 +445,12 @@ struct termio ttbuf; int ret; - if ( (*Ioctl)(tty, TCGETA, &ttbuf) != 0 ) + if ((*Ioctl)(tty, TCGETA, &ttbuf) != 0) return; ttbuf.c_cflag &= ~CLOCAL; ttbuf.c_cflag |= CREAD|HUPCL; ret = (*Ioctl)(tty, TCSETAW, &ttbuf); ASSERT(ret >= 0, "RETURN FROM sytfix2line", "", ret); - return; } #endif /* SYTEK */ @@ -457,13 +458,13 @@ GLOBAL int restline() { - if ( Saved_line == TRUE ) { + if (Saved_line == TRUE) { if (Saved_termios < 0) - return((*Ioctl)(0, TCSETAW, &Savettyb)); + return ((*Ioctl)(0, TCSETAW, &Savettyb)); else - return((*Ioctl)(0, TCSETSW, &Savettybs)); + return ((*Ioctl)(0, TCSETSW, &Savettybs)); } - return(0); + return (0); } #else /* !ATTSVTTY */ @@ -517,16 +518,14 @@ (void) (*Ioctl)(tty, TIOCSETP, &ttbuf); (void) (*Ioctl)(tty, TIOCHPCL, STBNULL); (void) (*Ioctl)(tty, TIOCEXCL, STBNULL); - return; } GLOBAL void sethup(dcf) int dcf; { - if (isatty(dcf)) + if (isatty(dcf)) (void) (*Ioctl)(dcf, TIOCHPCL, STBNULL); - return; } /* @@ -545,7 +544,6 @@ (void) (*Ioctl)(fn, TIOCCBRK, 0); #endif } - return; } /* @@ -559,21 +557,21 @@ GLOBAL int savline() { - if ( (*Ioctl)(0, TIOCGETP, &Savettyb) != 0 ) + if ((*Ioctl)(0, TIOCGETP, &Savettyb) != 0) Saved_line = FALSE; else { Saved_line = TRUE; Savettyb.sg_flags |= ECHO; Savettyb.sg_flags &= ~RAW; } - return(0); + return (0); } GLOBAL int restline() { - if ( Saved_line == TRUE ) - return((*Ioctl)(0, TIOCSETP, &Savettyb)); - return(0); + if (Saved_line == TRUE) + return ((*Ioctl)(0, TIOCSETP, &Savettyb)); + return (0); } #endif
--- a/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c Sun Apr 12 10:48:30 2009 -0700 @@ -1,7 +1,7 @@ /* * System-dependent procedures for pppd under Solaris 2.x (SunOS 5.x). * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Permission to use, copy, modify, and distribute this software and its @@ -39,7 +39,6 @@ * OR MODIFICATIONS. */ -#pragma ident "%Z%%M% %I% %E% SMI" #define RCSID "$Id: sys-solaris.c,v 1.2 2000/04/21 01:27:57 masputra Exp $" #include <limits.h> @@ -1211,6 +1210,9 @@ #ifdef B460800 { 460800, B460800 }, #endif +#ifdef B921600 + { 921600, B921600 }, +#endif { 0, 0 } };
--- a/usr/src/cmd/cmd-inet/usr.bin/telnet/sys_bsd.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/cmd-inet/usr.bin/telnet/sys_bsd.c Sun Apr 12 10:48:30 2009 -0700 @@ -1,10 +1,8 @@ /* - * Copyright 1994-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Copyright (c) 1988, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -562,7 +560,8 @@ { 4800, B4800 }, { 9600, B9600 }, { 19200, B19200 }, { 38400, B38400 }, { 57600, B57600 }, { 76800, B76800 }, { 115200, B115200 }, { 153600, B153600 }, { 230400, B230400 }, - { 307200, B307200 }, { 460800, B460800 }, { -1, B0 } + { 307200, B307200 }, { 460800, B460800 }, { 921600, B921600 }, + { -1, B0 } }; void @@ -733,7 +732,7 @@ { TerminalNewMode(-1); (void) fprintf(stderr, "Error processing %s: %s\n", doing_what, - strerror(errno)); + strerror(errno)); exit(1); }
--- a/usr/src/cmd/devfsadm/port_link.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/devfsadm/port_link.c Sun Apr 12 10:48:30 2009 -0700 @@ -18,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -37,6 +38,7 @@ #include <sys/wait.h> #include <fcntl.h> #include <devfsadm.h> +#include <syslog.h> /* * sacadm output parsing @@ -273,8 +275,8 @@ } /* - * add the minor name to the physical path so we can - * enum the port# and create the the link. + * add the minor name to the physical path so we can + * enum the port# and create the link. */ (void) strcpy(p_path, devfspath); (void) strcat(p_path, ":"); @@ -293,6 +295,14 @@ (void) devfsadm_mklink(l_path, node, minor, 0); /* + * This is probably a USB serial port coming into the system + * because someone just plugged one in. Log an indication of + * this to syslog just in case someone wants to know what the + * name of the new serial device is .. + */ + (void) syslog(LOG_INFO, "serial device /dev/%s present", l_path); + + /* * update the portmon database if this port falls within * the valid range of ports. */
--- a/usr/src/cmd/login/login.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/login/login.c Sun Apr 12 10:48:30 2009 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1564,7 +1564,8 @@ static char *speeds[] = { "0", "50", "75", "110", "134", "150", "200", "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400", - "57600", "76800", "115200", "153600", "230400", "307200", "460800" + "57600", "76800", "115200", "153600", "230400", "307200", "460800", + "921600" }; #define NSPEEDS (sizeof (speeds) / sizeof (speeds[0]))
--- a/usr/src/cmd/lp/cmd/lpsched/ports.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/lp/cmd/lpsched/ports.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,12 +23,10 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "termio.h" #include "dial.h" #include "unistd.h" @@ -39,33 +36,33 @@ #include <sys/ioccom.h> #include <sys/ecppsys.h> -static void sigalrm ( int ); -static int push_module ( int , char * , char * ); +static void sigalrm(int); +static int push_module(int, char *, char *); static int SigAlrm; -/** - ** open_dialup() - OPEN A PORT TO A ``DIAL-UP'' PRINTER - **/ +/* + * open_dialup() - OPEN A PORT TO A ``DIAL-UP'' PRINTER + */ int -open_dialup ( char *ptype, PRINTER *pp) +open_dialup(char *ptype, PRINTER *pp) { static char *baud_table[] = { - 0, - "50", - "75", - "110", - "134", - "150", - "200", - "300", - "600", - "1200", - "1800", - "2400", - "4800", - "9600", + 0, + "50", + "75", + "110", + "134", + "150", + "200", + "300", + "600", + "1200", + "1800", + "2400", + "4800", + "9600", "19200", "38400", "57600", @@ -74,7 +71,8 @@ "153600", "230400", "307200", - "460800" + "460800", + "921600" }; struct termio tio; @@ -82,8 +80,7 @@ CALL call; - int speed, - fd; + int speed, fd; char *sspeed; @@ -105,8 +102,8 @@ * move it. */ if (fd != 1) { - dup2 (fd, 1); - Close (fd); + dup2(fd, 1); + Close(fd); } /* @@ -123,51 +120,46 @@ * to override us (although it would be probably be * silly for him or her to do so.) */ - if (ioctl (1, TCGETS, &tios) < 0) { - ioctl (1, TCGETA, &tio); + if (ioctl(1, TCGETS, &tios) < 0) { + ioctl(1, TCGETA, &tio); tios.c_cflag = tio.c_cflag; } if ((sspeed = baud_table[cfgetospeed(&tios)]) != NULL) { if (pp->stty == NULL) pp->stty = ""; + { - register char *new_stty = Malloc( - strlen(pp->stty) + 1 + strlen(sspeed) + 1 - ); + char *new_stty = Malloc( + strlen(pp->stty) + 1 + strlen(sspeed) + 1); - sprintf (new_stty, "%s %s", pp->stty, sspeed); + sprintf(new_stty, "%s %s", pp->stty, sspeed); - /* - * We can trash "pp->stty" because - * the parent process has the good copy. - */ - pp->stty = new_stty; + /* + * We can trash "pp->stty" because + * the parent process has the good copy. + */ + pp->stty = new_stty; } } return (0); } -/** - ** open_direct() - OPEN A PORT TO A DIRECTLY CONNECTED PRINTER - **/ +/* + * open_direct() - OPEN A PORT TO A DIRECTLY CONNECTED PRINTER + */ int open_direct(char *ptype, PRINTER *pp) { - short bufsz = -1, - cps = -1; - - int open_mode, - fd; - - register unsigned int oldalarm, - newalarm = 0; + short bufsz = -1, cps = -1; + int open_mode, fd; + register unsigned int oldalarm, newalarm = 0; char *device; struct ecpp_transfer_parms ecpp_params; /* for ECPP port checking */ - char **modules = NULL; + char **modules = NULL; struct flock lck; struct stat buf; @@ -181,8 +173,8 @@ * has a huge buffer that, in the worst case, would take * a long time to drain. */ - tidbit (ptype, "bufsz", &bufsz); - tidbit (ptype, "cps", &cps); + tidbit(ptype, "bufsz", &bufsz); + tidbit(ptype, "cps", &cps); if (bufsz > 0 && cps > 0) newalarm = (((long)bufsz * 1100) / cps) / 1000; if (newalarm < 60) @@ -227,8 +219,8 @@ return (EXEC_EXIT_TMOUT); } - alarm (oldalarm); - signal (SIGALRM, oldsig); + alarm(oldalarm); + signal(SIGALRM, oldsig); /* * Lock the file in case two "printers" are defined on the @@ -236,7 +228,7 @@ */ lck.l_type = F_WRLCK; - lck.l_whence = 0; + lck.l_whence = 0; lck.l_start = 0L; lck.l_len = 0L; @@ -250,8 +242,8 @@ * in case.... */ if (fd != 1) { - dup2 (fd, 1); - Close (fd); + dup2(fd, 1); + Close(fd); } /* @@ -292,7 +284,7 @@ * instructed not to. */ while (ioctl(1, I_POP, 0) == 0) - ; + ; /* * Now push either the administrator specified modules @@ -312,28 +304,27 @@ return (0); } -/** - ** sigalrm() - **/ +/* + * sigalrm() + */ static void sigalrm(int ignore) { - signal (SIGALRM, SIG_IGN); + signal(SIGALRM, SIG_IGN); SigAlrm = 1; - return; } -/** - ** push_module() - **/ +/* + * push_module() + */ static int push_module(int fd, char *device, char *module) { - int ret = ioctl(fd, I_PUSH, module); + int ret = ioctl(fd, I_PUSH, module); if (ret == -1) - note ("push (%s) on %s failed (%s)\n", module, device, PERROR); + note("push (%s) on %s failed (%s)\n", module, device, PERROR); return (ret); }
--- a/usr/src/cmd/lp/filter/postscript/postio/postio.h Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/lp/filter/postscript/postio/postio.h Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,70 +18,71 @@ * * CDDL HEADER END */ + /* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ +#ifndef _POSTIO_POSTIO_H +#define _POSTIO_POSTIO_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ /* * * Definitions used by the program that sends jobs to PostScript printers. * - * POSTBEGIN, if it's not NULL, is some PostScript code that's sent to the printer - * before any of the input files. It's not terribly important since the same thing - * can be accomplished in other ways, but this approach is convenient. POSTBEGIN - * is initialized so as to disable job timeouts. The string can also be set on the - * command line using the -P option. + * POSTBEGIN, if it's not NULL, is some PostScript code that's sent to the + * printer before any of the input files. It's not terribly important since + * the same thing can be accomplished in other ways, but this approach is + * convenient. POSTBEGIN is initialized so as to disable job timeouts. The + * string can also be set on the command line using the -P option. * */ -#define POSTBEGIN "%!PS\nstatusdict /waittimeout 0 put\n" +#define POSTBEGIN "%!PS\nstatusdict /waittimeout 0 put\n" /* - * - * The following help determine where postio is when it's running - either in the - * START, SEND, or DONE states. Primarily controls what's done in getstatus(). - * RADIAN occasionally had problems with two way conversations. Anyway this stuff - * can be used to prevent status queries while we're transmitting a job. Enabled - * by the -q option. + * The following help determine where postio is when it's running - either + * in the START, SEND, or DONE states. Primarily controls what's done in + * getstatus(). + * RADIAN occasionally had problems with two way conversations. Anyway this + * stuff can be used to prevent status queries while we're transmitting a + * job. Enabled by the -q option. * */ -#define NOTCONNECTED 0 -#define START 1 -#define SEND 2 -#define DONE 3 +#define NOTCONNECTED 0 +#define START 1 +#define SEND 2 +#define DONE 3 /* + * Previous versions of postio only ran as a single process. That was (and + * still * is) convenient, but meant we could only flow control one direction. + * Data coming back from the printer occasionally got lost, but that didn't + * often hurt (except for lost error messages). Anyway I've added code that + * lets you split the program into separate read and write processes, thereby + * helping to prevent data loss in both directions. It should be particularly + * useful when you're sending a job that you expect will be returning useful + * data over the communications line. * - * Previous versions of postio only ran as a single process. That was (and still - * is) convenient, but meant we could only flow control one direction. Data coming - * back from the printer occasionally got lost, but that didn't often hurt (except - * for lost error messages). Anyway I've added code that lets you split the program - * into separate read and write processes, thereby helping to prevent data loss in - * both directions. It should be particularly useful when you're sending a job that - * you expect will be returning useful data over the communications line. - * - * The next three definitions control what's done with data on communications line. - * The READ flag means the line can be read, while the WRITE flag means it can be - * written. When we're running as a single process both flags are set. I tried to - * overlay the separate read/write process code on what was there and working for - * one process. The implementation isn't as good as it could be, but should be - * safe. The single process version still works, and remains the default. - * + * The next three definitions control what's done with data on communications + * line. The READ flag means the line can be read, while the WRITE flag means + * it can be written. When we're running as a single process both flags are + * set. I tried to overlay the separate read/write process code on what was + * there and working for one process. The implementation isn't as good as it + * could be, but should be safe. The single process version still works, + * and remains the default. */ -#define READ 1 -#define WRITE 2 -#define READWRITE 3 +#define READ 1 +#define WRITE 2 +#define READWRITE 3 /* - * * Messages generated on the printer and returned over the communications line * look like, * @@ -105,35 +105,33 @@ * The following constants are used to classify the recognized printer states. * readline() reads complete lines from ttyi and stores them in array mesg[]. * getstatus() looks for the "%%[ " and " ]%%" delimiters that bracket printer - * messages and if found it tries to parse the enclosed message. After the lookup - * one of the following numbers is returned as an indication of the existence or - * content of the printer message. The return value is used in start(), send(), - * and done() to figure out what's happening and what can be done next. - * + * messages and if found it tries to parse the enclosed message. After the + * lookup one of the following numbers is returned as an indication of the + * existence or content of the printer message. The return value is used in + * start(), send(), and done() to figure out what's happening and what can + * be done next. */ -#define BUSY 0 /* processing data already sent */ -#define WAITING 1 /* printer wants more data */ -#define PRINTING 2 /* printing a page */ -#define IDLE 3 /* ready to start the next job */ -#define ENDOFJOB 4 /* readline() builds this up on EOF */ -#define PRINTERERROR 5 /* PrinterError - eg. out of paper */ -#define ERROR 6 /* some kind of PostScript error */ -#define FLUSHING 7 /* throwing out the rest of the job */ -#define INITIALIZING 8 /* printer is booting */ -#define DISCONNECT 9 /* from Datakit! */ -#define UNKNOWN 10 /* in case we missed anything */ -#define NOSTATUS 11 /* no response from the printer */ +#define BUSY 0 /* processing data already sent */ +#define WAITING 1 /* printer wants more data */ +#define PRINTING 2 /* printing a page */ +#define IDLE 3 /* ready to start the next job */ +#define ENDOFJOB 4 /* readline() builds this up on EOF */ +#define PRINTERERROR 5 /* PrinterError - eg. out of paper */ +#define ERROR 6 /* some kind of PostScript error */ +#define FLUSHING 7 /* throwing out the rest of the job */ +#define INITIALIZING 8 /* printer is booting */ +#define DISCONNECT 9 /* from Datakit! */ +#define UNKNOWN 10 /* in case we missed anything */ +#define NOSTATUS 11 /* no response from the printer */ -#define WRITEPROCESS 12 /* dummy states for write process */ -#define INTERACTIVE 13 /* and interactive mode */ +#define WRITEPROCESS 12 /* dummy states for write process */ +#define INTERACTIVE 13 /* and interactive mode */ /* - * * An array of type Status is used, in getstatus(), to figure out the printer's * current state. Just helps convert strings representing the current state into * integer codes that other routines use. - * */ typedef struct { @@ -144,17 +142,17 @@ } Status; /* - * - * STATUS is used to initialize an array of type Status that translates the ASCII - * strings returned by the printer into appropriate codes that can be used later - * on in the program. getstatus() converts characters to lower case, so if you - * add any entries make them lower case and put them in before the UNKNOWN entry. + * STATUS is used to initialize an array of type Status that translates the + * ASCII strings returned by the printer into appropriate codes that can be + * used later on in the program. getstatus() converts characters to lower + * case, so if you add any entries make them lower case and put them in + * before the UNKNOWN entry. * The lookup terminates when we get a match or when an entry with a NULL state * is found. * */ -#define STATUS \ +#define STATUS \ \ { \ "busy", BUSY, \ @@ -176,12 +174,12 @@ * */ -#define BAUDRATE B9600 +#define BAUDRATE B9600 /* * - * An array of type Baud is used, in routine getbaud(), to translate ASCII strings - * into termio values that represent the requested baud rate. + * An array of type Baud is used, in routine getbaud(), to translate ASCII + * strings into termio values that represent the requested baud rate. * */ @@ -200,7 +198,7 @@ * */ -#define BAUDTABLE \ +#define BAUDTABLE \ \ { \ "9600", B9600, \ @@ -233,17 +231,21 @@ "307.2", B307200, \ "460800", B460800, \ "460.8", B460800, \ + "921600", B921600, \ + "921.6", B921600, \ NULL, B9600 \ } /* * * A few miscellaneous definitions. BLOCKSIZE is the default size of the buffer - * used for reading the input files (changed with the -B option). MESGSIZE is the - * size of the character array used to store printer status lines - don't make it - * too small! + * used for reading the input files (changed with the -B option). MESGSIZE is + * the size of the character array used to store printer status lines - don't + * make it too small! * */ -#define BLOCKSIZE 2048 -#define MESGSIZE 512 +#define BLOCKSIZE 2048 +#define MESGSIZE 512 + +#endif /* _POSTIO_POSTIO_H */
--- a/usr/src/cmd/lp/model/lp.cat.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/lp/model/lp.cat.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <termio.h> @@ -44,9 +42,9 @@ #include <locale.h> -/** - ** Begin Sun Additions for Parallel ports - **/ +/* + * Begin Sun Additions for Parallel ports + */ #include <string.h> #include <stdarg.h> @@ -85,47 +83,48 @@ int is_a_prnio(int); int prnio_state(int); -#define PRINTER_ERROR_PAPER_OUT 1 -#define PRINTER_ERROR_OFFLINE 2 -#define PRINTER_ERROR_BUSY 3 -#define PRINTER_ERROR_ERROR 4 -#define PRINTER_ERROR_CABLE_POWER 5 -#define PRINTER_ERROR_UNKNOWN 6 -#define PRINTER_ERROR_TIMEOUT 7 +#define PRINTER_ERROR_PAPER_OUT 1 +#define PRINTER_ERROR_OFFLINE 2 +#define PRINTER_ERROR_BUSY 3 +#define PRINTER_ERROR_ERROR 4 +#define PRINTER_ERROR_CABLE_POWER 5 +#define PRINTER_ERROR_UNKNOWN 6 +#define PRINTER_ERROR_TIMEOUT 7 #define PRINTER_IO_ERROR 129 -/****************************************************************************/ - -/** +/* * for BPP PARALLEL interfaces - **/ + */ -int is_a_parallel_bpp(int fd) +int +is_a_parallel_bpp(int fd) { if (ioctl(fd, BPPIOC_TESTIO) == 0 || errno == EIO) - return(1); - return(0); + return (1); + return (0); } #if defined(DEBUG) && defined(NOTDEF) -char *BppState(int state) +char * +BppState(int state) { static char buf[BUFSIZ]; - memset(buf, 0, sizeof(buf)); - sprintf(buf, "State (0x%.4x) - (%s%s%s%s)\n", state, - ((state & BPP_SLCT_ERR) ? "offline " : ""), - ((state & BPP_BUSY_ERR) ? "busy " : ""), - ((state & BPP_PE_ERR) ? "paper " : ""), - ((state & BPP_ERR_ERR) ? "error " : "")); + memset(buf, 0, sizeof (buf)); + sprintf(buf, "State (0x%.4x) - (%s%s%s%s)\n", state, + ((state & BPP_SLCT_ERR) ? "offline " : ""), + ((state & BPP_BUSY_ERR) ? "busy " : ""), + ((state & BPP_PE_ERR) ? "paper " : ""), + ((state & BPP_ERR_ERR) ? "error " : "")); - return(buf); + return (buf); } #endif -int bpp_state(int fd) +int +bpp_state(int fd) { if (ioctl(fd, BPPIOC_TESTIO)) { struct bpp_error_status bpp_stat; @@ -135,38 +134,38 @@ exit(PRINTER_IO_ERROR); state = bpp_stat.pin_status; -#if defined(DEBUG) && defined(NOTDEF) +#if defined(DEBUG) && defined(NOTDEF) logit("%s", BppState(state)); #endif - + if (state == (BPP_PE_ERR | BPP_ERR_ERR | BPP_SLCT_ERR)) { /* paper is out */ - return(PRINTER_ERROR_PAPER_OUT); + return (PRINTER_ERROR_PAPER_OUT); } else if (state & BPP_BUSY_ERR) { /* printer is busy */ - return(PRINTER_ERROR_BUSY); + return (PRINTER_ERROR_BUSY); } else if (state & BPP_SLCT_ERR) { /* printer is offline */ - return(PRINTER_ERROR_OFFLINE); + return (PRINTER_ERROR_OFFLINE); } else if (state & BPP_ERR_ERR) { /* printer is errored */ - return(PRINTER_ERROR_ERROR); + return (PRINTER_ERROR_ERROR); } else if (state == BPP_PE_ERR) { /* printer is off/unplugged */ - return(PRINTER_ERROR_CABLE_POWER); + return (PRINTER_ERROR_CABLE_POWER); } else if (state) { - return(PRINTER_ERROR_UNKNOWN); + return (PRINTER_ERROR_UNKNOWN); } else - return(0); + return (0); } - return(0); + return (0); } /* * For ecpp parallel port */ -int +int get_ecpp_status(int fd) { int state; @@ -174,7 +173,7 @@ if (ioctl(fd, ECPPIOC_GETPARMS, &transfer_parms) == -1) { - return(-1); + return (-1); } state = transfer_parms.mode; @@ -186,20 +185,21 @@ if (state != ECPP_CENTRONICS) { transfer_parms.mode = ECPP_CENTRONICS; if (ioctl(fd, ECPPIOC_SETPARMS, &transfer_parms) == -1) { - return(-1); + return (-1); } else { state = ECPP_CENTRONICS; } } - + - return(state); + return (state); } -/** +/* * For prnio(7I) - generic printer interface - **/ -int is_a_prnio(int fd) + */ +int +is_a_prnio(int fd) { uint_t cap; @@ -218,46 +218,47 @@ return (1); } -int prnio_state(int fd) +int +prnio_state(int fd) { uint_t status; uchar_t pins; if ((ioctl(fd, PRNIOC_GET_STATUS, &status) == 0) && (status & PRN_READY)) { - return(0); + return (0); } if (ioctl(fd, PRNIOC_GET_1284_STATUS, &pins) != 0) { - return(PRINTER_ERROR_UNKNOWN); + return (PRINTER_ERROR_UNKNOWN); } if ((pins & ~PRN_1284_BUSY) == PRN_1284_PE) { /* paper is out */ - return(PRINTER_ERROR_PAPER_OUT); + return (PRINTER_ERROR_PAPER_OUT); } else if (pins == (PRN_1284_PE | PRN_1284_SELECT | - PRN_1284_NOFAULT | PRN_1284_BUSY)) { + PRN_1284_NOFAULT | PRN_1284_BUSY)) { /* printer is off/unplugged */ - return(PRINTER_ERROR_CABLE_POWER); + return (PRINTER_ERROR_CABLE_POWER); } else if ((pins & PRN_1284_SELECT) == 0) { /* printer is offline */ - return(PRINTER_ERROR_OFFLINE); + return (PRINTER_ERROR_OFFLINE); } else if ((pins & PRN_1284_NOFAULT) == 0) { /* printer is errored */ - return(PRINTER_ERROR_ERROR); + return (PRINTER_ERROR_ERROR); } else if (pins & PRN_1284_PE) { /* paper is out */ - return(PRINTER_ERROR_PAPER_OUT); + return (PRINTER_ERROR_PAPER_OUT); } else if (pins ^ (PRN_1284_SELECT | PRN_1284_NOFAULT)) { - return(PRINTER_ERROR_UNKNOWN); + return (PRINTER_ERROR_UNKNOWN); } - return(0); + return (0); } - -/** + +/* * Common routines - **/ + */ /*ARGSUSED0*/ static void @@ -280,10 +281,10 @@ vsprintf(mesg, fmt, ap); va_end(ap); /* - fprintf(stderr, - "%%%%[ PrinterError: %s; source: parallel ]%%%%\n", - mesg); -*/ + * fprintf(stderr, + * "%%%%[ PrinterError: %s; source: parallel ]%%%%\n", + * mesg); + */ fprintf(stderr, "%s\n", mesg); fflush(stderr); fsync(2); @@ -294,32 +295,32 @@ printer_error(int error) { switch (error) { - case -1: - printer_info("ioctl(): %s", strerror(errno)); - break; - case PRINTER_ERROR_PAPER_OUT: - printer_info("out of paper"); - break; - case PRINTER_ERROR_OFFLINE: - printer_info("offline"); - break; - case PRINTER_ERROR_BUSY: - printer_info("busy"); - break; - case PRINTER_ERROR_ERROR: - printer_info("printer error"); - break; - case PRINTER_ERROR_CABLE_POWER: - printer_info("printer powered off or disconnected"); - break; - case PRINTER_ERROR_UNKNOWN: - printer_info("unknown error"); - break; - case PRINTER_ERROR_TIMEOUT: - printer_info("communications timeout"); - break; - default: - printer_info("get_status() failed"); + case -1: + printer_info("ioctl(): %s", strerror(errno)); + break; + case PRINTER_ERROR_PAPER_OUT: + printer_info("out of paper"); + break; + case PRINTER_ERROR_OFFLINE: + printer_info("offline"); + break; + case PRINTER_ERROR_BUSY: + printer_info("busy"); + break; + case PRINTER_ERROR_ERROR: + printer_info("printer error"); + break; + case PRINTER_ERROR_CABLE_POWER: + printer_info("printer powered off or disconnected"); + break; + case PRINTER_ERROR_UNKNOWN: + printer_info("unknown error"); + break; + case PRINTER_ERROR_TIMEOUT: + printer_info("communications timeout"); + break; + default: + printer_info("get_status() failed"); } } @@ -331,7 +332,7 @@ int was_faulted = 0; while (state = get_state(fd)) { - was_faulted=1; + was_faulted = 1; printer_error(state); sleep(15); } @@ -343,26 +344,26 @@ } } -/** - ** end of Sun Additions for parallel port - **/ -#define IDENTICAL(A,B) (A.st_dev==B.st_dev && A.st_ino==B.st_ino) -#define ISBLK(A) ((A.st_mode & S_IFMT) == S_IFBLK) -#define ISCHR(A) ((A.st_mode & S_IFMT) == S_IFCHR) +/* + * end of Sun Additions for parallel port + */ +#define IDENTICAL(A, B) (A.st_dev == B.st_dev && A.st_ino == B.st_ino) +#define ISBLK(A) ((A.st_mode & S_IFMT) == S_IFBLK) +#define ISCHR(A) ((A.st_mode & S_IFMT) == S_IFCHR) -#define E_SUCCESS 0 -#define E_BAD_INPUT 1 -#define E_BAD_OUTPUT 2 -#define E_BAD_TERM 3 -#define E_IDENTICAL 4 +#define E_SUCCESS 0 +#define E_BAD_INPUT 1 +#define E_BAD_OUTPUT 2 +#define E_BAD_TERM 3 +#define E_IDENTICAL 4 #define E_WRITE_FAILED 5 #define E_TIMEOUT 6 -#define E_HANGUP 7 -#define E_INTERRUPT 8 +#define E_HANGUP 7 +#define E_INTERRUPT 8 -#define SAFETY_FACTOR 2.0 -#define R(F) (int)((F) + .5) -#define DELAY(N,D) R(SAFETY_FACTOR * ((N) / (double)(D))) +#define SAFETY_FACTOR 2.0 +#define R(F) (int)((F) + .5) +#define DELAY(N, D) R(SAFETY_FACTOR * ((N) / (double)(D))) char buffer[BUFSIZ]; @@ -374,44 +375,36 @@ sigterm(); #if defined(baudrate) -# undef baudrate +#undef baudrate #endif -int baudrate(); +int baudrate(); -int nop(int fd) { return (0); } +int +nop(int fd) +{ + return (0); +} + int bpp_state(int); -/** - ** main() - **/ +/* + * main() + */ int main(int argc, char *argv[]) { - int nin, - nout, - effective_rate, - max_delay = 0, - n; - - int report_rate; - - short print_rate; - - struct stat in, - out; - - struct tms tms; - - long epoch_start, - epoch_end; - - char *TERM; - - int (*func)(int fd); + int nin, nout, effective_rate, max_delay = 0, n; + int report_rate; + short print_rate; + struct stat in, out; + struct tms tms; + long epoch_start, epoch_end; + char *TERM; + int (*func)(int fd); /* * The Spooler can hit us with SIGTERM for three reasons: @@ -442,11 +435,11 @@ * - Input/output identical * - No TERM defined or trouble reading Terminfo database */ - signal (SIGTERM, sigterm); - signal (SIGHUP, sighup); - signal (SIGINT, sigint); - signal (SIGQUIT, sigint); - signal (SIGPIPE, sigpipe); + signal(SIGTERM, sigterm); + signal(SIGHUP, sighup); + signal(SIGINT, sigint); + signal(SIGQUIT, sigint); + signal(SIGPIPE, sigpipe); if (argc > 1 && STREQU(argv[1], "-r")) { @@ -458,7 +451,7 @@ (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) -#define TEXT_DOMAIN "SYS_TEST" +#define TEXT_DOMAIN "SYS_TEST" #endif (void) textdomain(TEXT_DOMAIN); @@ -466,26 +459,20 @@ * Stat the standard output to be sure it is defined. */ if (fstat(1, &out) < 0) { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, - gettext("Can't stat output (%s);\nincorrect use of lp.cat!\n"), - PERROR - ); - exit (E_BAD_OUTPUT); + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("Can't stat output " + "(%s);\nincorrect use of lp.cat!\n"), PERROR); + exit(E_BAD_OUTPUT); } /* * Stat the standard input to be sure it is defined. */ if (fstat(0, &in) < 0) { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, - gettext("Can't stat input (%s);\nincorrect use of lp.cat!\n"), - PERROR - ); - exit (E_BAD_INPUT); + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("Can't stat input " + "(%s);\nincorrect use of lp.cat!\n"), PERROR); + exit(E_BAD_INPUT); } /* @@ -500,22 +487,20 @@ if (is_a_prnio(1)) { func = prnio_state; } else if (is_a_parallel_bpp(1) || - (get_ecpp_status(1) == ECPP_CENTRONICS)) { + (get_ecpp_status(1) == ECPP_CENTRONICS)) { func = bpp_state; - } else if (isatty(1)) { + } else if (isatty(1)) { /* serial connection (probably) - continue as usual */ func = nop; - } else { + } else { func = nop; - } + } if (!ISCHR(out) && !ISBLK(out) && IDENTICAL(out, in)) { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, - gettext("Input and output are identical; incorrect use of lp.cat!\n") - ); - exit (E_IDENTICAL); + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("Input and output are identical; " + "incorrect use of lp.cat!\n")); + exit(E_IDENTICAL); } /* @@ -531,28 +516,18 @@ * than err too often on false alarms. */ - if ( - !(TERM = getenv("TERM")) - || !*TERM - ) { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, - gettext("No TERM variable defined! Trouble with the Spooler!\n") - ); - exit (E_BAD_TERM); + if (!(TERM = getenv("TERM")) || !*TERM) { + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("No TERM variable defined! " + "Trouble with the Spooler!\n")); + exit(E_BAD_TERM); } - if ( - !STREQU(TERM, NAME_UNKNOWN) - && tidbit(TERM, "cps", &print_rate) == -1 - ) { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, -gettext("Trouble identifying printer type \"%s\"; check the Terminfo database.\n"), - TERM - ); - exit (E_BAD_TERM); + if (!STREQU(TERM, NAME_UNKNOWN) && + tidbit(TERM, "cps", &print_rate) == -1) { + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("Trouble identifying printer " + "type \"%s\"; check the Terminfo database.\n"), TERM); + exit(E_BAD_TERM); } if (STREQU(TERM, NAME_UNKNOWN)) print_rate = -1; @@ -570,7 +545,7 @@ * waiting too long to write to a printer in trouble. */ if (max_delay) - signal (SIGALRM, sigalrm); + signal(SIGALRM, sigalrm); /* * While not end of standard input, copy blocks to @@ -597,15 +572,13 @@ wait_state(1, func); if (max_delay) - alarm (max_delay); + alarm(max_delay); nout = write(1, ptr, nin); alarm(0); if (nout < 0) { - fprintf ( - stderr, - gettext("Write failed (%s);\nperhaps the printer has gone off-line.\n"), - PERROR - ); + fprintf(stderr, gettext("Write failed " + "(%s);\nperhaps the printer has gone " + "off-line.\n"), PERROR); fflush(stderr); if (errno != EINTR) /* I/O error on device, get lpcshed to retry */ @@ -619,15 +592,13 @@ } while (nin > 0); if (max_delay) - alarm (0); + alarm(0); else if (report_rate) { epoch_end = times(&tms); if (epoch_end - epoch_start > 0) - fprintf ( - stderr, - "%d CPS\n", - R((100 * BUFSIZ) / (double)(epoch_end - epoch_start)) - ); + fprintf(stderr, "%d CPS\n", + R((100 * BUFSIZ) / + (double)(epoch_end - epoch_start))); } } @@ -635,83 +606,82 @@ return (E_SUCCESS); } -/** - ** sighup() - CATCH A HANGUP (LOSS OF CARRIER) - **/ - -void sighup () +/* + * sighup() - CATCH A HANGUP (LOSS OF CARRIER) + */ +void +sighup() { - signal (SIGTERM, SIG_IGN); - signal (SIGHUP, SIG_IGN); - fprintf (stderr, gettext(HANGUP_FAULT_LPCAT)); - exit (E_HANGUP); + signal(SIGTERM, SIG_IGN); + signal(SIGHUP, SIG_IGN); + fprintf(stderr, gettext(HANGUP_FAULT_LPCAT)); + exit(E_HANGUP); } -/** - ** sigint() - CATCH AN INTERRUPT - **/ - -void sigint () +/* + * sigint() - CATCH AN INTERRUPT + */ +void +sigint() { - signal (SIGTERM, SIG_IGN); - signal (SIGINT, SIG_IGN); - fprintf (stderr, gettext(INTERRUPT_FAULT)); - exit (E_INTERRUPT); + signal(SIGTERM, SIG_IGN); + signal(SIGINT, SIG_IGN); + fprintf(stderr, gettext(INTERRUPT_FAULT)); + exit(E_INTERRUPT); } -/** - ** sigpipe() - CATCH EARLY CLOSE OF PIPE - **/ - -void sigpipe () +/* + * sigpipe() - CATCH EARLY CLOSE OF PIPE + */ +void +sigpipe() { - signal (SIGTERM, SIG_IGN); - signal (SIGPIPE, SIG_IGN); - fprintf (stderr, gettext(PIPE_FAULT)); - exit (E_INTERRUPT); + signal(SIGTERM, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + fprintf(stderr, gettext(PIPE_FAULT)); + exit(E_INTERRUPT); } -/** - ** sigalrm() - CATCH AN ALARM - **/ - -void sigalrm () +/* + * sigalrm() - CATCH AN ALARM + */ +void +sigalrm() { - signal (SIGTERM, SIG_IGN); - fprintf ( - stderr, - gettext("Excessive write delay; perhaps the printer has gone off-line.\n") - ); - exit (E_TIMEOUT); + signal(SIGTERM, SIG_IGN); + fprintf(stderr, gettext("Excessive write delay; " + "perhaps the printer has gone off-line.\n")); + exit(E_TIMEOUT); } -/** - ** sigterm() - CATCH A TERMINATION SIGNAL - **/ - -void sigterm () +/* + * sigterm() - CATCH A TERMINATION SIGNAL + */ +void +sigterm() { - signal (SIGTERM, SIG_IGN); + signal(SIGTERM, SIG_IGN); /* * try to flush the output queue in the case of ecpp port. * ignore the return code as this may not be the ecpp. */ ioctl(1, I_FLUSH, FLUSHW); - exit (E_SUCCESS); + exit(E_SUCCESS); } -/** - ** baudrate() - RETURN BAUD RATE OF OUTPUT LINE - **/ +/* + * baudrate() - RETURN BAUD RATE OF OUTPUT LINE + */ static int baud_convert[] = { 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, - 76800, 115200, 153600, 230400, 307200, 460800 + 76800, 115200, 153600, 230400, 307200, 460800, 921600 }; -int baudrate () +int +baudrate() { struct termio tm; struct termios tms;
--- a/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c Sun Apr 12 10:48:30 2009 -0700 @@ -18,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/termios.h> #include <sys/promif.h> @@ -431,7 +430,7 @@ static const uint_t baudmap[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, - 76800, 115200, 153600, 230400, 307200, 460800 + 76800, 115200, 153600, 230400, 307200, 460800, 921600 }; static const uint_t bitsmap[] = { CS6, CS6, CS7, CS8 }; char *m = strdup(mode);
--- a/usr/src/cmd/mdb/common/mdb/mdb_termio.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/mdb/common/mdb/mdb_termio.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Terminal I/O Backend * @@ -683,7 +681,7 @@ static const uint_t baud[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, - 76800, 115200, 153600, 230400, 307200, 460800 + 76800, 115200, 153600, 230400, 307200, 460800, 921600 }; struct termios *ntios;
--- a/usr/src/cmd/netadm/iu.ap.sh Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/netadm/iu.ap.sh Sun Apr 12 10:48:30 2009 -0700 @@ -20,7 +20,7 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T @@ -41,6 +41,7 @@ usbser_edge -1 0 ldterm ttcompat usbsprl -1 0 ldterm ttcompat usbsksp -1 0 ldterm ttcompat + usbftdi -1 0 ldterm ttcompat ipsecesp -1 0 ipsecesp ipsecah -1 0 ipsecah " > iu.ap @@ -70,6 +71,7 @@ usbsacm -1 0 ldterm ttcompat usbsprl -1 0 ldterm ttcompat usbsksp -1 0 ldterm ttcompat + usbftdi -1 0 ldterm ttcompat ttymux -1 0 ldterm ttcompat ipsecesp -1 0 ipsecesp ipsecah -1 0 ipsecah
--- a/usr/src/cmd/ssh/libssh/common/ttymodes.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/ssh/libssh/common/ttymodes.c Sun Apr 12 10:48:30 2009 -0700 @@ -34,8 +34,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,8 +50,6 @@ #include "includes.h" RCSID("$OpenBSD: ttymodes.c,v 1.18 2002/06/19 00:27:55 deraadt Exp $"); -#pragma ident "%Z%%M% %I% %E% SMI" - #include "packet.h" #include "log.h" #include "ssh1.h" @@ -152,6 +151,14 @@ case B230400: return 230400; #endif /* B230400 */ +#ifdef B460800 + case B460800: + return 460800; +#endif /* B460800 */ +#ifdef B921600 + case B921600: + return 921600; +#endif /* B921600 */ default: return 9600; } @@ -241,6 +248,14 @@ case 230400: return B230400; #endif /* B230400 */ +#ifdef B460800 + case 460800: + return B460800; +#endif /* B460800 */ +#ifdef B921600 + case 921600: + return B921600; +#endif /* B921600 */ default: return B9600; }
--- a/usr/src/cmd/tip/tip.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/tip/tip.c Sun Apr 12 10:48:30 2009 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -9,8 +9,6 @@ * specifies the terms and conditions for redistribution. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * tip - UNIX link to other systems * tip [-v] [-speed] system-name @@ -27,7 +25,8 @@ int bauds[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, - 57600, 76800, 115200, 153600, 230400, 307200, 460800, -1 + 57600, 76800, 115200, 153600, 230400, 307200, + 460800, 921600, -1 }; extern void tipout(void) __NORETURN;
--- a/usr/src/cmd/tput/tput.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/tput/tput.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,18 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - /* * tput - print terminal attribute * @@ -113,18 +109,18 @@ usage: /* FALLTHROUGH */ default: (void) fprintf(stderr, gettext( - "usage:\t%s [-T [term]] capname [parm argument...]\n"), - progname); + "usage:\t%s [-T [term]] capname " + "[parm argument...]\n"), progname); (void) fprintf(stderr, gettext("OR:\t%s -S <<\n"), - progname); + progname); exit(2); } } if (!term || !*term) { (void) fprintf(stderr, - gettext("%s: No value for $TERM and no -T specified\n"), - progname); + gettext("%s: No value for $TERM and no -T specified\n"), + progname); exit(2); } @@ -133,22 +129,22 @@ switch (setuperr) { case -2: (void) fprintf(stderr, - gettext("%s: unreadable terminal descriptor \"%s\"\n"), - progname, term); + gettext("%s: unreadable terminal descriptor \"%s\"\n"), + progname, term); exit(3); break; case -1: (void) fprintf(stderr, - gettext("%s: no terminfo database\n"), progname); + gettext("%s: no terminfo database\n"), progname); exit(3); break; case 0: - (void) fprintf(stderr, - gettext("%s: unknown terminal \"%s\"\n"), - progname, term); - exit(3); + (void) fprintf(stderr, + gettext("%s: unknown terminal \"%s\"\n"), + progname, term); + exit(3); } reset_shell_mode(); @@ -237,8 +233,8 @@ if (parmset) putp(tparm(thisstr, - parm[0], parm[1], parm[2], parm[3], parm[4], parm[5], - parm[6], parm[7], parm[8])); + parm[0], parm[1], parm[2], parm[3], + parm[4], parm[5], parm[6], parm[7], parm[8])); else putp(thisstr); return (0); @@ -316,6 +312,7 @@ 230400, /* B230400, */ 307200, /* B307200, */ 460800, /* B460800, */ + 921600, /* B921600, */ 0, }; @@ -453,7 +450,7 @@ while (isdigit (*cap)) cap++; while (*cap == '.' || *cap == '/' || *cap == '*' || - isdigit(*cap)) + isdigit(*cap)) cap++; while (*cap == '>') cap++; @@ -630,24 +627,34 @@ if (xon_xoff) { #ifdef SYSV OFLAG(termmodes) &= - ~(NLbits | CRbits | BSbits | FFbits | TBbits); + ~(NLbits | CRbits | BSbits | FFbits | TBbits); #else /* SYSV */ OFLAG(termmode) &= - ~(NLbits | CRbits | BSbits | FFbits | TBbits); + ~(NLbits | CRbits | BSbits | FFbits | TBbits); #endif /* SYSV */ } else { #ifdef SYSV - setdelay(getpad(carriage_return), CRdelay, CRbits, &OFLAG(termmodes)); - setdelay(getpad(scroll_forward), NLdelay, NLbits, &OFLAG(termmodes)); - setdelay(getpad(cursor_left), BSdelay, BSbits, &OFLAG(termmodes)); - setdelay(getpad(form_feed), FFdelay, FFbits, &OFLAG(termmodes)); - setdelay(getpad(tab), TBdelay, TBbits, &OFLAG(termmodes)); + setdelay(getpad(carriage_return), + CRdelay, CRbits, &OFLAG(termmodes)); + setdelay(getpad(scroll_forward), + NLdelay, NLbits, &OFLAG(termmodes)); + setdelay(getpad(cursor_left), + BSdelay, BSbits, &OFLAG(termmodes)); + setdelay(getpad(form_feed), + FFdelay, FFbits, &OFLAG(termmodes)); + setdelay(getpad(tab), + TBdelay, TBbits, &OFLAG(termmodes)); #else /* SYSV */ - setdelay(getpad(carriage_return), CRdelay, CRbits, &OFLAG(termmode)); - setdelay(getpad(scroll_forward), NLdelay, NLbits, &OFLAG(termmode)); - setdelay(getpad(cursor_left), BSdelay, BSbits, &OFLAG(termmode)); - setdelay(getpad(form_feed), FFdelay, FFbits, &OFLAG(termmode)); - setdelay(getpad(tab), TBdelay, TBbits, &OFLAG(termmode)); + setdelay(getpad(carriage_return), + CRdelay, CRbits, &OFLAG(termmode)); + setdelay(getpad(scroll_forward), + NLdelay, NLbits, &OFLAG(termmode)); + setdelay(getpad(cursor_left), + BSdelay, BSbits, &OFLAG(termmode)); + setdelay(getpad(form_feed), + FFdelay, FFbits, &OFLAG(termmode)); + setdelay(getpad(tab), + TBdelay, TBbits, &OFLAG(termmode)); #endif /* SYSV */ }
--- a/usr/src/cmd/truss/codes.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/truss/codes.c Sun Apr 12 10:48:30 2009 -0700 @@ -373,6 +373,7 @@ { (uint_t)TIOCSTART, "TIOCSTART", NULL }, { (uint_t)TIOCSTOP, "TIOCSTOP", NULL }, { (uint_t)TIOCNOTTY, "TIOCNOTTY", NULL }, + { (uint_t)TIOCSCTTY, "TIOCSCTTY", NULL }, { (uint_t)TIOCOUTQ, "TIOCOUTQ", NULL }, { (uint_t)TIOCGLTC, "TIOCGLTC", NULL }, { (uint_t)TIOCSLTC, "TIOCSLTC", NULL }, @@ -385,6 +386,16 @@ { (uint_t)TIOCLBIC, "TIOCLBIC", NULL }, { (uint_t)TIOCLBIS, "TIOCLBIS", NULL }, + { (uint_t)TIOCSILOOP, "TIOCSILOOP", NULL }, + { (uint_t)TIOCCILOOP, "TIOCSILOOP", NULL }, + + { (uint_t)TIOCSETLD, "TIOCSETLD", NULL }, + { (uint_t)TIOCGETLD, "TIOCGETLD", NULL }, + + { (uint_t)TIOCGPPS, "TIOCGPPS", NULL }, + { (uint_t)TIOCSPPS, "TIOCSPPS", NULL }, + { (uint_t)TIOCGPPSEV, "TIOCGPPSEV", NULL }, + { (uint_t)TIOCPKT, "TIOCPKT", NULL }, /* ptyvar.h */ { (uint_t)TIOCUCNTL, "TIOCUCNTL", NULL }, { (uint_t)TIOCTCNTL, "TIOCTCNTL", NULL },
--- a/usr/src/cmd/ttymon/sttytable.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/cmd/ttymon/sttytable.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,8 +30,6 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <sys/types.h> #include <termio.h> @@ -73,6 +71,8 @@ "307.2", B307200, 307200, "460800", B460800, 460800, "460.8", B460800, 460800, + "921600", B921600, 921600, + "921.6", B921600, 921600, 0, };
--- a/usr/src/lib/libcurses/screen/delay.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/lib/libcurses/screen/delay.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,8 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /*LINTLIBRARY*/ #include <sys/types.h> @@ -55,10 +53,10 @@ 0, 2000, 1333, 909, 743, 666, 500, 333, /* 600 1200 1800 2400 4800 9600 19200 38400 baud */ 166, 83, 55, 41, 20, 10, 5, 2, - /* 57600, 76800, 115200, 153600, 230400 307200 baud */ + /* 57600, 76800, 115200, 153600, 230400, 307200 baud */ 2, 1, 1, 1, 1, 1, - /* 460800 baud */ - 1 + /* 460800, 921600 baud */ + 1, 1 }; /*
--- a/usr/src/lib/libcurses/screen/newscreen.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/lib/libcurses/screen/newscreen.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,8 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /*LINTLIBRARY*/ #include <stdio.h> @@ -55,7 +53,7 @@ static long baud_convert[] = { 1200, 50, 75, 110, 135, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 76800, - 115200, 153600, 230400, 307200, 460800 + 115200, 153600, 230400, 307200, 460800, 921600 }; static char isfilter = 0;
--- a/usr/src/lib/libnsl/dial/line.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/lib/libnsl/dial/line.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,15 +20,13 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This is a new line.c, which consists of line.c and culine.c * merged together. @@ -71,6 +68,7 @@ {230400, B230400}, {307200, B307200}, {460800, B460800}, + {921600, B921600}, {0, 0} }; @@ -207,10 +205,10 @@ for (i = 0; i < NCC; i++) ttbuf.c_cc[i] = ttbufs.c_cc[i]; ASSERT((*Ioctl)(tty, TCSETAW, &ttbuf) >= 0, - "RETURN FROM fixline ioctl", "", errno); + "RETURN FROM fixline ioctl", "", errno); } else { ASSERT((*Ioctl)(tty, TCSETSW, &ttbufs) >= 0, - "RETURN FROM fixline ioctl", "", errno); + "RETURN FROM fixline ioctl", "", errno); } }
--- a/usr/src/pkgdefs/Makefile Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/pkgdefs/Makefile Sun Apr 12 10:48:30 2009 -0700 @@ -495,6 +495,7 @@ SUNWudf \ SUNWudfr \ SUNWuedg \ + SUNWuftdi \ SUNWugen \ SUNWugenu \ SUNWuksp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/Makefile Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +include ../Makefile.com + +.KEEP_STATE: + +all: $(FILES) depend postinstall preremove +install: all pkg + +include ../Makefile.targ
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/depend Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,51 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# This package information file defines software dependencies associated +# with the pkg. You can define three types of pkg dependencies with this file: +# P indicates a prerequisite for installation +# I indicates an incompatible package +# R indicates a reverse dependency +# <pkg.abbr> see pkginfo(4), PKG parameter +# <name> see pkginfo(4), NAME parameter +# <version> see pkginfo(4), VERSION parameter +# <arch> see pkginfo(4), ARCH parameter +# <type> <pkg.abbr> <name> +# (<arch>)<version> +# (<arch>)<version> +# ... +# <type> <pkg.abbr> <name> +# ... +# + +P SUNWcar Core Architecture, (Root) +P SUNWcakr Core Solaris Kernel Architecture (Root) +P SUNWkvm Core Architecture, (Kvm) +P SUNWcsr Core Solaris, (Root) +P SUNWckr Core Solaris Kernel (Root) +P SUNWcnetr Core Solaris Network Infrastructure (Root) +P SUNWcsu Core Solaris, (Usr) +P SUNWcsd Core Solaris Devices +P SUNWcsl Core Solaris Libraries +P SUNWusb USB Device Drivers +P SUNWusbs USB generic serial module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/i.preserve Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,33 @@ +#!/bin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +while read src dest +do + if [ ! -f $dest ] ; then + cp $src $dest + fi +done +exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/pkginfo.tmpl Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,50 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This required package information file describes characteristics of the +# package, such as package abbreviation, full package name, package version, +# and package architecture. +# +PKG="SUNWuftdi" +NAME="FT232R USB UART" +ARCH="ISA" +CATEGORY="system" +BASEDIR=/ +SUNW_PKGTYPE="usr" +CLASSES="none preserve" +DESC="FTDI FT232R USB serial driver" +SUNW_PRODNAME="SunOS" +SUNW_PRODVERS="RELEASE/VERSION" +VERSION="ONVERS,REV=0.0.0" +VENDOR="Sun Microsystems, Inc." +HOTLINE="Please contact your local service provider" +EMAIL="" +MAXINST="1000" +SUNW_PKGVERS="1.0" +SUNW_PKG_ALLZONES="true" +SUNW_PKG_HOLLOW="true" +SUNW_PKG_THISZONE="false"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/postinstall Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,94 @@ +#!/bin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +PATH="/usr/bin:/usr/sbin:${PATH}" +export PATH + +if [ "${BASEDIR:=/}" != "/" ] +then + BASEDIR_OPT="-b $BASEDIR" +fi + +installed() { + driver=$1 + grep "^${driver} " $BASEDIR/etc/name_to_major > /dev/null 2>&1 + + return $? +} + +update_driver() { + driver=$1 + aliases=$2 + for alias in ${aliases} + do + egrep "^${driver}[ ]+${alias}" ${BASEDIR}/etc/driver_aliases > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "${driver} ${alias}" >> ${BASEDIR}/etc/driver_aliases + fi + done +} + +EXIT=0 + +# "usb403,6001" FTDI serial device, the rest are clones.. + +USBFTDI_ALIASES="\ + \"usb403,6001\" \ + \"usb403,fc82\" \ + \"usb403,fc08\" \ + \"usb403,fc09\" \ + \"usb403,fc0b\" \ + \"usb403,fc0c\" \ + \"usb403,fc0d\" \ + \"usb403,fa00\" \ + \"usb403,fa01\" \ + \"usb403,fa02\" \ + \"usb403,fa03\" \ + \"usb403,fa04\" \ + \"usb403,cc48\" \ + \"usb403,cc49\" \ + \"usb403,cc4a\" \ + \"usb403,e888\" \ + \"usb403,e889\" \ + \"usb403,e88c\" \ + \"usb403,e88b\" \ + \"usb403,e88c\" \ + \"usb7cc,0421\" \ + \"usb93c,0601\" \ + \"usb93c,0701\" \ + \"usb856,ac01\" \ + \"usb411,00b3\" \ + " + +if installed usbftdi ; then + update_driver usbftdi "${USBFTDI_ALIASES}" || EXIT=1 +else + add_drv ${BASEDIR_OPT} -m '* 0666 root sys' \ + -i "${USBFTDI_ALIASES}" -n usbftdi || EXIT=1 +fi + +exit $EXIT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/preremove Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,37 @@ +#! /bin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +PATH="/usr/bin:/usr/sbin:${PATH}" +export PATH + +EXIT=0 + +if grep -w usbftdi ${BASEDIR}/etc/name_to_major > /dev/null 2>&1 +then + rem_drv -b ${BASEDIR} usbftdi || EXIT=1 +fi + +exit $EXIT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/prototype_com Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,48 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# +# SUNWuftdi +# +i copyright +i depend +i pkginfo +i postinstall +i preremove +i i.preserve +d none usr 0755 root sys +d none usr/kernel 0755 root sys +d none usr/kernel/drv 0755 root sys +e preserve usr/kernel/drv/usbftdi.conf 0644 root sys
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/prototype_i386 Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,51 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# +# Include ISA independent files (prototype_com) +# +!include prototype_com +# +# +# List files which are i386 specific here +# +# source locations relative to the prototype file +# +# +# SUNWuftdi +# +f none usr/kernel/drv/usbftdi 0755 root sys +d none usr/kernel/drv/amd64 0755 root sys +f none usr/kernel/drv/amd64/usbftdi 0755 root sys
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWuftdi/prototype_sparc Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,49 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# +# Include ISA independent files (prototype_com) +# +!include prototype_com +# +# +# List files which are SPARC specific here +# +# source locations relative to the prototype file +# +# +# SUNWuftdi +d none usr/kernel/drv/sparcv9 0755 root sys +f none usr/kernel/drv/sparcv9/usbftdi 0755 root sys
--- a/usr/src/pkgdefs/SUNWusbu/prototype_com Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/pkgdefs/SUNWusbu/prototype_com Sun Apr 12 10:48:30 2009 -0700 @@ -20,12 +20,10 @@ # # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" - # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package @@ -62,6 +60,7 @@ d none usr/include/sys/usb/clients/video/usbvc 755 root bin f none usr/include/sys/usb/usbai.h 644 root bin f none usr/include/sys/usb/usba.h 644 root bin +f none usr/include/sys/usb/usbdevs.h 644 root bin f none usr/include/sys/usb/hubd/hub.h 644 root bin f none usr/include/sys/usb/clients/audio/usb_audio.h 644 root bin f none usr/include/sys/usb/clients/hid/hid.h 644 root bin
--- a/usr/src/pkgdefs/common_files/i.iuap Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/pkgdefs/common_files/i.iuap Sun Apr 12 10:48:30 2009 -0700 @@ -20,9 +20,7 @@ # CDDL HEADER END # # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -74,6 +72,7 @@ add_driver usbsacm add_driver usbsprl add_driver usbsksp + add_driver usbftdi remove_driver rts add_driver ipsecah add_driver ipsecesp
--- a/usr/src/ucbcmd/stty/stty.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/ucbcmd/stty/stty.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - - #include <stdio.h> #include <ctype.h> #include <sys/types.h> @@ -42,8 +39,8 @@ extern void exit(); extern void perror(); -static char *STTY="stty: "; -static char *USAGE="usage: stty [-agh] [modes]\n"; +static char *STTY = "stty: "; +static char *USAGE = "usage: stty [-agh] [modes]\n"; static int pitt = 0; static struct termios cb; static struct termio ocb; /* for non-streams devices */ @@ -61,17 +58,17 @@ void prspeed(char *, int); void prencode(void); -#define ioctl_desc 1 -#define output stderr +#define ioctl_desc 1 +#define output stderr int main(int argc, char *argv[]) { int i; - char *s_arg, *sttyparse(); /* s_arg: ptr to mode to be set */ + char *s_arg, *sttyparse(); /* s_arg: ptr to mode to be set */ extern const struct speeds speeds[]; - + if (argc == 2) { /* * "stty size", "stty speed" and "stty -g" are intended for @@ -90,42 +87,45 @@ perror("stty: TIOCGWINSZ"); exit(2); } - (void) printf("%d %d\n",winsize.ws_row,winsize.ws_col); + (void) printf("%d %d\n", + winsize.ws_row, winsize.ws_col); exit(0); - } - else if (strcmp(argv[1], "speed") == 0) { + } else if (strcmp(argv[1], "speed") == 0) { if ((i = open("/dev/tty", 0)) < 0) { perror("stty: Cannot open /dev/tty"); exit(2); } - if((term = get_ttymode(i, &ocb, &cb, &stio, &termiox, - &winsize)) < 0) { + if ((term = get_ttymode(i, + &ocb, &cb, &stio, &termiox, &winsize)) < 0) { perror(STTY); exit(2); } if (term & TERMIOS) { - for(i=0; speeds[i].string; i++) - if (cfgetospeed(&cb) == speeds[i].speed) { - (void) printf("%s\n", speeds[i].string); - exit(0); - } + for (i = 0; speeds[i].string; i++) + if (cfgetospeed(&cb) == + speeds[i].speed) { + (void) printf("%s\n", + speeds[i].string); + exit(0); + } } else { - for(i=0; speeds[i].string; i++) - if ((cb.c_cflag&CBAUD) == speeds[i].speed) { - (void) printf("%s\n", speeds[i].string); - exit(0); - } + for (i = 0; speeds[i].string; i++) + if ((cb.c_cflag&CBAUD) == + speeds[i].speed) { + (void) printf("%s\n", + speeds[i].string); + exit(0); + } } (void) printf("unknown\n"); exit(1); - } - else if (strcmp(argv[1], "-g") == 0) { + } else if (strcmp(argv[1], "-g") == 0) { if ((i = open("/dev/tty", 0)) < 0) { perror("stty: Cannot open /dev/tty"); exit(2); } - if((term = get_ttymode(i, &ocb, &cb, &stio, &termiox, - &winsize)) < 0) { + if ((term = get_ttymode(i, + &ocb, &cb, &stio, &termiox, &winsize)) < 0) { perror(STTY); exit(2); } @@ -134,7 +134,8 @@ } } - if((term = get_ttymode(ioctl_desc, &ocb, &cb, &stio, &termiox, &winsize)) < 0) { + if ((term = get_ttymode(ioctl_desc, + &ocb, &cb, &stio, &termiox, &winsize)) < 0) { perror(STTY); exit(2); } @@ -143,16 +144,16 @@ prmodes(0); exit(0); } - if ((argc ==2) && strcmp(argv[1], "all") ==0) { + if ((argc == 2) && strcmp(argv[1], "all") == 0) { prmodes(1); exit(0); } - if ((argc ==2) && strcmp(argv[1], "everything") ==0) { + if ((argc == 2) && strcmp(argv[1], "everything") == 0) { pramodes(1); exit(0); } if ((argc == 2) && (argv[1][0] == '-') && (argv[1][2] == '\0')) - switch(argv[1][1]) { + switch (argv[1][1]) { case 'a': pramodes(0); exit(0); @@ -162,13 +163,15 @@ default: (void) fprintf(stderr, "%s", USAGE); exit(2); - } - if (s_arg = sttyparse(argc, argv, term, &ocb, &cb, &termiox, &winsize)) { + } + if (s_arg = sttyparse(argc, argv, + term, &ocb, &cb, &termiox, &winsize)) { (void) fprintf(stderr, "unknown mode: %s\n", s_arg); exit(2); } - if(set_ttymode(ioctl_desc, term, &ocb, &cb, &stio, &termiox, &winsize, &owinsize) == -1) { + if (set_ttymode(ioctl_desc, + term, &ocb, &cb, &stio, &termiox, &winsize, &owinsize) == -1) { perror(STTY); exit(2); } @@ -183,21 +186,34 @@ if (!(term & ASYNC)) { m = stio.imode; - if (m & IUCLC) (void) fprintf(output, "iuclc "); - else (void) fprintf(output, "-iuclc "); + if (m & IUCLC) + (void) fprintf(output, "iuclc "); + else + (void) fprintf(output, "-iuclc "); m = stio.omode; - if (m & OLCUC) (void) fprintf(output, "olcuc "); - else (void) fprintf(output, "-olcuc "); - if (m & TAB3) (void) fprintf(output, "tab3 "); + if (m & OLCUC) + (void) fprintf(output, "olcuc "); + else + (void) fprintf(output, "-olcuc "); + if (m & TAB3) + (void) fprintf(output, "tab3 "); m = stio.lmode; - if (m & XCASE) (void) fprintf(output, "xcase "); - else (void) fprintf(output, "-xcase "); - if (m & STFLUSH) (void) fprintf(output, "stflush "); - else (void) fprintf(output, "-stflush "); - if (m & STWRAP) (void)fprintf(output, "stwrap "); - else (void) fprintf(output, "-stwrap "); - if (m & STAPPL) (void) fprintf(output, "stappl "); - else (void) fprintf(output, "-stappl "); + if (m & XCASE) + (void) fprintf(output, "xcase "); + else + (void) fprintf(output, "-xcase "); + if (m & STFLUSH) + (void) fprintf(output, "stflush "); + else + (void) fprintf(output, "-stflush "); + if (m & STWRAP) + (void) fprintf(output, "stwrap "); + else + (void) fprintf(output, "-stwrap "); + if (m & STAPPL) + (void) fprintf(output, "stappl "); + else + (void) fprintf(output, "-stappl "); (void) fprintf(output, "\n"); } if (term & ASYNC) { @@ -208,227 +224,242 @@ prspeed("ospeed ", cfgetospeed(&cb)); } else prspeed("speed ", cfgetospeed(&cb)); - if (m&PARENB) { - if((m&PAREXT) && (term & TERMIOS)) { - if (m&PARODD) - (void) fprintf(output,"markp "); + if (m & PARENB) { + if ((m & PAREXT) && (term & TERMIOS)) { + if (m & PARODD) + (void) fprintf(output, "markp "); else - (void) fprintf(output,"spacep "); + (void) fprintf(output, "spacep "); } else { - if (m&PARODD) - (void) fprintf(output,"oddp "); + if (m & PARODD) + (void) fprintf(output, "oddp "); else - (void) fprintf(output,"evenp "); + (void) fprintf(output, "evenp "); } } else - (void) fprintf(output,"-parity "); - if(((m&PARENB) && !(m&CS7)) || (!(m&PARENB) && !(m&CS8))) - (void) fprintf(output,"cs%c ",'5'+(m&CSIZE)/CS6); - if (m&CSTOPB) - (void) fprintf(output,"cstopb "); - if (m&HUPCL) - (void) fprintf(output,"hupcl "); - if (!(m&CREAD)) - (void) fprintf(output,"-cread "); - if (m&CLOCAL) - (void) fprintf(output,"clocal "); - if (m&LOBLK) - (void) fprintf(output,"loblk "); - (void) fprintf(output,"\n"); - if(ocb.c_line != 0) - (void) fprintf(output,"line = %d; ", ocb.c_line); - if(term & WINDOW) { - (void)fprintf(output,"rows = %d; columns = %d;", winsize.ws_row, winsize.ws_col); - (void)fprintf(output," ypixels = %d; xpixels = %d;\n", winsize.ws_ypixel, winsize.ws_xpixel); + (void) fprintf(output, "-parity "); + if (((m & PARENB) && !(m & CS7)) || + (!(m & PARENB) && !(m & CS8))) + (void) fprintf(output, "cs%c ", '5' + (m & CSIZE)/CS6); + if (m & CSTOPB) + (void) fprintf(output, "cstopb "); + if (m & HUPCL) + (void) fprintf(output, "hupcl "); + if (!(m & CREAD)) + (void) fprintf(output, "-cread "); + if (m & CLOCAL) + (void) fprintf(output, "clocal "); + if (m & LOBLK) + (void) fprintf(output, "loblk "); + (void) fprintf(output, "\n"); + if (ocb.c_line != 0) + (void) fprintf(output, "line = %d; ", ocb.c_line); + if (term & WINDOW) { + (void) fprintf(output, "rows = %d; columns = %d;", + winsize.ws_row, winsize.ws_col); + (void) fprintf(output, " ypixels = %d; xpixels = %d;\n", + winsize.ws_ypixel, winsize.ws_xpixel); } - if((cb.c_lflag&ICANON)== 0) - (void) fprintf(output,"min = %d; time = %d;\n", - cb.c_cc[VMIN], cb.c_cc[VTIME]); + if ((cb.c_lflag & ICANON) == 0) + (void) fprintf(output, "min = %d; time = %d;\n", + cb.c_cc[VMIN], cb.c_cc[VTIME]); if (!moremodes) { - if(cb.c_cc[VINTR] != CINTR) + if (cb.c_cc[VINTR] != CINTR) pit(cb.c_cc[VINTR], "intr", "; "); - if(cb.c_cc[VQUIT] != CQUIT) + if (cb.c_cc[VQUIT] != CQUIT) pit(cb.c_cc[VQUIT], "quit", "; "); - if(cb.c_cc[VERASE] != CERASE) + if (cb.c_cc[VERASE] != CERASE) pit(cb.c_cc[VERASE], "erase", "; "); - if(cb.c_cc[VKILL] != CKILL) + if (cb.c_cc[VKILL] != CKILL) pit(cb.c_cc[VKILL], "kill", "; "); - if(cb.c_cc[VEOF] != CEOF) + if (cb.c_cc[VEOF] != CEOF) pit(cb.c_cc[VEOF], "eof", "; "); - if(cb.c_cc[VEOL] != CNUL) + if (cb.c_cc[VEOL] != CNUL) pit(cb.c_cc[VEOL], "eol", "; "); - if(cb.c_cc[VEOL2] != CNUL) + if (cb.c_cc[VEOL2] != CNUL) pit(cb.c_cc[VEOL2], "eol2", "; "); - if(cb.c_cc[VSWTCH] != CSWTCH) + if (cb.c_cc[VSWTCH] != CSWTCH) pit(cb.c_cc[VSWTCH], "swtch", "; "); - if(term & TERMIOS) { - if(cb.c_cc[VSTART] != CSTART) + if (term & TERMIOS) { + if (cb.c_cc[VSTART] != CSTART) pit(cb.c_cc[VSTART], "start", "; "); - if(cb.c_cc[VSTOP] != CSTOP) + if (cb.c_cc[VSTOP] != CSTOP) pit(cb.c_cc[VSTOP], "stop", "; "); - if(cb.c_cc[VSUSP] != CSUSP) + if (cb.c_cc[VSUSP] != CSUSP) pit(cb.c_cc[VSUSP], "susp", "; "); - if(cb.c_cc[VDSUSP] != CDSUSP) + if (cb.c_cc[VDSUSP] != CDSUSP) pit(cb.c_cc[VDSUSP], "dsusp", "; "); - if(cb.c_cc[VREPRINT] != CRPRNT) + if (cb.c_cc[VREPRINT] != CRPRNT) pit(cb.c_cc[VREPRINT], "rprnt", "; "); - if(cb.c_cc[VDISCARD] != CFLUSH) + if (cb.c_cc[VDISCARD] != CFLUSH) pit(cb.c_cc[VDISCARD], "flush", "; "); - if(cb.c_cc[VWERASE] != CWERASE) + if (cb.c_cc[VWERASE] != CWERASE) pit(cb.c_cc[VWERASE], "werase", "; "); - if(cb.c_cc[VLNEXT] != CLNEXT) + if (cb.c_cc[VLNEXT] != CLNEXT) pit(cb.c_cc[VLNEXT], "lnext", "; "); } } - if(pitt) (void) fprintf(output,"\n"); + if (pitt) + (void) fprintf(output, "\n"); m = cb.c_iflag; - if (m&IGNBRK) - (void) fprintf(output,"ignbrk "); - else if (!(m&BRKINT)) - (void) fprintf(output,"-brkint "); - if (!(m&INPCK)) - (void) fprintf(output,"-inpck "); - else if (!(m&IGNPAR)) - (void) fprintf(output,"-ignpar "); - if (m&PARMRK) - (void) fprintf(output,"parmrk "); - if (!(m&ISTRIP)) - (void) fprintf(output,"-istrip "); - if (m&INLCR) - (void) fprintf(output,"inlcr "); - if (m&IGNCR) - (void) fprintf(output,"igncr "); - if (!(m&ICRNL)) - (void) fprintf(output,"-icrnl "); - if (m&IUCLC) - (void) fprintf(output,"iuclc "); - if (!(m&IXON)) - (void) fprintf(output,"-ixon "); - else if (m&IXANY) - (void) fprintf(output,"ixany "); - if (m&IXOFF) - (void) fprintf(output,"ixoff "); - if ((term & TERMIOS) && (m&IMAXBEL)) - (void) fprintf(output,"imaxbel "); + if (m & IGNBRK) + (void) fprintf(output, "ignbrk "); + else if (!(m & BRKINT)) + (void) fprintf(output, "-brkint "); + if (!(m & INPCK)) + (void) fprintf(output, "-inpck "); + else if (!(m & IGNPAR)) + (void) fprintf(output, "-ignpar "); + if (m & PARMRK) + (void) fprintf(output, "parmrk "); + if (!(m & ISTRIP)) + (void) fprintf(output, "-istrip "); + if (m & INLCR) + (void) fprintf(output, "inlcr "); + if (m & IGNCR) + (void) fprintf(output, "igncr "); + if (!(m & ICRNL)) + (void) fprintf(output, "-icrnl "); + if (m & IUCLC) + (void) fprintf(output, "iuclc "); + if (!(m & IXON)) + (void) fprintf(output, "-ixon "); + else if (m & IXANY) + (void) fprintf(output, "ixany "); + if (m & IXOFF) + (void) fprintf(output, "ixoff "); + if ((term & TERMIOS) && (m & IMAXBEL)) + (void) fprintf(output, "imaxbel "); m = cb.c_oflag; - if (!(m&OPOST)) - (void) fprintf(output,"-opost "); + if (!(m & OPOST)) + (void) fprintf(output, "-opost "); else { - if (m&OLCUC) - (void) fprintf(output,"olcuc "); - if (!(m&ONLCR)) - (void) fprintf(output,"-onlcr "); - if (m&OCRNL) - (void) fprintf(output,"ocrnl "); - if (m&ONOCR) - (void) fprintf(output,"onocr "); - if (m&ONLRET) - (void) fprintf(output,"onlret "); - if (m&OFILL) - if (m&OFDEL) - (void) fprintf(output,"del-fill "); + if (m & OLCUC) + (void) fprintf(output, "olcuc "); + if (!(m & ONLCR)) + (void) fprintf(output, "-onlcr "); + if (m & OCRNL) + (void) fprintf(output, "ocrnl "); + if (m & ONOCR) + (void) fprintf(output, "onocr "); + if (m & ONLRET) + (void) fprintf(output, "onlret "); + if (m & OFILL) + if (m & OFDEL) + (void) fprintf(output, "del-fill "); + else + (void) fprintf(output, "nul-fill "); + delay((m & CRDLY)/CR1, "cr"); + delay((m & NLDLY)/NL1, "nl"); + if ((m & TABDLY) == XTABS) + (void) fprintf(output, "-tabs "); else - (void) fprintf(output,"nul-fill "); - delay((m&CRDLY)/CR1, "cr"); - delay((m&NLDLY)/NL1, "nl"); - if ((m&TABDLY) == XTABS) - (void) fprintf(output,"-tabs "); - else - delay((m&TABDLY)/TAB1, "tab"); - delay((m&BSDLY)/BS1, "bs"); - delay((m&VTDLY)/VT1, "vt"); - delay((m&FFDLY)/FF1, "ff"); + delay((m & TABDLY)/TAB1, "tab"); + delay((m & BSDLY)/BS1, "bs"); + delay((m & VTDLY)/VT1, "vt"); + delay((m & FFDLY)/FF1, "ff"); } - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); m = cb.c_lflag; - if (!(m&ISIG)) - (void) fprintf(output,"-isig "); - if (!(m&ICANON)) - (void) fprintf(output,"-icanon "); - if (m&XCASE) - (void) fprintf(output,"xcase "); - if (!(m&ECHO)) - (void) fprintf(output,"-echo "); - if (m&ECHOE) { - if (m&ECHOKE) - (void) fprintf(output,"crt "); + if (!(m & ISIG)) + (void) fprintf(output, "-isig "); + if (!(m & ICANON)) + (void) fprintf(output, "-icanon "); + if (m & XCASE) + (void) fprintf(output, "xcase "); + if (!(m & ECHO)) + (void) fprintf(output, "-echo "); + if (m & ECHOE) { + if (m & ECHOKE) + (void) fprintf(output, "crt "); else - (void) fprintf(output,"echoe -echoke "); + (void) fprintf(output, "echoe -echoke "); } else { - if (!(m&ECHOPRT)) - (void) fprintf(output,"-echoprt "); + if (!(m & ECHOPRT)) + (void) fprintf(output, "-echoprt "); } - if (!(m&ECHOK)) - (void) fprintf(output,"-echok "); - if (m&ECHONL) - (void) fprintf(output,"echonl "); - if (m&NOFLSH) - (void) fprintf(output,"noflsh "); - if (m&TOSTOP) - (void) fprintf(output,"tostop "); - if (!(m&ECHOCTL)) - (void) fprintf(output,"-echoctl "); - if (m&DEFECHO) - (void) fprintf(output,"defecho "); - if (m&FLUSHO) - (void) fprintf(output,"flusho "); - if (m&PENDIN) - (void) fprintf(output,"pendin "); - if (m&IEXTEN) - (void) fprintf(output,"iexten "); - (void) fprintf(output,"\n"); + if (!(m & ECHOK)) + (void) fprintf(output, "-echok "); + if (m & ECHONL) + (void) fprintf(output, "echonl "); + if (m & NOFLSH) + (void) fprintf(output, "noflsh "); + if (m & TOSTOP) + (void) fprintf(output, "tostop "); + if (!(m & ECHOCTL)) + (void) fprintf(output, "-echoctl "); + if (m & DEFECHO) + (void) fprintf(output, "defecho "); + if (m & FLUSHO) + (void) fprintf(output, "flusho "); + if (m & PENDIN) + (void) fprintf(output, "pendin "); + if (m & IEXTEN) + (void) fprintf(output, "iexten "); + (void) fprintf(output, "\n"); } - if(term & FLOW) { + if (term & FLOW) { m = termiox.x_hflag; - if(m & RTSXOFF) - (void) fprintf(output,"rtsxoff "); - if(m & CTSXON) - (void) fprintf(output,"ctsxon "); - if(m & DTRXOFF) - (void) fprintf(output,"dterxoff "); - if(m & CDXON) - (void) fprintf(output,"rlsdxon "); - if(m & ISXOFF) - (void) fprintf(output,"isxoff "); + if (m & RTSXOFF) + (void) fprintf(output, "rtsxoff "); + if (m & CTSXON) + (void) fprintf(output, "ctsxon "); + if (m & DTRXOFF) + (void) fprintf(output, "dterxoff "); + if (m & CDXON) + (void) fprintf(output, "rlsdxon "); + if (m & ISXOFF) + (void) fprintf(output, "isxoff "); m = termiox.x_cflag; - switch(m & XMTCLK) - { - case XCIBRG: (void)fprintf(output,"xcibrg "); - break; - case XCTSET: (void)fprintf(output,"xctset "); - break; - case XCRSET: (void)fprintf(output,"xcrset "); + switch (m & XMTCLK) { + case XCIBRG: + (void) fprintf(output, "xcibrg "); + break; + case XCTSET: + (void) fprintf(output, "xctset "); + break; + case XCRSET: + (void) fprintf(output, "xcrset "); + break; } - - switch(m & RCVCLK) - { - case RCIBRG: (void)fprintf(output,"rcibrg "); - break; - case RCTSET: (void)fprintf(output,"rctset "); - break; - case RCRSET: (void)fprintf(output,"rcrset "); + + switch (m & RCVCLK) { + case RCIBRG: + (void) fprintf(output, "rcibrg "); + break; + case RCTSET: + (void) fprintf(output, "rctset "); + break; + case RCRSET: + (void) fprintf(output, "rcrset "); + break; } - - switch(m & TSETCLK) - { - case TSETCOFF: (void)fprintf(output,"tsetcoff "); - break; - case TSETCRBRG: (void)fprintf(output,"tsetcrc "); - break; - case TSETCTBRG: (void)fprintf(output,"tsetcxc "); + + switch (m & TSETCLK) { + case TSETCOFF: + (void) fprintf(output, "tsetcoff "); + break; + case TSETCRBRG: + (void) fprintf(output, "tsetcrc "); + break; + case TSETCTBRG: + (void) fprintf(output, "tsetcxc "); + break; } - - switch(m & RSETCLK) - { - case RSETCOFF: (void)fprintf(output,"rsetcoff "); - break; - case RSETCRBRG: (void)fprintf(output,"rsetcrc "); - break; - case RSETCTBRG: (void)fprintf(output,"rsetcxc "); + + switch (m & RSETCLK) { + case RSETCOFF: + (void) fprintf(output, "rsetcoff "); + break; + case RSETCRBRG: + (void) fprintf(output, "rsetcrc "); + break; + case RSETCTBRG: + (void) fprintf(output, "rsetcxc "); } - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); } - if(moremodes) + if (moremodes) prachars(); } @@ -439,23 +470,25 @@ int m; m = cb.c_cflag; - if(term & ASYNC) { + if (term & ASYNC) { if ((term & TERMIOS) && cfgetispeed(&cb) != 0 && cfgetispeed(&cb) != cfgetospeed(&cb)) { prspeed("ispeed ", cfgetispeed(&cb)); prspeed("ospeed ", cfgetospeed(&cb)); } else prspeed("speed ", cfgetospeed(&cb)); - if(!(term & TERMIOS)) - (void) fprintf(output,"line = %d; ", ocb.c_line); - (void) fprintf(output,"\n"); - if(term & WINDOW) { - (void)fprintf(output,"rows = %d columns = %d; ", winsize.ws_row, winsize.ws_col); - (void)fprintf(output,"ypixels = %d xpixels = %d\n", winsize.ws_ypixel, winsize.ws_xpixel); + if (!(term & TERMIOS)) + (void) fprintf(output, "line = %d; ", ocb.c_line); + (void) fprintf(output, "\n"); + if (term & WINDOW) { + (void) fprintf(output, "rows = %d columns = %d; ", + winsize.ws_row, winsize.ws_col); + (void) fprintf(output, "ypixels = %d xpixels = %d\n", + winsize.ws_ypixel, winsize.ws_xpixel); } - if((cb.c_lflag&ICANON)== 0) - (void) fprintf(output,"min = %d; time = %d;\n", cb.c_cc[VMIN], - cb.c_cc[VTIME]); + if ((cb.c_lflag & ICANON) == 0) + (void) fprintf(output, "min = %d; time = %d;\n", + cb.c_cc[VMIN], cb.c_cc[VTIME]); if (!tabform) { pit(cb.c_cc[VINTR], "intr", "; "); pit(cb.c_cc[VQUIT], "quit", "; "); @@ -465,7 +498,7 @@ pit(cb.c_cc[VEOL], "eol", "; "); pit(cb.c_cc[VEOL2], "eol2", "; "); pit(cb.c_cc[VSWTCH], "swtch", ";\n"); - if(term & TERMIOS) { + if (term & TERMIOS) { pit(cb.c_cc[VSTART], "start", "; "); pit(cb.c_cc[VSTOP], "stop", "; "); pit(cb.c_cc[VSUSP], "susp", "; "); @@ -479,126 +512,138 @@ } else pit((unsigned)stio.tab, "ctab", "\n"); m = cb.c_cflag; - (void) fprintf(output,"-parenb "+((m&PARENB)!=0)); - (void) fprintf(output,"-parodd "+((m&PARODD)!=0)); - (void) fprintf(output,"cs%c ",'5'+(m&CSIZE)/CS6); - (void) fprintf(output,"-cstopb "+((m&CSTOPB)!=0)); - (void) fprintf(output,"-hupcl "+((m&HUPCL)!=0)); - (void) fprintf(output,"-cread "+((m&CREAD)!=0)); - (void) fprintf(output,"-clocal "+((m&CLOCAL)!=0)); + (void) fprintf(output, "-parenb " + ((m & PARENB) != 0)); + (void) fprintf(output, "-parodd " + ((m & PARODD) != 0)); + (void) fprintf(output, "cs%c ", '5'+ (m & CSIZE)/CS6); + (void) fprintf(output, "-cstopb " + ((m & CSTOPB) != 0)); + (void) fprintf(output, "-hupcl " + ((m & HUPCL) != 0)); + (void) fprintf(output, "-cread " + ((m & CREAD) != 0)); + (void) fprintf(output, "-clocal " + ((m & CLOCAL) != 0)); - (void) fprintf(output,"-loblk "+((m&LOBLK)!=0)); - if(term & TERMIOS) - (void) fprintf(output,"-parext "+((m&PAREXT)!=0)); + (void) fprintf(output, "-loblk " + ((m & LOBLK) != 0)); + if (term & TERMIOS) + (void) fprintf(output, "-parext " + ((m & PAREXT) != 0)); - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); m = cb.c_iflag; - (void) fprintf(output,"-ignbrk "+((m&IGNBRK)!=0)); - (void) fprintf(output,"-brkint "+((m&BRKINT)!=0)); - (void) fprintf(output,"-ignpar "+((m&IGNPAR)!=0)); - (void) fprintf(output,"-parmrk "+((m&PARMRK)!=0)); - (void) fprintf(output,"-inpck "+((m&INPCK)!=0)); - (void) fprintf(output,"-istrip "+((m&ISTRIP)!=0)); - (void) fprintf(output,"-inlcr "+((m&INLCR)!=0)); - (void) fprintf(output,"-igncr "+((m&IGNCR)!=0)); - (void) fprintf(output,"-icrnl "+((m&ICRNL)!=0)); - (void) fprintf(output,"-iuclc "+((m&IUCLC)!=0)); - (void) fprintf(output,"\n"); - (void) fprintf(output,"-ixon "+((m&IXON)!=0)); - (void) fprintf(output,"-ixany "+((m&IXANY)!=0)); - (void) fprintf(output,"-ixoff "+((m&IXOFF)!=0)); - if(term & TERMIOS) - (void) fprintf(output,"-imaxbel "+((m&IMAXBEL)!=0)); - (void) fprintf(output,"\n"); + (void) fprintf(output, "-ignbrk " + ((m & IGNBRK) != 0)); + (void) fprintf(output, "-brkint " + ((m & BRKINT) != 0)); + (void) fprintf(output, "-ignpar " + ((m & IGNPAR) != 0)); + (void) fprintf(output, "-parmrk " + ((m & PARMRK) != 0)); + (void) fprintf(output, "-inpck " + ((m & INPCK) != 0)); + (void) fprintf(output, "-istrip " + ((m & ISTRIP) != 0)); + (void) fprintf(output, "-inlcr " + ((m & INLCR) != 0)); + (void) fprintf(output, "-igncr " + ((m & IGNCR) != 0)); + (void) fprintf(output, "-icrnl " + ((m & ICRNL) != 0)); + (void) fprintf(output, "-iuclc " + ((m & IUCLC) != 0)); + (void) fprintf(output, "\n"); + (void) fprintf(output, "-ixon " + ((m & IXON) != 0)); + (void) fprintf(output, "-ixany " + ((m & IXANY) != 0)); + (void) fprintf(output, "-ixoff " + ((m & IXOFF) != 0)); + if (term & TERMIOS) + (void) fprintf(output, "-imaxbel " + ((m & IMAXBEL) != 0)); + (void) fprintf(output, "\n"); m = cb.c_lflag; - (void) fprintf(output,"-isig "+((m&ISIG)!=0)); - (void) fprintf(output,"-icanon "+((m&ICANON)!=0)); - (void) fprintf(output,"-xcase "+((m&XCASE)!=0)); - (void) fprintf(output,"-echo "+((m&ECHO)!=0)); - (void) fprintf(output,"-echoe "+((m&ECHOE)!=0)); - (void) fprintf(output,"-echok "+((m&ECHOK)!=0)); - (void) fprintf(output,"-echonl "+((m&ECHONL)!=0)); - (void) fprintf(output,"-noflsh "+((m&NOFLSH)!=0)); - if(term & TERMIOS) { - (void) fprintf(output,"\n"); - (void) fprintf(output,"-tostop "+((m&TOSTOP)!=0)); - (void) fprintf(output,"-echoctl "+((m&ECHOCTL)!=0)); - (void) fprintf(output,"-echoprt "+((m&ECHOPRT)!=0)); - (void) fprintf(output,"-echoke "+((m&ECHOKE)!=0)); - (void) fprintf(output,"-defecho "+((m&DEFECHO)!=0)); - (void) fprintf(output,"-flusho "+((m&FLUSHO)!=0)); - (void) fprintf(output,"-pendin "+((m&PENDIN)!=0)); - (void) fprintf(output,"-iexten "+((m&IEXTEN)!=0)); + (void) fprintf(output, "-isig " + ((m & ISIG) != 0)); + (void) fprintf(output, "-icanon " + ((m & ICANON) != 0)); + (void) fprintf(output, "-xcase " + ((m & XCASE) != 0)); + (void) fprintf(output, "-echo " + ((m & ECHO) != 0)); + (void) fprintf(output, "-echoe " + ((m & ECHOE) != 0)); + (void) fprintf(output, "-echok " + ((m & ECHOK) != 0)); + (void) fprintf(output, "-echonl " + ((m & ECHONL) != 0)); + (void) fprintf(output, "-noflsh " + ((m & NOFLSH) != 0)); + if (term & TERMIOS) { + (void) fprintf(output, "\n"); + (void) fprintf(output, "-tostop " + ((m & TOSTOP) != 0)); + (void) fprintf(output, "-echoctl " + ((m & ECHOCTL) != 0)); + (void) fprintf(output, "-echoprt " + ((m & ECHOPRT) != 0)); + (void) fprintf(output, "-echoke " + ((m & ECHOKE) != 0)); + (void) fprintf(output, "-defecho " + ((m & DEFECHO) != 0)); + (void) fprintf(output, "-flusho " + ((m & FLUSHO) != 0)); + (void) fprintf(output, "-pendin " + ((m & PENDIN) != 0)); + (void) fprintf(output, "-iexten " + ((m & IEXTEN) != 0)); } - if(!(term & ASYNC)) { - (void) fprintf(output,"-stflush "+((m&STFLUSH)!=0)); - (void) fprintf(output,"-stwrap "+((m&STWRAP)!=0)); - (void) fprintf(output,"-stappl "+((m&STAPPL)!=0)); + if (!(term & ASYNC)) { + (void) fprintf(output, "-stflush " + ((m & STFLUSH) != 0)); + (void) fprintf(output, "-stwrap " + ((m & STWRAP) != 0)); + (void) fprintf(output, "-stappl " + ((m & STAPPL) != 0)); } - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); m = cb.c_oflag; - (void) fprintf(output,"-opost "+((m&OPOST)!=0)); - (void) fprintf(output,"-olcuc "+((m&OLCUC)!=0)); - (void) fprintf(output,"-onlcr "+((m&ONLCR)!=0)); - (void) fprintf(output,"-ocrnl "+((m&OCRNL)!=0)); - (void) fprintf(output,"-onocr "+((m&ONOCR)!=0)); - (void) fprintf(output,"-onlret "+((m&ONLRET)!=0)); - (void) fprintf(output,"-ofill "+((m&OFILL)!=0)); - (void) fprintf(output,"-ofdel "+((m&OFDEL)!=0)); - delay((m&CRDLY)/CR1, "cr"); - delay((m&NLDLY)/NL1, "nl"); - if ((m&TABDLY) == XTABS) - (void) fprintf(output,"-tabs "); + (void) fprintf(output, "-opost " + ((m & OPOST) != 0)); + (void) fprintf(output, "-olcuc " + ((m & OLCUC) != 0)); + (void) fprintf(output, "-onlcr " + ((m & ONLCR) != 0)); + (void) fprintf(output, "-ocrnl " + ((m & OCRNL) != 0)); + (void) fprintf(output, "-onocr " + ((m & ONOCR) != 0)); + (void) fprintf(output, "-onlret " + ((m & ONLRET) != 0)); + (void) fprintf(output, "-ofill " + ((m & OFILL) != 0)); + (void) fprintf(output, "-ofdel " + ((m & OFDEL) != 0)); + delay((m & CRDLY)/CR1, "cr"); + delay((m & NLDLY)/NL1, "nl"); + if ((m & TABDLY) == XTABS) + (void) fprintf(output, "-tabs "); else - delay((m&TABDLY)/TAB1, "tab"); - delay((m&BSDLY)/BS1, "bs"); - delay((m&VTDLY)/VT1, "vt"); - delay((m&FFDLY)/FF1, "ff"); - (void) fprintf(output,"\n"); - if(term & FLOW) { + delay((m & TABDLY)/TAB1, "tab"); + delay((m & BSDLY)/BS1, "bs"); + delay((m & VTDLY)/VT1, "vt"); + delay((m & FFDLY)/FF1, "ff"); + (void) fprintf(output, "\n"); + if (term & FLOW) { m = termiox.x_hflag; - (void) fprintf(output,"-rtsxoff "+((m&RTSXOFF)!=0)); - (void) fprintf(output,"-ctsxon "+((m&CTSXON)!=0)); - (void) fprintf(output,"-dterxoff "+((m&DTRXOFF)!=0)); - (void) fprintf(output,"-rlsdxon "+((m&CDXON)!=0)); - (void) fprintf(output,"-isxoff "+((m&ISXOFF)!=0)); + (void) fprintf(output, "-rtsxoff " + ((m & RTSXOFF) != 0)); + (void) fprintf(output, "-ctsxon " + ((m & CTSXON) != 0)); + (void) fprintf(output, "-dterxoff " + ((m & DTRXOFF) != 0)); + (void) fprintf(output, "-rlsdxon " + ((m & CDXON) != 0)); + (void) fprintf(output, "-isxoff " + ((m & ISXOFF) != 0)); m = termiox.x_cflag; - switch(m & XMTCLK) - { - case XCIBRG: (void)fprintf(output,"xcibrg "); - break; - case XCTSET: (void)fprintf(output,"xctset "); - break; - case XCRSET: (void)fprintf(output,"xcrset "); + switch (m & XMTCLK) { + case XCIBRG: + (void) fprintf(output, "xcibrg "); + break; + case XCTSET: + (void) fprintf(output, "xctset "); + break; + case XCRSET: + (void) fprintf(output, "xcrset "); + break; } - - switch(m & RCVCLK) - { - case RCIBRG: (void)fprintf(output,"rcibrg "); - break; - case RCTSET: (void)fprintf(output,"rctset "); - break; - case RCRSET: (void)fprintf(output,"rcrset "); + + switch (m & RCVCLK) { + case RCIBRG: + (void) fprintf(output, "rcibrg "); + break; + case RCTSET: + (void) fprintf(output, "rctset "); + break; + case RCRSET: + (void) fprintf(output, "rcrset "); + break; } - - switch(m & TSETCLK) - { - case TSETCOFF: (void)fprintf(output,"tsetcoff "); - break; - case TSETCRBRG: (void)fprintf(output,"tsetcrc "); - break; - case TSETCTBRG: (void)fprintf(output,"tsetcxc "); + + switch (m & TSETCLK) { + case TSETCOFF: + (void) fprintf(output, "tsetcoff "); + break; + case TSETCRBRG: + (void) fprintf(output, "tsetcrc "); + break; + case TSETCTBRG: + (void) fprintf(output, "tsetcxc "); + break; } - - switch(m & RSETCLK) - { - case RSETCOFF: (void)fprintf(output,"rsetcoff "); - break; - case RSETCRBRG: (void)fprintf(output,"rsetcrc "); - break; - case RSETCTBRG: (void)fprintf(output,"rsetcxc "); + + switch (m & RSETCLK) { + case RSETCOFF: + (void) fprintf(output, "rsetcoff "); + break; + case RSETCRBRG: + (void) fprintf(output, "rsetcrc "); + break; + case RSETCTBRG: + (void) fprintf(output, "rsetcxc "); + break; } - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); } if (tabform) prachars(); @@ -607,10 +652,10 @@ void prachars(void) { - if ((cb.c_lflag&ICANON)==0) - (void) fprintf(output,"min %d, time %d\n", cb.c_cc[VMIN], + if ((cb.c_lflag & ICANON) == 0) + (void) fprintf(output, "min %d, time %d\n", cb.c_cc[VMIN], cb.c_cc[VTIME]); - (void) fprintf(output,"\ + (void) fprintf(output, "\ erase kill werase rprnt flush lnext susp intr quit stop eof\ \n"); pcol(cb.c_cc[VERASE], 0); @@ -625,14 +670,14 @@ pcol(cb.c_cc[VSTOP], cb.c_cc[VSTART]); if (cb.c_lflag&ICANON) pcol(cb.c_cc[VEOF], cb.c_cc[VEOL]); - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); if (cb.c_cc[VEOL2] != 0 || cb.c_cc[VSWTCH] != 0) { - (void) fprintf(output,"\ + (void) fprintf(output, "\ eol2 swtch\ \n"); pcol(cb.c_cc[VEOL2], 0); pcol(cb.c_cc[VSWTCH], 0); - (void) fprintf(output,"\n"); + (void) fprintf(output, "\n"); } } @@ -649,28 +694,28 @@ if (ch1 == 0) continue; if (ch1 & 0200 && !isprint(ch1)) { - (void) fprintf(output,"M-"); + (void) fprintf(output, "M-"); nout += 2; ch1 &= ~ 0200; } if (ch1 == 0177) { - (void) fprintf(output,"^"); + (void) fprintf(output, "^"); nout++; ch1 = '?'; } else if (ch1 < ' ') { - (void) fprintf(output,"^"); + (void) fprintf(output, "^"); nout++; ch1 += '@'; } - (void) fprintf(output,"%c", ch1); + (void) fprintf(output, "%c", ch1); nout++; if (ch2 != 0) { - (void) fprintf(output,"/"); + (void) fprintf(output, "/"); nout++; } } while (nout < 7) { - (void) fprintf(output," "); + (void) fprintf(output, " "); nout++; } } @@ -681,43 +726,44 @@ { pitt++; - (void) fprintf(output,"%s", itsname); - if ((term & TERMIOS) && what == _POSIX_VDISABLE || !(term & TERMIOS) && what == 0200) { - (void) fprintf(output," = <undef>%s", sep); + (void) fprintf(output, "%s", itsname); + if ((term & TERMIOS) && what == _POSIX_VDISABLE || + !(term & TERMIOS) && what == 0200) { + (void) fprintf(output, " = <undef>%s", sep); return; } - (void) fprintf(output," = "); + (void) fprintf(output, " = "); if (what & 0200 && !isprint(what)) { - (void) fprintf(output,"-"); + (void) fprintf(output, "-"); what &= ~ 0200; } if (what == 0177) { - (void) fprintf(output,"^?%s", sep); + (void) fprintf(output, "^?%s", sep); return; } else if (what < ' ') { - (void) fprintf(output,"^"); + (void) fprintf(output, "^"); what += '`'; } - (void) fprintf(output,"%c%s", what, sep); + (void) fprintf(output, "%c%s", what, sep); } void delay(int m, char *s) { - if(m) - (void) fprintf(output,"%s%d ", s, m); + if (m) + (void) fprintf(output, "%s%d ", s, m); } long speed[] = { - 0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,19200,38400, - 57600,76800,115200,153600,230400,307200,460800 + 0, 50, 75, 110, 134, 150, 200, 300, + 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, + 57600, 76800, 115200, 153600, 230400, 307200, 460800, 921600 }; void prspeed(char *c, int s) { - - (void) fprintf(output,"%s%d baud; ", c, speed[s]); + (void) fprintf(output, "%s%d baud; ", c, speed[s]); } /* @@ -732,14 +778,15 @@ /* Since the -g option is mostly used for redirecting to a file */ /* We must print to stdout here, not stderr */ - (void) printf("%x:%x:%x:%x:",cb.c_iflag,cb.c_oflag,cb.c_cflag,cb.c_lflag); + (void) printf("%x:%x:%x:%x:", cb.c_iflag, cb.c_oflag, + cb.c_cflag, cb.c_lflag); - if(term & TERMIOS) + if (term & TERMIOS) /* last control slot is unused */ last = NCCS - 2; else last = NCC - 1; - for(i = 0; i < last; i++) + for (i = 0; i < last; i++) (void) printf("%x:", cb.c_cc[i]); (void) printf("%x\n", cb.c_cc[last]); }
--- a/usr/src/ucbcmd/stty/sttytable.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/ucbcmd/stty/sttytable.c Sun Apr 12 10:48:30 2009 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <sys/types.h> @@ -43,7 +41,7 @@ "75", B75, "110", B110, "134", B134, - "134.5",B134, + "134.5", B134, "150", B150, "200", B200, "300", B300, @@ -66,6 +64,7 @@ "230400", B230400, "307200", B307200, "460800", B460800, + "921600", B921600, 0, }; /* Control Modes */ @@ -131,7 +130,7 @@ "parmrk", PARMRK, 0, "-parmrk", 0, PARMRK, "inpck", INPCK, 0, - "-inpck", 0,INPCK, + "-inpck", 0, INPCK, "istrip", ISTRIP, 0, "-istrip", 0, ISTRIP, "inlcr", INLCR, 0, @@ -255,7 +254,7 @@ "-nl", ONLCR, (OCRNL|ONLRET), "nl", 0, ONLCR, "ocrnl", OCRNL, 0, - "-ocrnl",0, OCRNL, + "-ocrnl", 0, OCRNL, "onocr", ONOCR, 0, "-onocr", 0, ONOCR, "onlret", ONLRET, 0, @@ -317,18 +316,19 @@ }; const struct mds clkmodes[] = { - "xcibrg", XCIBRG, XMTCLK, - "xctset", XCTSET, XMTCLK, - "xcrset", XCRSET, XMTCLK, - "rcibrg", RCIBRG, RCVCLK, - "rctset", RCTSET, RCVCLK, - "rcrset", RCRSET, RCVCLK, - "tsetcoff", TSETCOFF, TSETCLK, - "tsetcrc", TSETCRBRG, TSETCLK, - "tsetcxc", TSETCTBRG, TSETCLK, - "rsetcoff", RSETCOFF, RSETCLK, - "rsetcrc", RSETCRBRG, RSETCLK, - "rsetcxc", RSETCTBRG, RSETCLK, - "async", XCIBRG|RCIBRG|TSETCOFF|RSETCOFF, XMTCLK|RCVCLK|TSETCLK|RSETCLK, + "xcibrg", XCIBRG, XMTCLK, + "xctset", XCTSET, XMTCLK, + "xcrset", XCRSET, XMTCLK, + "rcibrg", RCIBRG, RCVCLK, + "rctset", RCTSET, RCVCLK, + "rcrset", RCRSET, RCVCLK, + "tsetcoff", TSETCOFF, TSETCLK, + "tsetcrc", TSETCRBRG, TSETCLK, + "tsetcxc", TSETCTBRG, TSETCLK, + "rsetcoff", RSETCOFF, RSETCLK, + "rsetcrc", RSETCRBRG, RSETCLK, + "rsetcxc", RSETCTBRG, RSETCLK, + "async", + XCIBRG|RCIBRG|TSETCOFF|RSETCOFF, XMTCLK|RCVCLK|TSETCLK|RSETCLK, 0, };
--- a/usr/src/ucbcmd/tset/tset.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/ucbcmd/tset/tset.c Sun Apr 12 10:48:30 2009 -0700 @@ -1,5 +1,5 @@ /* - * Copyright 1999 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -13,261 +13,259 @@ * specifies the terms and conditions for redistribution. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* -** TSET -- set terminal modes -** -** This program does sophisticated terminal initialization. -** I recommend that you include it in your .profile or .login -** file to initialize whatever terminal you are on. -** -** There are several features: -** -** A special file or sequence (as controlled by the termcap file) -** is sent to the terminal. -** -** Mode bits are set on a per-terminal_type basis (much better -** than UNIX itself). This allows special delays, automatic -** tabs, etc. -** -** Erase and Kill characters can be set to whatever you want. -** Default is to change erase to control-H on a terminal which -** can overstrike, and leave it alone on anything else. Kill -** is always left alone unless specifically requested. These -** characters can be represented as "^X" meaning control-X; -** X is any character. -** -** Terminals which are dialups or plugboard types can be aliased -** to whatever type you may have in your home or office. Thus, -** if you know that when you dial up you will always be on a -** TI 733, you can specify that fact to tset. You can represent -** a type as "?type". This will ask you what type you want it -** to be -- if you reply with just a newline, it will default -** to the type given. -** -** The current terminal type can be queried. -** -** Usage: -** tset [-] [-EC] [-eC] [-kC] [-iC] [-s] [-h] [-u] [-r] -** [-m [ident] [test baudrate] :type] -** [-Q] [-I] [-S] [type] -** -** In systems with environments, use: -** eval `tset -s ...` -** Actually, this doesn't work in old csh's. -** Instead, use: -** tset -s ... > tset.tmp -** source tset.tmp -** rm tset.tmp -** or: -** set noglob -** set term=(`tset -S ....`) -** setenv TERM $term[1] -** setenv TERMCAP "$term[2]" -** unset term -** unset noglob -** -** Positional Parameters: -** type -- the terminal type to force. If this is -** specified, initialization is for this -** terminal type. -** -** Flags: -** - -- report terminal type. Whatever type is -** decided on is reported. If no other flags -** are stated, the only affect is to write -** the terminal type on the standard output. -** -r -- report to user in addition to other flags. -** -EC -- set the erase character to C on all terminals -** except those which cannot backspace (e.g., -** a TTY 33). C defaults to control-H. -** -eC -- set the erase character to C on all terminals. -** C defaults to control-H. If not specified, -** the erase character is untouched; however, if -** not specified and the erase character is NULL -** (zero byte), the erase character is set to CERASE. -** -kC -- set the kill character to C on all terminals. -** Default for C is control-U. If not specified, -** the kill character is untouched; however, if -** not specified and the kill character is NULL -** (zero byte), the kill character is set to CKILL. -** -iC -- set the interrupt character to C on all terminals. -** Default for C is control-C. If not specified, the -** interrupt character is untouched; however, if -** not specified and the interrupt character is NULL -** (zero byte), the interrupt character is set to -** control-C. -** -qC -- reserved for setable quit character. -** -m -- map the system identified type to some user -** specified type. The mapping can be baud rate -** dependent. This replaces the old -d, -p flags. -** (-d type -> -m dialup:type) -** (-p type -> -m plug:type) -** Syntax: -m identifier [test baudrate] :type -** where: ``identifier'' is terminal type found in -** /etc/ttys for this port, (abscence of an identifier -** matches any identifier); ``test'' may be any combination -** of > = < ! @; ``baudrate'' is as with stty(1); -** ``type'' is the actual terminal type to use if the -** mapping condition is met. Multiple maps are scanned -** in order and the first match prevails. -** -n -- If the new tty driver from UCB is available, this flag -** will activate the new options for erase and kill -** processing. This will be different for printers -** and crt's. For crts, if the baud rate is < 1200 then -** erase and kill don't remove characters from the screen. -** -h -- don't read htmp file. Normally the terminal type -** is determined by reading the htmp file or the -** environment (unless some mapping is specified). -** This forces a read of the ttytype file -- useful -** when htmp is somehow wrong. (V6 only) -** -u -- don't update htmp. It seemed like this should -** be put in. Note that htmp is never actually -** written if there are no changes, so don't bother -** bother using this for efficiency reasons alone. -** -s -- output setenv commands for TERM. This can be -** used with -** `tset -s ...` -** and is to be prefered to: -** setenv TERM `tset - ...` -** because -s sets the TERMCAP variable also. -** -S -- Similar to -s but outputs 2 strings suitable for -** use in csh .login files as follows: -** set noglob -** set term=(`tset -S .....`) -** setenv TERM $term[1] -** setenv TERMCAP "$term[2]" -** unset term -** unset noglob -** -Q -- be quiet. don't output 'Erase set to' etc. -** -I -- don't do terminal initialization (is & if -** strings). -** -v -- On virtual terminal systems, don't set up a -** virtual terminal. Otherwise tset will tell -** the operating system what kind of terminal you -** are on (if it is a known terminal) and fix up -** the output of -s to use virtual terminal sequences. -** -** Files: -** /etc/ttys -** contains a terminal id -> terminal type -** mapping; used when any user mapping is specified, -** or the environment doesn't have TERM set. -** /etc/termcap -** a terminal_type -> terminal_capabilities -** mapping. -** -** Return Codes: -** -1 -- couldn't open termcap. -** 1 -- bad terminal type, or standard output not tty. -** 0 -- ok. -** -** Defined Constants: -** DIALUP -- the type code for a dialup port. -** PLUGBOARD -- the type code for a plugboard port. -** ARPANET -- the type code for an arpanet port. -** BACKSPACE -- control-H, the default for -e. -** CNTL('U') -- control-U, the default for -k. -** OLDERASE -- the ancient default erase character. -** FILEDES -- the file descriptor to do the operation -** on, nominally 1 or 2. -** STDOUT -- the standard output file descriptor. -** UIDMASK -- the bit pattern to mask with the getuid() -** call to get just the user id. -** GTTYN -- defines file containing generalized ttynames -** and compiles code to look there. -** -** Requires: -** Routines to handle htmp, ttys, and termcap. -** -** Compilation Flags: -** OLDFLAGS -- must be defined to compile code for any of -** the -d, -p, or -a flags. -** OLDDIALUP -- accept the -d flag. -** OLDPLUGBOARD -- accept the -p flag. -** OLDARPANET -- accept the -a flag. -** V6 -- if clear, use environments, not htmp. -** also use TIOCSETN rather than stty to avoid flushing -** GTTYN -- if set, compiles code to look at /etc/ttys. -** -** Trace Flags: -** none -** -** Diagnostics: -** Bad flag -** An incorrect option was specified. -** Too few args -** more command line arguments are required. -** Unexpected arg -** wrong type of argument was encountered. -** Cannot open ... -** The specified file could not be openned. -** Type ... unknown -** An unknown terminal type was specified. -** Cannot update htmp -** Cannot update htmp file when the standard -** output is not a terminal. -** Erase set to ... -** Telling that the erase character has been -** set to the specified character. -** Kill set to ... -** Ditto for kill -** Erase is ... Kill is ... -** Tells that the erase/kill characters were -** wierd before, but they are being left as-is. -** Not a terminal -** Set if FILEDES is not a terminal. -** -** Compilation Instructions: -** cc -n -O tset.c -ltermlib -** mv a.out tset -** chown bin tset -** chmod 4755 tset -** -** where 'bin' should be whoever owns the 'htmp' file. -** If 'htmp' is 666, then tset need not be setuid. -** -** For version 6 the compile command should be: -** cc -n -O -I/usr/include/retrofit tset.c -ltermlib -lretro -lS -** -** -** History: -** 1/81 -- Added alias checking for mapping identifiers. -** 7/80 -- '-S' added. '-m' mapping added. TERMCAP string -** cleaned up. -** 3/80 -- Changed to use tputs. Prc & flush added. -** 10/79 -- '-s' option extended to handle TERMCAP -** variable, set noglob, quote the entry, -** and know about the Bourne shell. Terminal -** initialization moved to before any information -** output so screen clears would not screw you. -** '-Q' option added. -** 8/79 -- '-' option alone changed to only output -** type. '-s' option added. 'VERSION7' -** changed to 'V6' for compatibility. -** 12/78 -- modified for eventual migration to VAX/UNIX, -** so the '-' option is changed to output only -** the terminal type to STDOUT instead of -** FILEDES. -** 9/78 -- '-' and '-p' options added (now fully -** compatible with ttytype!), and spaces are -** permitted between the -d and the type. -** 8/78 -- The sense of -h and -u were reversed, and the -** -f flag is dropped -- same effect is available -** by just stating the terminal type. -** 10/77 -- Written. -*/ + * TSET -- set terminal modes + * + * This program does sophisticated terminal initialization. + * I recommend that you include it in your .profile or .login + * file to initialize whatever terminal you are on. + * + * There are several features: + * + * A special file or sequence (as controlled by the termcap file) + * is sent to the terminal. + * + * Mode bits are set on a per-terminal_type basis (much better + * than UNIX itself). This allows special delays, automatic + * tabs, etc. + * + * Erase and Kill characters can be set to whatever you want. + * Default is to change erase to control-H on a terminal which + * can overstrike, and leave it alone on anything else. Kill + * is always left alone unless specifically requested. These + * characters can be represented as "^X" meaning control-X; + * X is any character. + * + * Terminals which are dialups or plugboard types can be aliased + * to whatever type you may have in your home or office. Thus, + * if you know that when you dial up you will always be on a + * TI 733, you can specify that fact to tset. You can represent + * a type as "?type". This will ask you what type you want it + * to be -- if you reply with just a newline, it will default + * to the type given. + * + * The current terminal type can be queried. + * + * Usage: + * tset [-] [-EC] [-eC] [-kC] [-iC] [-s] [-h] [-u] [-r] + * [-m [ident] [test baudrate] :type] + * [-Q] [-I] [-S] [type] + * + * In systems with environments, use: + * eval `tset -s ...` + * Actually, this doesn't work in old csh's. + * Instead, use: + * tset -s ... > tset.tmp + * source tset.tmp + * rm tset.tmp + * or: + * set noglob + * set term=(`tset -S ....`) + * setenv TERM $term[1] + * setenv TERMCAP "$term[2]" + * unset term + * unset noglob + * + * Positional Parameters: + * type -- the terminal type to force. If this is + * specified, initialization is for this + * terminal type. + * + * Flags: + * - -- report terminal type. Whatever type is + * decided on is reported. If no other flags + * are stated, the only affect is to write + * the terminal type on the standard output. + * -r -- report to user in addition to other flags. + * -EC -- set the erase character to C on all terminals + * except those which cannot backspace (e.g., + * a TTY 33). C defaults to control-H. + * -eC -- set the erase character to C on all terminals. + * C defaults to control-H. If not specified, + * the erase character is untouched; however, if + * not specified and the erase character is NULL + * (zero byte), the erase character is set to CERASE. + * -kC -- set the kill character to C on all terminals. + * Default for C is control-U. If not specified, + * the kill character is untouched; however, if + * not specified and the kill character is NULL + * (zero byte), the kill character is set to CKILL. + * -iC -- set the interrupt character to C on all terminals. + * Default for C is control-C. If not specified, the + * interrupt character is untouched; however, if + * not specified and the interrupt character is NULL + * (zero byte), the interrupt character is set to + * control-C. + * -qC -- reserved for setable quit character. + * -m -- map the system identified type to some user + * specified type. The mapping can be baud rate + * dependent. This replaces the old -d, -p flags. + * (-d type -> -m dialup:type) + * (-p type -> -m plug:type) + * Syntax: -m identifier [test baudrate] :type + * where: ``identifier'' is terminal type found in + * /etc/ttys for this port, (abscence of an identifier + * matches any identifier); ``test'' may be any combination + * of > = < ! @; ``baudrate'' is as with stty(1); + * ``type'' is the actual terminal type to use if the + * mapping condition is met. Multiple maps are scanned + * in order and the first match prevails. + * -n -- If the new tty driver from UCB is available, this flag + * will activate the new options for erase and kill + * processing. This will be different for printers + * and crt's. For crts, if the baud rate is < 1200 then + * erase and kill don't remove characters from the screen. + * -h -- don't read htmp file. Normally the terminal type + * is determined by reading the htmp file or the + * environment (unless some mapping is specified). + * This forces a read of the ttytype file -- useful + * when htmp is somehow wrong. (V6 only) + * -u -- don't update htmp. It seemed like this should + * be put in. Note that htmp is never actually + * written if there are no changes, so don't bother + * bother using this for efficiency reasons alone. + * -s -- output setenv commands for TERM. This can be + * used with + * `tset -s ...` + * and is to be prefered to: + * setenv TERM `tset - ...` + * because -s sets the TERMCAP variable also. + * -S -- Similar to -s but outputs 2 strings suitable for + * use in csh .login files as follows: + * set noglob + * set term=(`tset -S .....`) + * setenv TERM $term[1] + * setenv TERMCAP "$term[2]" + * unset term + * unset noglob + * -Q -- be quiet. don't output 'Erase set to' etc. + * -I -- don't do terminal initialization (is & if + * strings). + * -v -- On virtual terminal systems, don't set up a + * virtual terminal. Otherwise tset will tell + * the operating system what kind of terminal you + * are on (if it is a known terminal) and fix up + * the output of -s to use virtual terminal sequences. + * + * Files: + * /etc/ttys + * contains a terminal id -> terminal type + * mapping; used when any user mapping is specified, + * or the environment doesn't have TERM set. + * /etc/termcap + * a terminal_type -> terminal_capabilities + * mapping. + * + * Return Codes: + * -1 -- couldn't open termcap. + * 1 -- bad terminal type, or standard output not tty. + * 0 -- ok. + * + * Defined Constants: + * DIALUP -- the type code for a dialup port. + * PLUGBOARD -- the type code for a plugboard port. + * ARPANET -- the type code for an arpanet port. + * BACKSPACE -- control-H, the default for -e. + * CNTL('U') -- control-U, the default for -k. + * OLDERASE -- the ancient default erase character. + * FILEDES -- the file descriptor to do the operation + * on, nominally 1 or 2. + * STDOUT -- the standard output file descriptor. + * UIDMASK -- the bit pattern to mask with the getuid() + * call to get just the user id. + * GTTYN -- defines file containing generalized ttynames + * and compiles code to look there. + * + * Requires: + * Routines to handle htmp, ttys, and termcap. + * + * Compilation Flags: + * OLDFLAGS -- must be defined to compile code for any of + * the -d, -p, or -a flags. + * OLDDIALUP -- accept the -d flag. + * OLDPLUGBOARD -- accept the -p flag. + * OLDARPANET -- accept the -a flag. + * V6 -- if clear, use environments, not htmp. + * also use TIOCSETN rather than stty to avoid flushing + * GTTYN -- if set, compiles code to look at /etc/ttys. + * + * Trace Flags: + * none + * + * Diagnostics: + * Bad flag + * An incorrect option was specified. + * Too few args + * more command line arguments are required. + * Unexpected arg + * wrong type of argument was encountered. + * Cannot open ... + * The specified file could not be openned. + * Type ... unknown + * An unknown terminal type was specified. + * Cannot update htmp + * Cannot update htmp file when the standard + * output is not a terminal. + * Erase set to ... + * Telling that the erase character has been + * set to the specified character. + * Kill set to ... + * Ditto for kill + * Erase is ... Kill is ... + * Tells that the erase/kill characters were + * wierd before, but they are being left as-is. + * Not a terminal + * Set if FILEDES is not a terminal. + * + * Compilation Instructions: + * cc -n -O tset.c -ltermlib + * mv a.out tset + * chown bin tset + * chmod 4755 tset + * + * where 'bin' should be whoever owns the 'htmp' file. + * If 'htmp' is 666, then tset need not be setuid. + * + * For version 6 the compile command should be: + * cc -n -O -I/usr/include/retrofit tset.c -ltermlib -lretro -lS + * + * + * History: + * 1/81 -- Added alias checking for mapping identifiers. + * 7/80 -- '-S' added. '-m' mapping added. TERMCAP string + * cleaned up. + * 3/80 -- Changed to use tputs. Prc & flush added. + * 10/79 -- '-s' option extended to handle TERMCAP + * variable, set noglob, quote the entry, + * and know about the Bourne shell. Terminal + * initialization moved to before any information + * output so screen clears would not screw you. + * '-Q' option added. + * 8/79 -- '-' option alone changed to only output + * type. '-s' option added. 'VERSION7' + * changed to 'V6' for compatibility. + * 12/78 -- modified for eventual migration to VAX/UNIX, + * so the '-' option is changed to output only + * the terminal type to STDOUT instead of + * FILEDES. + * 9/78 -- '-' and '-p' options added (now fully + * compatible with ttytype!), and spaces are + * permitted between the -d and the type. + * 8/78 -- The sense of -h and -u were reversed, and the + * -f flag is dropped -- same effect is available + * by just stating the terminal type. + * 10/77 -- Written. + */ -#define index strchr -#define rindex strrchr -#define curerase modes.c_cc[VERASE] -#define curkill modes.c_cc[VKILL] -#define curintr modes.c_cc[VINTR] -#define olderase oldmodes.c_cc[VERASE] -#define oldkill oldmodes.c_cc[VKILL] -#define oldintr oldmodes.c_cc[VINTR] +#define index strchr +#define rindex strrchr +#define curerase modes.c_cc[VERASE] +#define curkill modes.c_cc[VKILL] +#define curintr modes.c_cc[VINTR] +#define olderase oldmodes.c_cc[VERASE] +#define oldkill oldmodes.c_cc[VKILL] +#define oldintr oldmodes.c_cc[VINTR] #include <stdio.h> #include <termio.h> @@ -313,17 +311,14 @@ #define UIDMASK -1 -#define USAGE "usage: tset [-] [-rsIQS] [-eC] [-kC] [-iC] [-m [ident][test speed]:type] [type]\n" +#define USAGE "usage: tset [-] [-rsIQS] [-eC] [-kC] " \ + "[-iC] [-m [ident][test speed]:type] [type]\n" #define OLDFLAGS #define DIALUP "dialup" #define OLDDIALUP "sd" #define PLUGBOARD "plugboard" #define OLDPLUGBOARD "sp" -/* -#define ARPANET "arpanet" -#define OLDARPANET "sa" -*/ #define DEFTYPE "unknown" @@ -366,7 +361,7 @@ "75", B75, 75, "110", B110, 110, "134", B134, 134, - "134.5",B134, 134, + "134.5", B134, 134, "150", B150, 150, "200", B200, 200, "300", B300, 300, @@ -376,23 +371,24 @@ "2400", B2400, 2400, "4800", B4800, 4800, "9600", B9600, 9600, - "19200",EXTA, 19200, + "19200", EXTA, 19200, "exta", EXTA, 19200, "extb", EXTB, 38400, - "57600",B57600, 57600, - "76800",B76800, 76800, - "115200",B115200,115200, - "153600",B153600,153600, - "230400",B230400,230400, - "307200",B307200,307200, - "460800",B460800,460800, + "57600", B57600, 57600, + "76800", B76800, 76800, + "115200", B115200, 115200, + "153600", B153600, 153600, + "230400", B230400, 230400, + "307200", B307200, 307200, + "460800", B460800, 460800, + "921600", B921600, 921600, 0, }; signed char Erase_char; /* new erase character */ char Kill_char; /* new kill character */ char Intr_char; /* new interrupt character */ -char Specialerase; /* set => Erase_char only on terminals with backspace */ +char Specialerase; /* set => Erase_char only on terminals with backspace */ char Ttyid = NOTTY; /* terminal identifier */ char *TtyType; /* type of terminal */ @@ -413,7 +409,7 @@ int DoVirtTerm = YES; /* Set up a virtual terminal */ int PadBaud; /* Min rate of padding needed */ -#define CAPBUFSIZ 1024 +#define CAPBUFSIZ 1024 char Capbuf[CAPBUFSIZ]; /* line from /etc/termcap for this TtyType */ char *Ttycap; /* termcap line from termcap or environ */ @@ -446,7 +442,7 @@ void bmove(char *, char *, int); void makealias(char *); void wrtermcap(char *); -void fatal (char *, char *); +void fatal(char *, char *); char reset(); /* Routine for checking&resetting chars */ int @@ -474,20 +470,19 @@ extern short ospeed; if ((istermios = ioctl(FILEDES, TCGETS, (char *)&modes)) < 0) { - if (ioctl(FILEDES, TCGETA, (char *)&mode) < 0) - { + if (ioctl(FILEDES, TCGETA, (char *)&mode) < 0) { prs("Not a terminal\n"); exit(1); } - bmove((char *)&mode, (char *)&oldmode, sizeof mode); + bmove((char *)&mode, (char *)&oldmode, sizeof (mode)); modes.c_lflag = oldmodes.c_lflag = mode.c_lflag; modes.c_oflag = oldmodes.c_oflag = mode.c_oflag; modes.c_iflag = oldmodes.c_iflag = mode.c_iflag; modes.c_cflag = oldmodes.c_cflag = mode.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) modes.c_cc[i] = oldmodes.c_cc[i] = mode.c_cc[i]; } else - bmove((char *)&modes, (char *)&oldmodes, sizeof modes); + bmove((char *)&modes, (char *)&oldmodes, sizeof (modes)); ospeed = cfgetospeed(&modes); (void) signal(SIGINT, setmode); (void) signal(SIGQUIT, setmode); @@ -497,8 +492,7 @@ command++; else command = argv[0]; - if (sequal(command, "reset") ) - { + if (sequal(command, "reset")) { /* * Reset the teletype mode bits to a sensible state. * Copied from the program by Kurt Shoens & Mark Horton. @@ -510,7 +504,7 @@ modes.c_oflag = mode.c_oflag; modes.c_iflag = mode.c_iflag; modes.c_cflag = mode.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) modes.c_cc[i] = mode.c_cc[i]; } curerase = reset(curerase, CERASE); @@ -523,17 +517,17 @@ modes.c_iflag &= ~(IGNBRK|PARMRK|INPCK|INLCR|IGNCR|IUCLC|IXOFF); modes.c_oflag |= (OPOST|ONLCR); modes.c_oflag &= ~(OLCUC|OCRNL|ONOCR|ONLRET|OFILL|OFDEL| - NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); + NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); modes.c_cflag |= (CS7|CREAD); modes.c_cflag &= ~(PARODD|CLOCAL); modes.c_lflag |= (ISIG|ICANON|ECHO|ECHOK); modes.c_lflag &= ~(XCASE|ECHONL|NOFLSH); - if (istermios < 0) { + if (istermios < 0) { mode.c_lflag = modes.c_lflag; mode.c_oflag = modes.c_oflag; mode.c_iflag = modes.c_iflag; mode.c_cflag = modes.c_cflag; - for(i = 0; i < NCC; i++) + for (i = 0; i < NCC; i++) mode.c_cc[i] = modes.c_cc[i]; (void) ioctl(FILEDES, TCSETAW, (char *)&mode); } else @@ -541,38 +535,35 @@ Dash_u = YES; BeQuiet = YES; IsReset = YES; - } - else if (argc == 2 && sequal(argv[1], "-")) - { + } else if (argc == 2 && sequal(argv[1], "-")) { RepOnly = YES; Dash_u = YES; } argc--; /* scan argument list and collect flags */ - while (--argc >= 0) - { + while (--argc >= 0) { p = *++argv; - if (*p == '-') - { + if (*p == '-') { if (*++p == NULL) Report = YES; /* report current terminal type */ - else while (*p) switch (*p++) - { + else + while (*p) + switch (*p++) { - case 'r': /* report to user */ + case 'r': /* report to user */ Ureport = YES; continue; - case 'E': /* special erase: operate on all but TTY33 */ + case 'E': + /* special erase: operate on all but TTY33 */ Specialerase = YES; /* explicit fall-through to -e case */ - case 'e': /* erase character */ + case 'e': /* erase character */ if (*p == NULL) Erase_char = -1; - else - { + else { if (*p == '^' && p[1] != NULL) if (*++p == '?') Erase_char = '\177'; @@ -584,11 +575,10 @@ } continue; - case 'i': /* interrupt character */ + case 'i': /* interrupt character */ if (*p == NULL) Intr_char = CNTL('C'); - else - { + else { if (*p == '^' && p[1] != NULL) if (*++p == '?') Intr_char = '\177'; @@ -600,11 +590,10 @@ } continue; - case 'k': /* kill character */ + case 'k': /* kill character */ if (*p == NULL) Kill_char = CNTL('U'); - else - { + else { if (*p == '^' && p[1] != NULL) if (*++p == '?') Kill_char = '\177'; @@ -616,29 +605,28 @@ } continue; -# ifdef OLDFLAGS -# ifdef OLDDIALUP - case 'd': /* dialup type */ +#ifdef OLDFLAGS +#ifdef OLDDIALUP + case 'd': /* dialup type */ NewType = DIALUP; goto mapold; -# endif +#endif -# ifdef OLDPLUGBOARD - case 'p': /* plugboard type */ +#ifdef OLDPLUGBOARD + case 'p': /* plugboard type */ NewType = PLUGBOARD; goto mapold; -# endif +#endif -# ifdef OLDARPANET - case 'a': /* arpanet type */ +#ifdef OLDARPANET + case 'a': /* arpanet type */ Newtype = ARPANET; goto mapold; -# endif +#endif mapold: Map->Ident = NewType; Map->Test = ALL; - if (*p == NULL) - { + if (*p == NULL) { p = nextarg(argc--, argv++); } Map->Type = p; @@ -646,20 +634,19 @@ Mapped = YES; p = ""; continue; -# endif +#endif - case 'm': /* map identifier to type */ - /* This code is very loose. Almost no - ** syntax checking is done!! However, - ** illegal syntax will only produce - ** weird results. - */ - if (*p == NULL) - { + case 'm': /* map identifier to type */ + /* + * This code is very loose. Almost no + * syntax checking is done!! However, + * illegal syntax will only produce + * weird results. + */ + if (*p == NULL) { p = nextarg(argc--, argv++); } - if (isalnum(*p)) - { + if (isalnum(*p)) { Map->Ident = p; /* identifier */ while (isalnum(*p)) p++; } @@ -667,8 +654,8 @@ Map->Ident = ""; Break = NO; Not = NO; - while (!Break) switch (*p) - { + while (!Break) + switch (*p) { case NULL: p = nextarg(argc--, argv++); continue; @@ -693,7 +680,7 @@ Map->Test |= EQ; *p++ = NULL; continue; - + case '!': /* invert conditions */ Not = ~Not; *p++ = NULL; @@ -703,22 +690,20 @@ p++; /* intentional fallthru */ default: - if (isdigit(*p) || *p == 'e') - { - Map->Speed = baudrate(p); - while (isalnum(*p) || *p == '.') + if (isdigit(*p) || *p == 'e') { + Map->Speed = + baudrate(p); + while (isalnum(*p) || + *p == '.') p++; - } - else + } else Break = YES; continue; } - if (Not) /* invert sense of test */ - { + if (Not) { /* invert sense of test */ Map->Test = (~(Map->Test))&ALL; } - if (*p == NULL) - { + if (*p == NULL) { p = nextarg(argc--, argv++); } Map->Type = p; @@ -727,61 +712,56 @@ Mapped = YES; continue; - case 'h': /* don't get type from htmp or env */ + case 'h': /* don't get type from htmp or env */ Dash_h = YES; continue; - case 'u': /* don't update htmp */ + case 'u': /* don't update htmp */ Dash_u = YES; continue; - case 's': /* output setenv commands */ + case 's': /* output setenv commands */ DoSetenv = YES; CmndLine = YES; continue; - case 'S': /* output setenv strings */ + case 'S': /* output setenv strings */ DoSetenv = YES; CmndLine = NO; continue; - case 'Q': /* be quiet */ + case 'Q': /* be quiet */ BeQuiet = YES; continue; - case 'I': /* no initialization */ + case 'I': /* no initialization */ NoInit = YES; continue; - case 'A': /* Ask user */ + case 'A': /* Ask user */ Ask = YES; continue; - - case 'v': /* no virtual terminal */ + + case 'v': /* no virtual terminal */ DoVirtTerm = NO; continue; - default: + default: *p-- = NULL; fatal("Bad flag -", p); } - } - else - { + } else { /* terminal type */ DefType = p; } } - if (DefType) - { - if (Mapped) - { + if (DefType) { + if (Mapped) { Map->Ident = ""; /* means "map any type" */ Map->Test = ALL; /* at all baud rates */ Map->Type = DefType; /* to the default type */ - } - else + } else TtyType = DefType; } @@ -802,14 +782,12 @@ Ttyid = ttyname(FILEDES); /* If still undefined, use DEFTYPE */ - if (TtyType == 0) - { + if (TtyType == 0) { TtyType = DEFTYPE; } /* check for dialup or other mapping */ - if (Mapped) - { + if (Mapped) { if (!(Alias[0] && isalias(TtyType))) if (tgetent(Capbuf, TtyType) > 0) makealias(Capbuf); @@ -818,15 +796,13 @@ /* TtyType now contains a pointer to the type of the terminal */ /* If the first character is '?', ask the user */ - if (TtyType[0] == '?') - { + if (TtyType[0] == '?') { Ask = YES; TtyType++; if (TtyType[0] == '\0') TtyType = DEFTYPE; } - if (Ask) - { + if (Ask) { ask: prs("TERM = ("); prs(TtyType); @@ -834,9 +810,8 @@ flush(); /* read the terminal. If not empty, set type */ - i = read(2, termbuf, sizeof termbuf - 1); - if (i > 0) - { + i = read(2, termbuf, sizeof (termbuf) - 1); + if (i > 0) { if (termbuf[i - 1] == '\n') i--; termbuf[i] = '\0'; @@ -847,32 +822,28 @@ /* get terminal capabilities */ if (!(Alias[0] && isalias(TtyType))) { - switch (tgetent(Capbuf, TtyType)) - { - case -1: + switch (tgetent(Capbuf, TtyType)) { + case -1: prs("Cannot find termcap\n"); flush(); exit(-1); - case 0: + case 0: prs("Type "); prs(TtyType); prs(" unknown\n"); flush(); - if (DoSetenv) - { + if (DoSetenv) { TtyType = DEFTYPE; Alias[0] = '\0'; goto ask; - } - else + } else exit(1); } } Ttycap = Capbuf; - if (!RepOnly) - { + if (!RepOnly) { /* determine erase and kill characters */ if (Specialerase && !tgetflag("bs")) Erase_char = 0; @@ -892,8 +863,8 @@ * system set it there. People who want backspace have * to say tset -e. */ - if (Erase_char == 0 && !tgetflag("os") && curerase == OLDERASE) - { + if (Erase_char == 0 && !tgetflag("os") && + curerase == OLDERASE) { if (tgetflag("bs") || bs_char != 0) Erase_char = -1; } @@ -917,7 +888,7 @@ /* set modes */ PadBaud = tgetnum("pb"); /* OK if fails */ - for (i=0; speeds[i].string; i++) + for (i = 0; speeds[i].string; i++) if (speeds[i].baudrate == PadBaud) { PadBaud = speeds[i].speed; break; @@ -933,8 +904,7 @@ modes.c_iflag |= IUCLC; modes.c_oflag |= OLCUC; modes.c_cflag |= XCASE; - } - else if (tgetflag("LC")) { + } else if (tgetflag("LC")) { modes.c_iflag &= ~IUCLC; modes.c_oflag &= ~OLCUC; modes.c_cflag &= ~XCASE; @@ -964,10 +934,9 @@ modes.c_lflag &= ~ECHO; if (tgetflag("pt")) /* print tabs */ modes.c_oflag &= ~TAB3; - + modes.c_lflag |= (ECHOE|ECHOK); - if (tgetflag("hc")) - { /** set printer modes **/ + if (tgetflag("hc")) { /* set printer modes */ modes.c_lflag &= ~ECHOE; } @@ -977,10 +946,8 @@ PC = buf[0]; /* output startup string */ - if (!NoInit) - { - if (oldmodes.c_oflag&(TAB3|ONLCR|OCRNL|ONLRET)) - { + if (!NoInit) { + if (oldmodes.c_oflag&(TAB3|ONLCR|OCRNL|ONLRET)) { oldmodes.c_oflag &= (TAB3|ONLCR|OCRNL|ONLRET); setmode(-1); } @@ -989,22 +956,19 @@ flush(); } bufp = buf; - if (IsReset && tgetstr("rs", &bufp) != 0 || - tgetstr("is", &bufp) != 0) - { + if (IsReset && tgetstr("rs", &bufp) != 0 || + tgetstr("is", &bufp) != 0) { tputs(buf, 0, prc); settle = YES; flush(); } bufp = buf; if (IsReset && tgetstr("rf", &bufp) != 0 || - tgetstr("if", &bufp) != 0) - { + tgetstr("if", &bufp) != 0) { cat(buf); settle = YES; } - if (settle) - { + if (settle) { prc('\r'); if (IsReset) prc('\n'); /* newline too */ @@ -1019,80 +983,69 @@ /* (this code is rather heuristic, checking for $SHELL */ /* ending in the 3 characters "csh") */ csh = NO; - if (DoSetenv) - { + if (DoSetenv) { char *sh; - if ((sh = getenv("SHELL")) && (i = strlen(sh)) >= 3) - { - if ((csh = sequal(&sh[i-3], "csh")) && CmndLine) - (void) write(STDOUT, "set noglob;\n", 12); + if ((sh = getenv("SHELL")) && (i = strlen(sh)) >= 3) { + if ((csh = sequal(&sh[i-3], "csh")) && CmndLine) + (void) write(STDOUT, + "set noglob;\n", 12); } - if (!csh) - /* running Bourne shell */ - (void) write(STDOUT, "export TERMCAP TERM;\n", 21); + if (!csh) { /* running Bourne shell */ + (void) write(STDOUT, + "export TERMCAP TERM;\n", 21); + } } } /* report type if appropriate */ - if (DoSetenv || Report || Ureport) - { + if (DoSetenv || Report || Ureport) { /* if type is the short name, find first alias (if any) */ makealias(Ttycap); if (sequal(TtyType, Alias[0]) && Alias[1]) { TtyType = Alias[1]; } - if (DoSetenv) - { - if (csh) - { + if (DoSetenv) { + if (csh) { if (CmndLine) - (void) write(STDOUT, "setenv TERM ", 12); + (void) write(STDOUT, + "setenv TERM ", 12); (void) write(STDOUT, TtyType, strlen(TtyType)); (void) write(STDOUT, " ", 1); if (CmndLine) - (void) write(STDOUT, ";\n", 2); - } - else - { + (void) write(STDOUT, ";\n", 2); + } else { (void) write(STDOUT, "TERM=", 5); (void) write(STDOUT, TtyType, strlen(TtyType)); (void) write(STDOUT, ";\n", 2); } - } - else if (Report) - { + } else if (Report) { (void) write(STDOUT, TtyType, strlen(TtyType)); (void) write(STDOUT, "\n", 1); } - if (Ureport) - { + if (Ureport) { prs("Terminal type is "); prs(TtyType); prs("\n"); flush(); } - if (DoSetenv) - { - if (csh) - { - if (CmndLine) - (void) write(STDOUT, "setenv TERMCAP '", 16); - } - else - (void) write(STDOUT, "TERMCAP='", 9); + if (DoSetenv) { + if (csh) { + if (CmndLine) + (void) write(STDOUT, + "setenv TERMCAP '", 16); + } else + (void) write(STDOUT, "TERMCAP='", 9); wrtermcap(Ttycap); - if (csh) - { - if (CmndLine) - { - (void) write(STDOUT, "';\n", 3); - (void) write(STDOUT, "unset noglob;\n", 14); + if (csh) { + if (CmndLine) { + (void) write(STDOUT, "';\n", 3); + (void) write(STDOUT, + "unset noglob;\n", 14); } - } - else + } else (void) write(STDOUT, "';\n", 3); } } @@ -1137,7 +1090,7 @@ if (set_tab) { columns = tgetnum("co"); lines = tgetnum("li"); - for (c=0; c<columns; c += 8) { + for (c = 0; c < columns; c += 8) { /* get to that column. */ tg_out = "OOPS"; /* also returned by tgoto */ if (set_column) @@ -1159,13 +1112,14 @@ return (0); } -void setmode(flag) -int flag; -/* flag serves several purposes: +/* + * flag serves several purposes: * if called as the result of a signal, flag will be > 0. * if called from terminal init, flag == -1 means reset "oldmode". * called with flag == 0 at end of normal mode processing. */ +void +setmode(int flag) { struct termio *ttymode; struct termios *ttymodes; @@ -1176,38 +1130,38 @@ if (flag < 0) { /* unconditionally reset oldmode (called from init) */ if (istermios < 0) { - oldmode.c_lflag = oldmodes.c_lflag; - oldmode.c_oflag = oldmodes.c_oflag; - oldmode.c_iflag = oldmodes.c_iflag; - oldmode.c_cflag = oldmodes.c_cflag; - for(i = 0; i < NCC; i++) - oldmode.c_cc[i] = oldmodes.c_cc[i]; - ttymode = &oldmode; + oldmode.c_lflag = oldmodes.c_lflag; + oldmode.c_oflag = oldmodes.c_oflag; + oldmode.c_iflag = oldmodes.c_iflag; + oldmode.c_cflag = oldmodes.c_cflag; + for (i = 0; i < NCC; i++) + oldmode.c_cc[i] = oldmodes.c_cc[i]; + ttymode = &oldmode; } else - ttymodes = &oldmodes; + ttymodes = &oldmodes; } else { if (istermios < 0) { - oldmode.c_lflag = oldmodes.c_lflag; - oldmode.c_oflag = oldmodes.c_oflag; - oldmode.c_iflag = oldmodes.c_iflag; - oldmode.c_cflag = oldmodes.c_cflag; - for(i = 0; i < NCC; i++) - oldmode.c_cc[i] = oldmodes.c_cc[i]; - mode.c_lflag = modes.c_lflag; - mode.c_oflag = modes.c_oflag; - mode.c_iflag = modes.c_iflag; - mode.c_cflag = modes.c_cflag; - for(i = 0; i < NCC; i++) - mode.c_cc[i] = modes.c_cc[i]; - if (!bequal((char *)&mode, (char *)&oldmode, sizeof mode)) + oldmode.c_lflag = oldmodes.c_lflag; + oldmode.c_oflag = oldmodes.c_oflag; + oldmode.c_iflag = oldmodes.c_iflag; + oldmode.c_cflag = oldmodes.c_cflag; + for (i = 0; i < NCC; i++) + oldmode.c_cc[i] = oldmodes.c_cc[i]; + mode.c_lflag = modes.c_lflag; + mode.c_oflag = modes.c_oflag; + mode.c_iflag = modes.c_iflag; + mode.c_cflag = modes.c_cflag; + for (i = 0; i < NCC; i++) + mode.c_cc[i] = modes.c_cc[i]; + if (!bequal((char *)&mode, (char *)&oldmode, + sizeof (mode))) ttymode = &mode; } else if (!bequal((char *)&modes, (char *)&oldmodes, - sizeof modes)) - ttymodes = &modes; + sizeof (modes))) + ttymodes = &modes; } - - if (ttymode) - { + + if (ttymode) { (void) ioctl(FILEDES, TCSETAW, (char *)ttymode); } else if (ttymodes) { (void) ioctl(FILEDES, TCSETSW, (char *)ttymodes); @@ -1243,10 +1197,8 @@ prs("Backspace\n"); else if (n == 0177) prs("Delete\n"); - else - { - if (n < 040) - { + else { + if (n < 040) { prs("Ctrl-"); n ^= 0100; } @@ -1278,10 +1230,8 @@ *flags &= ~bits; /* scan dtab for first entry with adequate delay */ - for (p = dtab; p->d_delay >= 0; p++) - { - if (p->d_delay >= i) - { + for (p = dtab; p->d_delay >= 0; p++) { + if (p->d_delay >= i) { p++; break; } @@ -1306,7 +1256,7 @@ prc(char c) { OutBuf[OutPtr++] = c; - if (OutPtr >= sizeof OutBuf) + if (OutPtr >= sizeof (OutBuf)) flush(); } @@ -1326,8 +1276,7 @@ char buf[BUFSIZ]; fd = open(file, 0); - if (fd < 0) - { + if (fd < 0) { prs("Cannot open "); prs(file); prs("\n"); @@ -1367,8 +1316,7 @@ p = a; q = b; - while ((*p == *q) && --i > 0) - { + while ((*p == *q) && --i > 0) { p++; q++; } return ((*p == *q) && i >= 0); @@ -1379,8 +1327,7 @@ { char *p = a, *q = b; - while (*p && *q && (*p == *q)) - { + while (*p && *q && (*p == *q)) { p++; q++; } return (*p == *q); @@ -1401,15 +1348,15 @@ *a++ = NULL; Alias[i++] = a; b++; - } - else + } else *a++ = *b++; } *a = NULL; Alias[i] = NULL; -# ifdef DEB - for(i = 0; Alias[i]; printf("A:%s\n", Alias[i++])); -# endif +#ifdef DEB + for (i = 0; Alias[i]; printf("A:%s\n", Alias[i++])) + ; +#endif } int @@ -1420,10 +1367,10 @@ if (*a) while (*a) if (sequal(ident, *a)) - return(YES); + return (YES); else a++; - return(NO); + return (NO); } @@ -1444,13 +1391,13 @@ int space, empty; /* discard names with blanks */ -/** May not be desireable ? **/ +/* May not be desireable ? */ while (*bp && *bp != ':') { if (*bp == '|') { tp = bp+1; space = NO; while (*tp && *tp != '|' && *tp != ':') { - space = (space || WHITE(*tp) ); + space = (space || WHITE(*tp)); tp++; } if (space) { @@ -1460,15 +1407,15 @@ } *p++ = *bp++; } -/**/ +/* */ while (*bp) { switch (*bp) { case ':': /* discard empty, cancelled or dupl fields */ - tp = bp+1; + tp = bp + 1; empty = YES; while (*tp && *tp != ':') { - empty = (empty && WHITE(*tp) ); + empty = (empty && WHITE(*tp)); tp++; } if (empty || cancelled(bp+1)) { @@ -1514,7 +1461,7 @@ *p++ = *bp++; } *p++ = ':'; /* we skipped the last : with the : lookahead hack */ - (void) write (STDOUT, buf, p-buf); + (void) write(STDOUT, buf, p-buf); } int @@ -1522,8 +1469,7 @@ { int i; - for (i = 0; i < ncap; i++) - { + for (i = 0; i < ncap; i++) { if (cap[0] == delcap[i][0] && cap[1] == delcap[i][1]) return (YES); } @@ -1568,7 +1514,7 @@ while (i < 7 && (isalnum(*p) || *p == '.')) buf[i++] = *p++; buf[i] = NULL; - for (i=0; speeds[i].string; i++) + for (i = 0; speeds[i].string; i++) if (sequal(speeds[i].string, buf)) return (speeds[i].speed); return (-1); @@ -1581,46 +1527,44 @@ extern short ospeed; int match; -# ifdef DEB - printf ("spd:%d\n", ospeed); +#ifdef DEB + printf("spd:%d\n", ospeed); prmap(); -# endif +#endif Map = map; - while (Map->Ident) - { - if (*(Map->Ident) == NULL || sequal(Map->Ident, type) || isalias(Map->Ident)) - { + while (Map->Ident) { + if (*(Map->Ident) == NULL || + sequal(Map->Ident, type) || isalias(Map->Ident)) { match = NO; - switch (Map->Test) - { - case ANY: /* no test specified */ - case ALL: - match = YES; - break; - - case GT: - match = (ospeed > Map->Speed); - break; + switch (Map->Test) { + case ANY: /* no test specified */ + case ALL: + match = YES; + break; - case GE: - match = (ospeed >= Map->Speed); - break; + case GT: + match = (ospeed > Map->Speed); + break; + + case GE: + match = (ospeed >= Map->Speed); + break; - case EQ: - match = (ospeed == Map->Speed); - break; + case EQ: + match = (ospeed == Map->Speed); + break; - case LE: - match = (ospeed <= Map->Speed); - break; + case LE: + match = (ospeed <= Map->Speed); + break; - case LT: - match = (ospeed < Map->Speed); - break; + case LT: + match = (ospeed < Map->Speed); + break; - case NE: - match = (ospeed != Map->Speed); - break; + case NE: + match = (ospeed != Map->Speed); + break; } if (match) return (Map->Type); @@ -1631,18 +1575,17 @@ return (type); } -# ifdef DEB +#ifdef DEB prmap() { Map = map; - while (Map->Ident) - { - printf ("%s t:%d s:%d %s\n", - Map->Ident, Map->Test, Map->Speed, Map->Type); - Map++; + while (Map->Ident) { + printf("%s t:%d s:%d %s\n", + Map->Ident, Map->Test, Map->Speed, Map->Type); + Map++; } } -# endif +#endif char * nextarg(argc, argv) @@ -1650,19 +1593,19 @@ char *argv[]; { if (argc <= 0) - fatal ("Too few args: ", *argv); + fatal("Too few args: ", *argv); if (*(*++argv) == '-') - fatal ("Unexpected arg: ", *argv); + fatal("Unexpected arg: ", *argv); return (*argv); } void -fatal (char *mesg, char *obj) +fatal(char *mesg, char *obj) { - prs (mesg); - prs (obj); - prc ('\n'); - prs (USAGE); + prs(mesg); + prs(obj); + prc('\n'); + prs(USAGE); flush(); exit(1); } @@ -1676,8 +1619,7 @@ char ch; int def; { - if (ch == 0 || (ch&0377) == 0377) - return def; - return ch; + return (def); + return (ch); }
--- a/usr/src/uts/Makefile.uts Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/Makefile.uts Sun Apr 12 10:48:30 2009 -0700 @@ -427,6 +427,7 @@ ROOT_KGSS_DIR_32 = $(ROOT_MOD_DIR)/misc/kgss ROOT_SCSI_VHCI_DIR_32 = $(ROOT_MOD_DIR)/misc/scsi_vhci ROOT_QLC_FW_DIR_32 = $(ROOT_MOD_DIR)/misc/qlc + ROOT_EMLXS_FW_DIR_32 = $(ROOT_MOD_DIR)/misc/emlxs ROOT_NLMISC_DIR_32 = $(ROOT_MOD_DIR)/misc ROOT_MACH_DIR_32 = $(ROOT_MOD_DIR)/mach @@ -669,8 +670,15 @@ # MPSAS support # MPSAS_BUILD:sh= echo \\043 + # # Privilege files # PRIVS_AWK = $(SRC)/uts/common/os/privs.awk PRIVS_DEF = $(SRC)/uts/common/os/priv_defs + +# +# USB device data +# +USBDEVS_AWK = $(SRC)/uts/common/io/usb/usbdevs2h.awk +USBDEVS_DATA = $(SRC)/uts/common/io/usb/usbdevs
--- a/usr/src/uts/common/Makefile.files Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/Makefile.files Sun Apr 12 10:48:30 2009 -0700 @@ -691,6 +691,8 @@ USBSPRL_OBJS += usbser_pl2303.o pl2303_dsd.o +USBFTDI_OBJS += usbser_uftdi.o uftdi_dsd.o + WC_OBJS += wscons.o vcons.o VCONS_CONF_OBJS += vcons_conf.o
--- a/usr/src/uts/common/Makefile.rules Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/Makefile.rules Sun Apr 12 10:48:30 2009 -0700 @@ -988,6 +988,10 @@ $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) +$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/usb/clients/usbser/usbftdi/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/usb/clients/usbser/usbser_keyspan/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) @@ -2002,6 +2006,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/usb/clients/usbser/usbsacm/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) +$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/usb/clients/usbser/usbftdi/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/usb/clients/usbser/usbser_keyspan/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL))
--- a/usr/src/uts/common/io/consconfig_dacf.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/io/consconfig_dacf.c Sun Apr 12 10:48:30 2009 -0700 @@ -219,11 +219,10 @@ /* * Baud rate table */ -#define MAX_SPEEDS 24 static struct speed { char *name; int code; -} speedtab[MAX_SPEEDS] = { +} speedtab[] = { {"0", B0}, {"50", B50}, {"75", B75}, {"110", B110}, {"134", B134}, {"150", B150}, {"200", B200}, {"300", B300}, {"600", B600}, @@ -231,9 +230,12 @@ {"4800", B4800}, {"9600", B9600}, {"19200", B19200}, {"38400", B38400}, {"57600", B57600}, {"76800", B76800}, {"115200", B115200}, {"153600", B153600}, {"230400", B230400}, - {"307200", B307200}, {"460800", B460800}, {"", 0} + {"307200", B307200}, {"460800", B460800}, {"921600", B921600}, + {"", 0} }; +static const int MAX_SPEEDS = sizeof (speedtab) / sizeof (speedtab[0]); + static dacf_op_t kbconfig_op[] = { { DACF_OPID_POSTATTACH, kb_config }, { DACF_OPID_PREDETACH, kb_unconfig }, @@ -2111,7 +2113,7 @@ * Copy message to a kernel buffer. Various kernel routines * expect buffer to be above kernelbase */ - kc = defcons_kern_buf = (char *)kmem_zalloc(MMU_PAGESIZE, KM_SLEEP); + kc = defcons_kern_buf = kmem_zalloc(MMU_PAGESIZE, KM_SLEEP); bc = (char *)(uintptr_t)defcons_buf; while (*kc++ = *bc++) ;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/clients/usbser/usbftdi/uftdi_dsd.c Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,1946 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * FTDI FT232R USB UART device-specific driver + * + * May work on the (many) devices based on earlier versions of the chip. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/conf.h> +#include <sys/stream.h> +#include <sys/strsun.h> +#include <sys/termio.h> +#include <sys/termiox.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +#define USBDRV_MAJOR_VER 2 +#define USBDRV_MINOR_VER 0 + +#include <sys/usb/usba.h> +#include <sys/usb/usba/usba_types.h> +#include <sys/usb/usba/usba_impl.h> + +#include <sys/usb/clients/usbser/usbser_dsdi.h> +#include <sys/usb/clients/usbser/usbftdi/uftdi_var.h> +#include <sys/usb/clients/usbser/usbftdi/uftdi_reg.h> + +#include <sys/usb/usbdevs.h> + +/* + * DSD operations + */ +static int uftdi_attach(ds_attach_info_t *); +static void uftdi_detach(ds_hdl_t); +static int uftdi_register_cb(ds_hdl_t, uint_t, ds_cb_t *); +static void uftdi_unregister_cb(ds_hdl_t, uint_t); +static int uftdi_open_port(ds_hdl_t, uint_t); +static int uftdi_close_port(ds_hdl_t, uint_t); + +/* power management */ +static int uftdi_usb_power(ds_hdl_t, int, int, int *); +static int uftdi_suspend(ds_hdl_t); +static int uftdi_resume(ds_hdl_t); +static int uftdi_disconnect(ds_hdl_t); +static int uftdi_reconnect(ds_hdl_t); + +/* standard UART operations */ +static int uftdi_set_port_params(ds_hdl_t, uint_t, ds_port_params_t *); +static int uftdi_set_modem_ctl(ds_hdl_t, uint_t, int, int); +static int uftdi_get_modem_ctl(ds_hdl_t, uint_t, int, int *); +static int uftdi_break_ctl(ds_hdl_t, uint_t, int); + +/* data xfer */ +static int uftdi_tx(ds_hdl_t, uint_t, mblk_t *); +static mblk_t *uftdi_rx(ds_hdl_t, uint_t); +static void uftdi_stop(ds_hdl_t, uint_t, int); +static void uftdi_start(ds_hdl_t, uint_t, int); +static int uftdi_fifo_flush(ds_hdl_t, uint_t, int); +static int uftdi_fifo_drain(ds_hdl_t, uint_t, int); + +/* polled I/O support */ +static usb_pipe_handle_t uftdi_out_pipe(ds_hdl_t, uint_t); +static usb_pipe_handle_t uftdi_in_pipe(ds_hdl_t, uint_t); + +/* + * Sub-routines + */ + +/* configuration routines */ +static void uftdi_cleanup(uftdi_state_t *, int); +static int uftdi_dev_attach(uftdi_state_t *); +static int uftdi_open_hw_port(uftdi_state_t *, int, int); + +/* hotplug */ +static int uftdi_restore_device_state(uftdi_state_t *); +static int uftdi_restore_port_state(uftdi_state_t *, int); + +/* power management */ +static int uftdi_create_pm_components(uftdi_state_t *); +static void uftdi_destroy_pm_components(uftdi_state_t *); +static int uftdi_pm_set_busy(uftdi_state_t *); +static void uftdi_pm_set_idle(uftdi_state_t *); +static int uftdi_pwrlvl0(uftdi_state_t *); +static int uftdi_pwrlvl1(uftdi_state_t *); +static int uftdi_pwrlvl2(uftdi_state_t *); +static int uftdi_pwrlvl3(uftdi_state_t *); + +/* pipe operations */ +static int uftdi_open_pipes(uftdi_state_t *); +static void uftdi_close_pipes(uftdi_state_t *); +static void uftdi_disconnect_pipes(uftdi_state_t *); +static int uftdi_reconnect_pipes(uftdi_state_t *); + +/* pipe callbacks */ +static void uftdi_bulkin_cb(usb_pipe_handle_t, usb_bulk_req_t *); +static void uftdi_bulkout_cb(usb_pipe_handle_t, usb_bulk_req_t *); + +/* data transfer routines */ +static int uftdi_rx_start(uftdi_state_t *); +static void uftdi_tx_start(uftdi_state_t *, int *); +static int uftdi_send_data(uftdi_state_t *, mblk_t *); +static int uftdi_wait_tx_drain(uftdi_state_t *, int); + +/* vendor-specific commands */ +static int uftdi_cmd_vendor_write0(uftdi_state_t *, + uint16_t, uint16_t, uint16_t); + +/* misc */ +static void uftdi_put_tail(mblk_t **, mblk_t *); +static void uftdi_put_head(mblk_t **, mblk_t *); + + +/* + * DSD ops structure + */ +ds_ops_t uftdi_ds_ops = { + DS_OPS_VERSION, + uftdi_attach, + uftdi_detach, + uftdi_register_cb, + uftdi_unregister_cb, + uftdi_open_port, + uftdi_close_port, + uftdi_usb_power, + uftdi_suspend, + uftdi_resume, + uftdi_disconnect, + uftdi_reconnect, + uftdi_set_port_params, + uftdi_set_modem_ctl, + uftdi_get_modem_ctl, + uftdi_break_ctl, + NULL, /* no loopback support */ + uftdi_tx, + uftdi_rx, + uftdi_stop, + uftdi_start, + uftdi_fifo_flush, + uftdi_fifo_drain, + uftdi_out_pipe, + uftdi_in_pipe +}; + +/* debug support */ +static uint_t uftdi_errlevel = USB_LOG_L4; +static uint_t uftdi_errmask = DPRINT_MASK_ALL; +static uint_t uftdi_instance_debug = (uint_t)-1; +static uint_t uftdi_attach_unrecognized = B_FALSE; + +/* + * ds_attach + */ +static int +uftdi_attach(ds_attach_info_t *aip) +{ + uftdi_state_t *uf; + usb_dev_descr_t *dd; + int recognized; + + uf = kmem_zalloc(sizeof (*uf), KM_SLEEP); + uf->uf_dip = aip->ai_dip; + uf->uf_usb_events = aip->ai_usb_events; + *aip->ai_hdl = (ds_hdl_t)uf; + + /* only one port */ + *aip->ai_port_cnt = 1; + + if (usb_client_attach(uf->uf_dip, USBDRV_VERSION, 0) != USB_SUCCESS) { + uftdi_cleanup(uf, 1); + return (USB_FAILURE); + } + + if (usb_get_dev_data(uf->uf_dip, + &uf->uf_dev_data, USB_PARSE_LVL_IF, 0) != USB_SUCCESS) { + uftdi_cleanup(uf, 2); + return (USB_FAILURE); + } + + mutex_init(&uf->uf_lock, NULL, MUTEX_DRIVER, + uf->uf_dev_data->dev_iblock_cookie); + + cv_init(&uf->uf_tx_cv, NULL, CV_DRIVER, NULL); + + uf->uf_lh = usb_alloc_log_hdl(uf->uf_dip, "uftdi", + &uftdi_errlevel, &uftdi_errmask, &uftdi_instance_debug, 0); + + /* + * This device and its clones has numerous physical instantiations. + */ + recognized = B_TRUE; + dd = uf->uf_dev_data->dev_descr; + switch (dd->idVendor) { + case USB_VENDOR_FTDI: + switch (dd->idProduct) { + case USB_PRODUCT_FTDI_SERIAL_8U232AM: + case USB_PRODUCT_FTDI_SEMC_DSS20: + case USB_PRODUCT_FTDI_CFA_631: + case USB_PRODUCT_FTDI_CFA_632: + case USB_PRODUCT_FTDI_CFA_633: + case USB_PRODUCT_FTDI_CFA_634: + case USB_PRODUCT_FTDI_CFA_635: + case USB_PRODUCT_FTDI_USBSERIAL: + case USB_PRODUCT_FTDI_MX2_3: + case USB_PRODUCT_FTDI_MX4_5: + case USB_PRODUCT_FTDI_LK202: + case USB_PRODUCT_FTDI_LK204: + case USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13M: + case USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13S: + case USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13U: + case USB_PRODUCT_FTDI_EISCOU: + case USB_PRODUCT_FTDI_UOPTBR: + case USB_PRODUCT_FTDI_EMCU2D: + case USB_PRODUCT_FTDI_PCMSFU: + case USB_PRODUCT_FTDI_EMCU2H: + break; + default: + recognized = B_FALSE; + break; + } + break; + case USB_VENDOR_SIIG2: + switch (dd->idProduct) { + case USB_PRODUCT_SIIG2_US2308: + break; + default: + recognized = B_FALSE; + break; + } + break; + case USB_VENDOR_INTREPIDCS: + switch (dd->idProduct) { + case USB_PRODUCT_INTREPIDCS_VALUECAN: + case USB_PRODUCT_INTREPIDCS_NEOVI: + break; + default: + recognized = B_FALSE; + break; + } + break; + case USB_VENDOR_BBELECTRONICS: + switch (dd->idProduct) { + case USB_PRODUCT_BBELECTRONICS_USOTL4: + break; + default: + recognized = B_FALSE; + break; + } + break; + case USB_VENDOR_MELCO: + switch (dd->idProduct) { + case USB_PRODUCT_MELCO_PCOPRS1: + break; + default: + recognized = B_FALSE; + break; + } + break; + default: + recognized = B_FALSE; + break; + } + + /* + * Set 'uftdi_attach_unrecognized' to non-zero to + * experiment with newer devices .. + */ + if (!recognized && !uftdi_attach_unrecognized) { + uftdi_cleanup(uf, 3); + return (USB_FAILURE); + } + + USB_DPRINTF_L3(DPRINT_ATTACH, uf->uf_lh, + "uftdi: matched vendor 0x%x product 0x%x", + dd->idVendor, dd->idProduct); + + uf->uf_def_ph = uf->uf_dev_data->dev_default_ph; + + mutex_enter(&uf->uf_lock); + uf->uf_dev_state = USB_DEV_ONLINE; + uf->uf_port_state = UFTDI_PORT_CLOSED; + mutex_exit(&uf->uf_lock); + + if (uftdi_create_pm_components(uf) != USB_SUCCESS) { + uftdi_cleanup(uf, 3); + return (USB_FAILURE); + } + + if (usb_register_event_cbs(uf->uf_dip, + uf->uf_usb_events, 0) != USB_SUCCESS) { + uftdi_cleanup(uf, 4); + return (USB_FAILURE); + } + + if (usb_pipe_get_max_bulk_transfer_size(uf->uf_dip, + &uf->uf_xfer_sz) != USB_SUCCESS) { + uftdi_cleanup(uf, 5); + return (USB_FAILURE); + } + + /* + * TODO: modern ftdi devices have deeper (and asymmetric) + * fifos than this minimal 64 bytes .. but how to tell + * -safely- ? + */ + +#define FTDI_MAX_XFERSIZE 64 + + if (uf->uf_xfer_sz > FTDI_MAX_XFERSIZE) + uf->uf_xfer_sz = FTDI_MAX_XFERSIZE; + + if (uftdi_dev_attach(uf) != USB_SUCCESS) { + uftdi_cleanup(uf, 5); + return (USB_FAILURE); + } + + return (USB_SUCCESS); +} + +#define FTDI_CLEANUP_LEVEL_MAX 6 + +/* + * ds_detach + */ +static void +uftdi_detach(ds_hdl_t hdl) +{ + uftdi_cleanup((uftdi_state_t *)hdl, FTDI_CLEANUP_LEVEL_MAX); +} + + +/* + * ds_register_cb + */ +/*ARGSUSED*/ +static int +uftdi_register_cb(ds_hdl_t hdl, uint_t portno, ds_cb_t *cb) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + uf->uf_cb = *cb; + return (USB_SUCCESS); +} + + +/* + * ds_unregister_cb + */ +/*ARGSUSED*/ +static void +uftdi_unregister_cb(ds_hdl_t hdl, uint_t portno) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + bzero(&uf->uf_cb, sizeof (uf->uf_cb)); +} + + +/* + * ds_open_port + */ +/*ARGSUSED*/ +static int +uftdi_open_port(ds_hdl_t hdl, uint_t portno) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int rval; + + USB_DPRINTF_L4(DPRINT_OPEN, uf->uf_lh, "uftdi_open_port %d", portno); + + mutex_enter(&uf->uf_lock); + if (uf->uf_dev_state == USB_DEV_DISCONNECTED || + uf->uf_port_state != UFTDI_PORT_CLOSED) { + mutex_exit(&uf->uf_lock); + return (USB_FAILURE); + } + mutex_exit(&uf->uf_lock); + + if ((rval = uftdi_pm_set_busy(uf)) != USB_SUCCESS) + return (rval); + + /* initialize hardware serial port */ + rval = uftdi_open_hw_port(uf, portno, 0); + + if (rval == USB_SUCCESS) { + mutex_enter(&uf->uf_lock); + + /* start to receive data */ + if (uftdi_rx_start(uf) != USB_SUCCESS) { + mutex_exit(&uf->uf_lock); + return (USB_FAILURE); + } + uf->uf_port_state = UFTDI_PORT_OPEN; + mutex_exit(&uf->uf_lock); + } else + uftdi_pm_set_idle(uf); + + return (rval); +} + + +/* + * ds_close_port + */ +/*ARGSUSED*/ +static int +uftdi_close_port(ds_hdl_t hdl, uint_t portno) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_CLOSE, uf->uf_lh, "uftdi_close_port %d", portno); + + mutex_enter(&uf->uf_lock); + + /* free resources and finalize state */ + freemsg(uf->uf_rx_mp); + uf->uf_rx_mp = NULL; + + freemsg(uf->uf_tx_mp); + uf->uf_tx_mp = NULL; + + uf->uf_port_state = UFTDI_PORT_CLOSED; + mutex_exit(&uf->uf_lock); + + uftdi_pm_set_idle(uf); + + return (USB_SUCCESS); +} + + +/* + * ds_usb_power + */ +/*ARGSUSED*/ +static int +uftdi_usb_power(ds_hdl_t hdl, int comp, int level, int *new_state) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + uftdi_pm_t *pm = uf->uf_pm; + int rval; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_usb_power"); + + if (!pm) + return (USB_FAILURE); + + mutex_enter(&uf->uf_lock); + + /* + * check if we are transitioning to a legal power level + */ + if (USB_DEV_PWRSTATE_OK(pm->pm_pwr_states, level)) { + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, "uftdi_usb_power: " + "illegal power level %d, pwr_states=0x%x", + level, pm->pm_pwr_states); + mutex_exit(&uf->uf_lock); + return (USB_FAILURE); + } + + /* + * if we are about to raise power and asked to lower power, fail + */ + if (pm->pm_raise_power && (level < (int)pm->pm_cur_power)) { + mutex_exit(&uf->uf_lock); + return (USB_FAILURE); + } + + switch (level) { + case USB_DEV_OS_PWR_OFF: + rval = uftdi_pwrlvl0(uf); + break; + case USB_DEV_OS_PWR_1: + rval = uftdi_pwrlvl1(uf); + break; + case USB_DEV_OS_PWR_2: + rval = uftdi_pwrlvl2(uf); + break; + case USB_DEV_OS_FULL_PWR: + rval = uftdi_pwrlvl3(uf); + /* + * If usbser dev_state is DISCONNECTED or SUSPENDED, it shows + * that the usb serial device is disconnected/suspended while it + * is under power down state, now the device is powered up + * before it is reconnected/resumed. xxx_pwrlvl3() will set dev + * state to ONLINE, we need to set the dev state back to + * DISCONNECTED/SUSPENDED. + */ + if (rval == USB_SUCCESS && + (*new_state == USB_DEV_DISCONNECTED || + *new_state == USB_DEV_SUSPENDED)) + uf->uf_dev_state = *new_state; + break; + default: + ASSERT(0); /* cannot happen */ + } + + *new_state = uf->uf_dev_state; + mutex_exit(&uf->uf_lock); + + return (rval); +} + + +/* + * ds_suspend + */ +static int +uftdi_suspend(ds_hdl_t hdl) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int state = USB_DEV_SUSPENDED; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_suspend"); + + /* + * If the device is suspended while it is under PWRED_DOWN state, we + * need to keep the PWRED_DOWN state so that it could be powered up + * later. In the mean while, usbser dev state will be changed to + * SUSPENDED state. + */ + mutex_enter(&uf->uf_lock); + if (uf->uf_dev_state != USB_DEV_PWRED_DOWN) + uf->uf_dev_state = USB_DEV_SUSPENDED; + mutex_exit(&uf->uf_lock); + + uftdi_disconnect_pipes(uf); + return (state); +} + + +/* + * ds_resume + */ +static int +uftdi_resume(ds_hdl_t hdl) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int current_state; + int rval; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_resume"); + + mutex_enter(&uf->uf_lock); + current_state = uf->uf_dev_state; + mutex_exit(&uf->uf_lock); + + if (current_state == USB_DEV_ONLINE) + rval = USB_SUCCESS; + else + rval = uftdi_restore_device_state(uf); + return (rval); +} + + +/* + * ds_disconnect + */ +static int +uftdi_disconnect(ds_hdl_t hdl) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int state = USB_DEV_DISCONNECTED; + + USB_DPRINTF_L4(DPRINT_HOTPLUG, uf->uf_lh, "uftdi_disconnect"); + + /* + * If the device is disconnected while it is under PWRED_DOWN state, we + * need to keep the PWRED_DOWN state so that it could be powered up + * later. In the mean while, usbser dev state will be changed to + * DISCONNECTED state. + */ + mutex_enter(&uf->uf_lock); + if (uf->uf_dev_state != USB_DEV_PWRED_DOWN) + uf->uf_dev_state = USB_DEV_DISCONNECTED; + mutex_exit(&uf->uf_lock); + + uftdi_disconnect_pipes(uf); + return (state); +} + + +/* + * ds_reconnect + */ +static int +uftdi_reconnect(ds_hdl_t hdl) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_HOTPLUG, uf->uf_lh, "uftdi_reconnect"); + return (uftdi_restore_device_state(uf)); +} + +/* translate parameters into device-specific bits */ + +static int +uftdi_param2regs(uftdi_state_t *uf, ds_port_params_t *tp, uftdi_regs_t *ur) +{ + ds_port_param_entry_t *pe; + int i; + + ur->ur_data = 0; + ur->ur_flowval = 0; + ur->ur_flowidx = FTDI_SIO_DISABLE_FLOW_CTRL << 8; + + for (i = 0, pe = tp->tp_entries; i < tp->tp_cnt; i++, pe++) { + switch (pe->param) { + case DS_PARAM_BAUD: + switch (pe->val.ui) { + case B300: + ur->ur_baud = ftdi_8u232am_b300; + break; + case B600: + ur->ur_baud = ftdi_8u232am_b600; + break; + case B1200: + ur->ur_baud = ftdi_8u232am_b1200; + break; + case B2400: + ur->ur_baud = ftdi_8u232am_b2400; + break; + case B4800: + ur->ur_baud = ftdi_8u232am_b4800; + break; + case B9600: + ur->ur_baud = ftdi_8u232am_b9600; + break; + case B19200: + ur->ur_baud = ftdi_8u232am_b19200; + break; + case B38400: + ur->ur_baud = ftdi_8u232am_b38400; + break; + case B57600: + ur->ur_baud = ftdi_8u232am_b57600; + break; + case B115200: + ur->ur_baud = ftdi_8u232am_b115200; + break; + case B230400: + ur->ur_baud = ftdi_8u232am_b230400; + break; + case B460800: + ur->ur_baud = ftdi_8u232am_b460800; + break; + case B921600: + ur->ur_baud = ftdi_8u232am_b921600; + break; + default: + USB_DPRINTF_L3(DPRINT_CTLOP, uf->uf_lh, + "uftdi_param2regs: bad baud %d", + pe->val.ui); + return (USB_FAILURE); + } + break; + + case DS_PARAM_PARITY: + if (pe->val.ui & PARENB) { + if (pe->val.ui & PARODD) + ur->ur_data |= + FTDI_SIO_SET_DATA_PARITY_ODD; + else + ur->ur_data |= + FTDI_SIO_SET_DATA_PARITY_EVEN; + } else { + /* LINTED [E_EXPR_NULL_EFFECT] */ + ur->ur_data |= FTDI_SIO_SET_DATA_PARITY_NONE; + } + break; + + case DS_PARAM_STOPB: + if (pe->val.ui & CSTOPB) + ur->ur_data |= FTDI_SIO_SET_DATA_STOP_BITS_2; + else { + /* LINTED [E_EXPR_NULL_EFFECT] */ + ur->ur_data |= FTDI_SIO_SET_DATA_STOP_BITS_1; + } + break; + + case DS_PARAM_CHARSZ: + switch (pe->val.ui) { + case CS5: + ur->ur_data |= FTDI_SIO_SET_DATA_BITS(5); + break; + case CS6: + ur->ur_data |= FTDI_SIO_SET_DATA_BITS(6); + break; + case CS7: + ur->ur_data |= FTDI_SIO_SET_DATA_BITS(7); + break; + case CS8: + default: + ur->ur_data |= FTDI_SIO_SET_DATA_BITS(8); + break; + } + break; + + case DS_PARAM_XON_XOFF: /* Software flow control */ + if ((pe->val.ui & IXON) || (pe->val.ui & IXOFF)) { + uint8_t xonc = pe->val.uc[0]; + uint8_t xoffc = pe->val.uc[1]; + + ur->ur_flowval = (xoffc << 8) | xonc; + ur->ur_flowidx = FTDI_SIO_XON_XOFF_HS << 8; + } + break; + + case DS_PARAM_FLOW_CTL: /* Hardware flow control */ + if (pe->val.ui & (RTSXOFF | CTSXON)) { + ur->ur_flowval = 0; + ur->ur_flowidx = FTDI_SIO_RTS_CTS_HS << 8; + } + if (pe->val.ui & DTRXOFF) { + ur->ur_flowval = 0; + ur->ur_flowidx = FTDI_SIO_DTR_DSR_HS << 8; + } + break; + default: + USB_DPRINTF_L2(DPRINT_CTLOP, uf->uf_lh, + "uftdi_param2regs: bad param %d", pe->param); + break; + } + } + return (USB_SUCCESS); +} + +/* + * Write the register set to the device and update the state structure. + * If there are errors, return the device to its previous state. + */ +static int +uftdi_setregs(uftdi_state_t *uf, uint_t portno, uftdi_regs_t *ur) +{ + int rval; + uftdi_regs_t uold; + + mutex_enter(&uf->uf_lock); + uold = uf->uf_softr; + mutex_exit(&uf->uf_lock); + + if (ur == NULL) + ur = &uold; /* NULL => restore previous values */ + + rval = uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_BAUD_RATE, + ur->ur_baud, portno); + if (rval != USB_SUCCESS) { + (void) uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_BAUD_RATE, + uold.ur_baud, portno); + goto out; + } else { + mutex_enter(&uf->uf_lock); + uf->uf_softr.ur_baud = ur->ur_baud; + mutex_exit(&uf->uf_lock); + } + + rval = uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_DATA, + ur->ur_data, portno); + if (rval != USB_SUCCESS) { + (void) uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_DATA, + uold.ur_data, portno); + goto out; + } else { + mutex_enter(&uf->uf_lock); + uf->uf_softr.ur_data = ur->ur_data; + mutex_exit(&uf->uf_lock); + } + + rval = uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_FLOW_CTRL, + ur->ur_flowval, ur->ur_flowidx | portno); + if (rval != USB_SUCCESS) { + (void) uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_FLOW_CTRL, + uold.ur_flowval, uold.ur_flowidx | portno); + goto out; + } else { + mutex_enter(&uf->uf_lock); + uf->uf_softr.ur_flowval = ur->ur_flowval; + uf->uf_softr.ur_flowidx = ur->ur_flowidx; + mutex_exit(&uf->uf_lock); + } +out: + return (rval); +} + +/* + * ds_set_port_params + */ +static int +uftdi_set_port_params(ds_hdl_t hdl, uint_t portno, ds_port_params_t *tp) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int rval; + uftdi_regs_t uregs; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_set_port_params"); + + rval = uftdi_param2regs(uf, tp, &uregs); + if (rval == USB_SUCCESS) + rval = uftdi_setregs(uf, portno, &uregs); + return (rval); +} + +/* + * ds_set_modem_ctl + */ +static int +uftdi_set_modem_ctl(ds_hdl_t hdl, uint_t portno, int mask, int val) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int rval; + uint16_t mctl; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_set_modem_ctl"); + + /* + * Note that we cannot set DTR and RTS simultaneously, so + * we do separate operations for each bit. + */ + + if (mask & TIOCM_DTR) { + mctl = (val & TIOCM_DTR) ? + FTDI_SIO_SET_DTR_HIGH : FTDI_SIO_SET_DTR_LOW; + + rval = uftdi_cmd_vendor_write0(uf, + FTDI_SIO_MODEM_CTRL, mctl, portno); + + if (rval == USB_SUCCESS) { + mutex_enter(&uf->uf_lock); + uf->uf_mctl &= ~FTDI_SIO_SET_DTR_HIGH; + uf->uf_mctl |= mctl & FTDI_SIO_SET_DTR_HIGH; + mutex_exit(&uf->uf_lock); + } else + return (rval); + } + + if (mask & TIOCM_RTS) { + mctl = (val & TIOCM_RTS) ? + FTDI_SIO_SET_RTS_HIGH : FTDI_SIO_SET_RTS_LOW; + + rval = uftdi_cmd_vendor_write0(uf, + FTDI_SIO_MODEM_CTRL, mctl, portno); + + if (rval == USB_SUCCESS) { + mutex_enter(&uf->uf_lock); + uf->uf_mctl &= ~FTDI_SIO_SET_RTS_HIGH; + uf->uf_mctl |= mctl & FTDI_SIO_SET_RTS_HIGH; + mutex_exit(&uf->uf_lock); + } + } + + return (rval); +} + +/* + * ds_get_modem_ctl + */ +static int +uftdi_get_modem_ctl(ds_hdl_t hdl, uint_t portno, int mask, int *valp) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + uint_t val = 0; + + ASSERT(portno == 0); + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_get_modem_ctl"); + + mutex_enter(&uf->uf_lock); + /* + * This status info is delivered to us at least every 40ms + * while the receive pipe is active + */ + if (uf->uf_msr & FTDI_MSR_STATUS_CTS) + val |= TIOCM_CTS; + if (uf->uf_msr & FTDI_MSR_STATUS_DSR) + val |= TIOCM_DSR; + if (uf->uf_msr & FTDI_MSR_STATUS_RI) + val |= TIOCM_RI; + if (uf->uf_msr & FTDI_MSR_STATUS_RLSD) + val |= TIOCM_CD; + + /* + * Note, this status info is simply a replay of what we + * asked it to be in some previous "set" command, and + * is *not* directly sensed from the hardware. + */ + if ((uf->uf_mctl & FTDI_SIO_SET_RTS_HIGH) == FTDI_SIO_SET_RTS_HIGH) + val |= TIOCM_RTS; + if ((uf->uf_mctl & FTDI_SIO_SET_DTR_HIGH) == FTDI_SIO_SET_DTR_HIGH) + val |= TIOCM_DTR; + mutex_exit(&uf->uf_lock); + + *valp = val & mask; + + return (USB_SUCCESS); +} + + +/* + * ds_break_ctl + */ +static int +uftdi_break_ctl(ds_hdl_t hdl, uint_t portno, int ctl) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + uftdi_regs_t *ur = &uf->uf_softr; + uint16_t data; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_break_ctl"); + + mutex_enter(&uf->uf_lock); + data = ur->ur_data | (ctl == DS_ON) ? FTDI_SIO_SET_BREAK : 0; + mutex_exit(&uf->uf_lock); + + return (uftdi_cmd_vendor_write0(uf, FTDI_SIO_SET_DATA, + data, portno)); +} + + +/* + * ds_tx + */ +/*ARGSUSED*/ +static int +uftdi_tx(ds_hdl_t hdl, uint_t portno, mblk_t *mp) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_tx"); + + ASSERT(mp != NULL && MBLKL(mp) >= 1); + + mutex_enter(&uf->uf_lock); + uftdi_put_tail(&uf->uf_tx_mp, mp); /* add to the chain */ + uftdi_tx_start(uf, NULL); + mutex_exit(&uf->uf_lock); + + return (USB_SUCCESS); +} + + +/* + * ds_rx + */ +/*ARGSUSED*/ +static mblk_t * +uftdi_rx(ds_hdl_t hdl, uint_t portno) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + mblk_t *mp; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_rx"); + + mutex_enter(&uf->uf_lock); + mp = uf->uf_rx_mp; + uf->uf_rx_mp = NULL; + mutex_exit(&uf->uf_lock); + + return (mp); +} + + +/* + * ds_stop + */ +/*ARGSUSED*/ +static void +uftdi_stop(ds_hdl_t hdl, uint_t portno, int dir) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_stop"); + + if (dir & DS_TX) { + mutex_enter(&uf->uf_lock); + uf->uf_port_flags |= UFTDI_PORT_TX_STOPPED; + mutex_exit(&uf->uf_lock); + } +} + + +/* + * ds_start + */ +/*ARGSUSED*/ +static void +uftdi_start(ds_hdl_t hdl, uint_t portno, int dir) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_start"); + + if (dir & DS_TX) { + mutex_enter(&uf->uf_lock); + if (uf->uf_port_flags & UFTDI_PORT_TX_STOPPED) { + uf->uf_port_flags &= ~UFTDI_PORT_TX_STOPPED; + uftdi_tx_start(uf, NULL); + } + mutex_exit(&uf->uf_lock); + } +} + + +/* + * ds_fifo_flush + */ +/*ARGSUSED*/ +static int +uftdi_fifo_flush(ds_hdl_t hdl, uint_t portno, int dir) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, + "uftdi_fifo_flush: dir=0x%x", dir); + + mutex_enter(&uf->uf_lock); + ASSERT(uf->uf_port_state == UFTDI_PORT_OPEN); + + if (dir & DS_TX) { + freemsg(uf->uf_tx_mp); + uf->uf_tx_mp = NULL; + } + + if (dir & DS_RX) { + freemsg(uf->uf_rx_mp); + uf->uf_rx_mp = NULL; + } + mutex_exit(&uf->uf_lock); + + if (dir & DS_TX) + (void) uftdi_cmd_vendor_write0(uf, + FTDI_SIO_RESET, FTDI_SIO_RESET_PURGE_TX, portno); + + if (dir & DS_RX) + (void) uftdi_cmd_vendor_write0(uf, + FTDI_SIO_RESET, FTDI_SIO_RESET_PURGE_RX, portno); + + return (USB_SUCCESS); +} + + +/* + * ds_fifo_drain + */ +/*ARGSUSED*/ +static int +uftdi_fifo_drain(ds_hdl_t hdl, uint_t portno, int timeout) +{ + uftdi_state_t *uf = (uftdi_state_t *)hdl; + int rval = USB_SUCCESS; + + USB_DPRINTF_L4(DPRINT_CTLOP, uf->uf_lh, "uftdi_fifo_drain"); + + mutex_enter(&uf->uf_lock); + ASSERT(uf->uf_port_state == UFTDI_PORT_OPEN); + + if (uftdi_wait_tx_drain(uf, 0) != USB_SUCCESS) { + mutex_exit(&uf->uf_lock); + return (USB_FAILURE); + } + + mutex_exit(&uf->uf_lock); + + /* wait 500 ms until hw fifo drains */ + delay(drv_usectohz(500*1000)); + + return (rval); +} + + +/* + * configuration clean up + */ +static void +uftdi_cleanup(uftdi_state_t *uf, int level) +{ + ASSERT(level > 0 && level <= UFTDI_CLEANUP_LEVEL_MAX); + + switch (level) { + default: + case 6: + uftdi_close_pipes(uf); + /*FALLTHROUGH*/ + case 5: + usb_unregister_event_cbs(uf->uf_dip, uf->uf_usb_events); + /*FALLTHROUGH*/ + case 4: + uftdi_destroy_pm_components(uf); + /*FALLTHROUGH*/ + case 3: + mutex_destroy(&uf->uf_lock); + cv_destroy(&uf->uf_tx_cv); + + usb_free_log_hdl(uf->uf_lh); + uf->uf_lh = NULL; + + usb_free_descr_tree(uf->uf_dip, uf->uf_dev_data); + uf->uf_def_ph = NULL; + /*FALLTHROUGH*/ + case 2: + usb_client_detach(uf->uf_dip, uf->uf_dev_data); + /*FALLTHROUGH*/ + case 1: + kmem_free(uf, sizeof (*uf)); + break; + } +} + + +/* + * device specific attach + */ +static int +uftdi_dev_attach(uftdi_state_t *uf) +{ + return (uftdi_open_pipes(uf)); +} + + +/* + * restore device state after CPR resume or reconnect + */ +static int +uftdi_restore_device_state(uftdi_state_t *uf) +{ + int state; + + mutex_enter(&uf->uf_lock); + state = uf->uf_dev_state; + mutex_exit(&uf->uf_lock); + + if (state != USB_DEV_DISCONNECTED && state != USB_DEV_SUSPENDED) + return (state); + + if (usb_check_same_device(uf->uf_dip, uf->uf_lh, USB_LOG_L0, + DPRINT_MASK_ALL, USB_CHK_ALL, NULL) != USB_SUCCESS) { + mutex_enter(&uf->uf_lock); + state = uf->uf_dev_state = USB_DEV_DISCONNECTED; + mutex_exit(&uf->uf_lock); + return (state); + } + + if (state == USB_DEV_DISCONNECTED) { + USB_DPRINTF_L0(DPRINT_HOTPLUG, uf->uf_lh, + "Device has been reconnected but data may have been lost"); + } + + if (uftdi_reconnect_pipes(uf) != USB_SUCCESS) + return (state); + + /* + * init device state + */ + mutex_enter(&uf->uf_lock); + state = uf->uf_dev_state = USB_DEV_ONLINE; + mutex_exit(&uf->uf_lock); + + if ((uftdi_restore_port_state(uf, 0) != USB_SUCCESS)) { + USB_DPRINTF_L2(DPRINT_HOTPLUG, uf->uf_lh, + "uftdi_restore_device_state: failed"); + } + + return (state); +} + + +/* + * restore ports state after CPR resume or reconnect + */ +static int +uftdi_restore_port_state(uftdi_state_t *uf, int portno) +{ + int rval; + + mutex_enter(&uf->uf_lock); + if (uf->uf_port_state != UFTDI_PORT_OPEN) { + mutex_exit(&uf->uf_lock); + return (USB_SUCCESS); + } + mutex_exit(&uf->uf_lock); + + /* open hardware serial port, restoring old settings */ + if ((rval = uftdi_open_hw_port(uf, portno, 1)) != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_HOTPLUG, uf->uf_lh, + "uftdi_restore_port_state: failed"); + } + + return (rval); +} + + +/* + * create PM components + */ +static int +uftdi_create_pm_components(uftdi_state_t *uf) +{ + dev_info_t *dip = uf->uf_dip; + uftdi_pm_t *pm; + uint_t pwr_states; + + if (usb_create_pm_components(dip, &pwr_states) != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, + "uftdi_create_pm_components: failed"); + return (USB_SUCCESS); + } + + pm = uf->uf_pm = kmem_zalloc(sizeof (*pm), KM_SLEEP); + + pm->pm_pwr_states = (uint8_t)pwr_states; + pm->pm_cur_power = USB_DEV_OS_FULL_PWR; + pm->pm_wakeup_enabled = usb_handle_remote_wakeup(dip, + USB_REMOTE_WAKEUP_ENABLE) == USB_SUCCESS; + + (void) pm_raise_power(dip, 0, USB_DEV_OS_FULL_PWR); + + return (USB_SUCCESS); +} + + +/* + * destroy PM components + */ +static void +uftdi_destroy_pm_components(uftdi_state_t *uf) +{ + uftdi_pm_t *pm = uf->uf_pm; + dev_info_t *dip = uf->uf_dip; + int rval; + + if (!pm) + return; + + if (uf->uf_dev_state != USB_DEV_DISCONNECTED) { + if (pm->pm_wakeup_enabled) { + rval = pm_raise_power(dip, 0, USB_DEV_OS_FULL_PWR); + if (rval != DDI_SUCCESS) { + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, + "uftdi_destroy_pm_components: " + "raising power failed, rval=%d", rval); + } + rval = usb_handle_remote_wakeup(dip, + USB_REMOTE_WAKEUP_DISABLE); + if (rval != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, + "uftdi_destroy_pm_components: disable " + "remote wakeup failed, rval=%d", rval); + } + } + (void) pm_lower_power(dip, 0, USB_DEV_OS_PWR_OFF); + } + kmem_free(pm, sizeof (*pm)); + uf->uf_pm = NULL; +} + + +/* + * mark device busy and raise power + */ +static int +uftdi_pm_set_busy(uftdi_state_t *uf) +{ + uftdi_pm_t *pm = uf->uf_pm; + dev_info_t *dip = uf->uf_dip; + int rval; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pm_set_busy"); + + if (!pm) + return (USB_SUCCESS); + + mutex_enter(&uf->uf_lock); + /* if already marked busy, just increment the counter */ + if (pm->pm_busy_cnt++ > 0) { + mutex_exit(&uf->uf_lock); + return (USB_SUCCESS); + } + + rval = pm_busy_component(dip, 0); + ASSERT(rval == DDI_SUCCESS); + + if (pm->pm_cur_power == USB_DEV_OS_FULL_PWR) { + mutex_exit(&uf->uf_lock); + return (USB_SUCCESS); + } + + /* need to raise power */ + pm->pm_raise_power = B_TRUE; + mutex_exit(&uf->uf_lock); + + rval = pm_raise_power(dip, 0, USB_DEV_OS_FULL_PWR); + if (rval != DDI_SUCCESS) { + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, "raising power failed"); + } + + mutex_enter(&uf->uf_lock); + pm->pm_raise_power = B_FALSE; + mutex_exit(&uf->uf_lock); + + return (USB_SUCCESS); +} + + +/* + * mark device idle + */ +static void +uftdi_pm_set_idle(uftdi_state_t *uf) +{ + uftdi_pm_t *pm = uf->uf_pm; + dev_info_t *dip = uf->uf_dip; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pm_set_idle"); + + if (!pm) + return; + + /* + * if more ports use the device, do not mark as yet + */ + mutex_enter(&uf->uf_lock); + if (--pm->pm_busy_cnt > 0) { + mutex_exit(&uf->uf_lock); + return; + } + (void) pm_idle_component(dip, 0); + mutex_exit(&uf->uf_lock); +} + + +/* + * Functions to handle power transition for OS levels 0 -> 3 + * The same level as OS state, different from USB state + */ +static int +uftdi_pwrlvl0(uftdi_state_t *uf) +{ + int rval; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pwrlvl0"); + + switch (uf->uf_dev_state) { + case USB_DEV_ONLINE: + /* issue USB D3 command to the device */ + rval = usb_set_device_pwrlvl3(uf->uf_dip); + ASSERT(rval == USB_SUCCESS); + + uf->uf_dev_state = USB_DEV_PWRED_DOWN; + uf->uf_pm->pm_cur_power = USB_DEV_OS_PWR_OFF; + + /*FALLTHROUGH*/ + case USB_DEV_DISCONNECTED: + case USB_DEV_SUSPENDED: + /* allow a disconnect/cpr'ed device to go to lower power */ + return (USB_SUCCESS); + case USB_DEV_PWRED_DOWN: + default: + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, + "uftdi_pwrlvl0: illegal device state"); + return (USB_FAILURE); + } +} + + +static int +uftdi_pwrlvl1(uftdi_state_t *uf) +{ + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pwrlvl1"); + + /* issue USB D2 command to the device */ + (void) usb_set_device_pwrlvl2(uf->uf_dip); + return (USB_FAILURE); +} + + +static int +uftdi_pwrlvl2(uftdi_state_t *uf) +{ + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pwrlvl2"); + + /* issue USB D1 command to the device */ + (void) usb_set_device_pwrlvl1(uf->uf_dip); + return (USB_FAILURE); +} + + +static int +uftdi_pwrlvl3(uftdi_state_t *uf) +{ + int rval; + + USB_DPRINTF_L4(DPRINT_PM, uf->uf_lh, "uftdi_pwrlvl3"); + + switch (uf->uf_dev_state) { + case USB_DEV_PWRED_DOWN: + /* Issue USB D0 command to the device here */ + rval = usb_set_device_pwrlvl0(uf->uf_dip); + ASSERT(rval == USB_SUCCESS); + + uf->uf_dev_state = USB_DEV_ONLINE; + uf->uf_pm->pm_cur_power = USB_DEV_OS_FULL_PWR; + + /*FALLTHROUGH*/ + case USB_DEV_ONLINE: + /* we are already in full power */ + + /*FALLTHROUGH*/ + case USB_DEV_DISCONNECTED: + case USB_DEV_SUSPENDED: + return (USB_SUCCESS); + default: + USB_DPRINTF_L2(DPRINT_PM, uf->uf_lh, + "uftdi_pwrlvl3: illegal device state"); + return (USB_FAILURE); + } +} + + +/* + * pipe operations + */ +static int +uftdi_open_pipes(uftdi_state_t *uf) +{ + int ifc, alt; + usb_pipe_policy_t policy; + usb_ep_data_t *in_data, *out_data; + + /* get ep data */ + ifc = uf->uf_dev_data->dev_curr_if; + alt = 0; + + in_data = usb_lookup_ep_data(uf->uf_dip, uf->uf_dev_data, ifc, alt, + 0, USB_EP_ATTR_BULK, USB_EP_DIR_IN); + + out_data = usb_lookup_ep_data(uf->uf_dip, uf->uf_dev_data, ifc, alt, + 0, USB_EP_ATTR_BULK, USB_EP_DIR_OUT); + + if (in_data == NULL || out_data == NULL) { + USB_DPRINTF_L2(DPRINT_ATTACH, uf->uf_lh, + "uftdi_open_pipes: can't get ep data"); + return (USB_FAILURE); + } + + /* open pipes */ + policy.pp_max_async_reqs = 2; + + if (usb_pipe_open(uf->uf_dip, &in_data->ep_descr, &policy, + USB_FLAGS_SLEEP, &uf->uf_bulkin_ph) != USB_SUCCESS) + return (USB_FAILURE); + + if (usb_pipe_open(uf->uf_dip, &out_data->ep_descr, &policy, + USB_FLAGS_SLEEP, &uf->uf_bulkout_ph) != USB_SUCCESS) { + usb_pipe_close(uf->uf_dip, uf->uf_bulkin_ph, USB_FLAGS_SLEEP, + NULL, NULL); + return (USB_FAILURE); + } + + mutex_enter(&uf->uf_lock); + uf->uf_bulkin_state = UFTDI_PIPE_IDLE; + uf->uf_bulkout_state = UFTDI_PIPE_IDLE; + mutex_exit(&uf->uf_lock); + + return (USB_SUCCESS); +} + + +static void +uftdi_close_pipes(uftdi_state_t *uf) +{ + if (uf->uf_bulkin_ph) + usb_pipe_close(uf->uf_dip, uf->uf_bulkin_ph, + USB_FLAGS_SLEEP, 0, 0); + if (uf->uf_bulkout_ph) + usb_pipe_close(uf->uf_dip, uf->uf_bulkout_ph, + USB_FLAGS_SLEEP, 0, 0); + + mutex_enter(&uf->uf_lock); + uf->uf_bulkin_state = UFTDI_PIPE_CLOSED; + uf->uf_bulkout_state = UFTDI_PIPE_CLOSED; + mutex_exit(&uf->uf_lock); +} + + +static void +uftdi_disconnect_pipes(uftdi_state_t *uf) +{ + uftdi_close_pipes(uf); +} + + +static int +uftdi_reconnect_pipes(uftdi_state_t *uf) +{ + return (uftdi_open_pipes(uf)); +} + +/* + * bulk in pipe normal and exception callback handler + */ +/*ARGSUSED*/ +static void +uftdi_bulkin_cb(usb_pipe_handle_t pipe, usb_bulk_req_t *req) +{ + uftdi_state_t *uf = (uftdi_state_t *)req->bulk_client_private; + mblk_t *data; + int data_len; + int notify = 0; + + data = req->bulk_data; + data_len = data ? MBLKL(data) : 0; + + /* + * The first two bytes of data are actually status register bytes + * that arrive with every packet from the device. Strip + * them here before handing the data on. Note that the device + * will send us these bytes at least every 40 milliseconds, + * even if there's no data .. + */ + if (req->bulk_completion_reason == USB_CR_OK && data_len >= 2) { + uint8_t msr = FTDI_GET_MSR(data->b_rptr); + uint8_t lsr = FTDI_GET_LSR(data->b_rptr); + + mutex_enter(&uf->uf_lock); + if (uf->uf_msr != msr || + (uf->uf_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK)) { + USB_DPRINTF_L3(DPRINT_IN_PIPE, uf->uf_lh, + "uftdi_bulkin_cb: status change " + "0x%02x.0x%02x, was 0x%02x.0x%02x", + msr, lsr, uf->uf_msr, uf->uf_lsr); + uf->uf_msr = msr; + uf->uf_lsr = lsr; + /* + * If we're waiting for a modem status change, + * sending an empty message will cause us to + * reexamine the modem flags. + */ + notify = 1; + } + mutex_exit(&uf->uf_lock); + + data_len -= 2; + data->b_rptr += 2; + } + + notify |= (data_len > 0); + + USB_DPRINTF_L4(DPRINT_IN_PIPE, uf->uf_lh, "uftdi_bulkin_cb: " + "cr=%d len=%d", req->bulk_completion_reason, data_len); + + /* save data and notify GSD */ + if (notify && uf->uf_port_state == UFTDI_PORT_OPEN && + req->bulk_completion_reason == USB_CR_OK) { + req->bulk_data = NULL; + uftdi_put_tail(&uf->uf_rx_mp, data); + if (uf->uf_cb.cb_rx) + uf->uf_cb.cb_rx(uf->uf_cb.cb_arg); + } + + usb_free_bulk_req(req); + + /* receive more */ + mutex_enter(&uf->uf_lock); + uf->uf_bulkin_state = UFTDI_PIPE_IDLE; + if (uf->uf_port_state == UFTDI_PORT_OPEN && + uf->uf_dev_state == USB_DEV_ONLINE) { + if (uftdi_rx_start(uf) != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_IN_PIPE, uf->uf_lh, + "uftdi_bulkin_cb: restart rx fail"); + } + } + mutex_exit(&uf->uf_lock); +} + + +/* + * bulk out common and exception callback + */ +/*ARGSUSED*/ +static void +uftdi_bulkout_cb(usb_pipe_handle_t pipe, usb_bulk_req_t *req) +{ + uftdi_state_t *uf = (uftdi_state_t *)req->bulk_client_private; + int data_len; + mblk_t *data = req->bulk_data; + + data_len = data ? MBLKL(data) : 0; + + USB_DPRINTF_L4(DPRINT_OUT_PIPE, uf->uf_lh, + "uftdi_bulkout_cb: cr=%d len=%d", + req->bulk_completion_reason, data_len); + + if (uf->uf_port_state == UFTDI_PORT_OPEN && + req->bulk_completion_reason && data_len > 0) { + uftdi_put_head(&uf->uf_tx_mp, data); + req->bulk_data = NULL; + } + + usb_free_bulk_req(req); + + /* notify GSD */ + if (uf->uf_cb.cb_tx) + uf->uf_cb.cb_tx(uf->uf_cb.cb_arg); + + /* send more */ + mutex_enter(&uf->uf_lock); + uf->uf_bulkout_state = UFTDI_PIPE_IDLE; + if (uf->uf_tx_mp == NULL) + cv_broadcast(&uf->uf_tx_cv); + else + uftdi_tx_start(uf, NULL); + mutex_exit(&uf->uf_lock); +} + + +/* + * start receiving data + */ +static int +uftdi_rx_start(uftdi_state_t *uf) +{ + usb_bulk_req_t *br; + int rval; + + USB_DPRINTF_L4(DPRINT_OUT_PIPE, uf->uf_lh, "uftdi_rx_start"); + + ASSERT(mutex_owned(&uf->uf_lock)); + + uf->uf_bulkin_state = UFTDI_PIPE_BUSY; + mutex_exit(&uf->uf_lock); + + br = usb_alloc_bulk_req(uf->uf_dip, uf->uf_xfer_sz, USB_FLAGS_SLEEP); + br->bulk_len = uf->uf_xfer_sz; + br->bulk_timeout = UFTDI_BULKIN_TIMEOUT; + br->bulk_cb = uftdi_bulkin_cb; + br->bulk_exc_cb = uftdi_bulkin_cb; + br->bulk_client_private = (usb_opaque_t)uf; + br->bulk_attributes = USB_ATTRS_AUTOCLEARING | USB_ATTRS_SHORT_XFER_OK; + + rval = usb_pipe_bulk_xfer(uf->uf_bulkin_ph, br, 0); + + if (rval != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_IN_PIPE, uf->uf_lh, + "uftdi_rx_start: xfer failed %d", rval); + usb_free_bulk_req(br); + } + + mutex_enter(&uf->uf_lock); + if (rval != USB_SUCCESS) + uf->uf_bulkin_state = UFTDI_PIPE_IDLE; + + return (rval); +} + + +/* + * start data transmit + */ +static void +uftdi_tx_start(uftdi_state_t *uf, int *xferd) +{ + int len; /* bytes we can transmit */ + mblk_t *data; /* data to be transmitted */ + int data_len; /* bytes in 'data' */ + mblk_t *mp; /* current msgblk */ + int copylen; /* bytes copy from 'mp' to 'data' */ + int rval; + + USB_DPRINTF_L4(DPRINT_OUT_PIPE, uf->uf_lh, "uftdi_tx_start"); + ASSERT(mutex_owned(&uf->uf_lock)); + ASSERT(uf->uf_port_state != UFTDI_PORT_CLOSED); + + if (xferd) + *xferd = 0; + if ((uf->uf_port_flags & UFTDI_PORT_TX_STOPPED) || + uf->uf_tx_mp == NULL) { + return; + } + if (uf->uf_bulkout_state != UFTDI_PIPE_IDLE) { + USB_DPRINTF_L4(DPRINT_OUT_PIPE, uf->uf_lh, + "uftdi_tx_start: pipe busy"); + return; + } + ASSERT(MBLKL(uf->uf_tx_mp) > 0); + + /* send as much data as port can receive */ + len = min(msgdsize(uf->uf_tx_mp), uf->uf_xfer_sz); + + if (len <= 0) + return; + if ((data = allocb(len, BPRI_LO)) == NULL) + return; + + /* + * copy no more than 'len' bytes from mblk chain to transmit mblk 'data' + */ + data_len = 0; + while (data_len < len && uf->uf_tx_mp) { + mp = uf->uf_tx_mp; + copylen = min(MBLKL(mp), len - data_len); + bcopy(mp->b_rptr, data->b_wptr, copylen); + mp->b_rptr += copylen; + data->b_wptr += copylen; + data_len += copylen; + + if (MBLKL(mp) < 1) { + uf->uf_tx_mp = unlinkb(mp); + freeb(mp); + } else { + ASSERT(data_len == len); + } + } + + ASSERT(data_len > 0); + + uf->uf_bulkout_state = UFTDI_PIPE_BUSY; + mutex_exit(&uf->uf_lock); + + rval = uftdi_send_data(uf, data); + mutex_enter(&uf->uf_lock); + + if (rval != USB_SUCCESS) { + uf->uf_bulkout_state = UFTDI_PIPE_IDLE; + uftdi_put_head(&uf->uf_tx_mp, data); + } else { + if (xferd) + *xferd = data_len; + } +} + + +static int +uftdi_send_data(uftdi_state_t *uf, mblk_t *data) +{ + usb_bulk_req_t *br; + int len = MBLKL(data); + int rval; + + USB_DPRINTF_L4(DPRINT_OUT_PIPE, uf->uf_lh, + "uftdi_send_data: %d 0x%x 0x%x 0x%x", len, data->b_rptr[0], + (len > 1) ? data->b_rptr[1] : 0, (len > 2) ? data->b_rptr[2] : 0); + + ASSERT(!mutex_owned(&uf->uf_lock)); + + br = usb_alloc_bulk_req(uf->uf_dip, 0, USB_FLAGS_SLEEP); + br->bulk_data = data; + br->bulk_len = len; + br->bulk_timeout = UFTDI_BULKOUT_TIMEOUT; + br->bulk_cb = uftdi_bulkout_cb; + br->bulk_exc_cb = uftdi_bulkout_cb; + br->bulk_client_private = (usb_opaque_t)uf; + br->bulk_attributes = USB_ATTRS_AUTOCLEARING; + + rval = usb_pipe_bulk_xfer(uf->uf_bulkout_ph, br, 0); + + if (rval != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_OUT_PIPE, uf->uf_lh, + "uftdi_send_data: xfer failed %d", rval); + br->bulk_data = NULL; + usb_free_bulk_req(br); + } + + return (rval); +} + + +/* + * wait until local tx buffer drains. + * 'timeout' is in seconds, zero means wait forever + */ +static int +uftdi_wait_tx_drain(uftdi_state_t *uf, int timeout) +{ + clock_t until; + int over = 0; + + until = ddi_get_lbolt() + drv_usectohz(1000 * 1000 * timeout); + + while (uf->uf_tx_mp && !over) { + if (timeout > 0) { + /* whether timedout or signal pending */ + over = cv_timedwait_sig(&uf->uf_tx_cv, + &uf->uf_lock, until) <= 0; + } else { + /* whether a signal is pending */ + over = cv_wait_sig(&uf->uf_tx_cv, + &uf->uf_lock) == 0; + } + } + + return (uf->uf_tx_mp == NULL ? USB_SUCCESS : USB_FAILURE); +} + +/* + * initialize hardware serial port + */ +static int +uftdi_open_hw_port(uftdi_state_t *uf, int portno, int dorestore) +{ + int rval; + + /* + * Perform a full reset on the device + */ + rval = uftdi_cmd_vendor_write0(uf, + FTDI_SIO_RESET, FTDI_SIO_RESET_SIO, portno); + if (rval != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_DEF_PIPE, uf->uf_lh, + "uftdi_open_hw_port: failed to reset!"); + return (rval); + } + + if (dorestore) { + /* + * Restore settings from our soft copy of HW registers + */ + (void) uftdi_setregs(uf, portno, NULL); + } else { + /* + * 9600 baud, 2 stop bits, no parity, 8-bit, h/w flow control + */ + static ds_port_param_entry_t ents[] = { +#if defined(__lock_lint) + /* + * (Sigh - wlcc doesn't understand this newer + * form of structure member initialization.) + */ + { 0 } +#else + { DS_PARAM_BAUD, .val.ui = B9600 }, + { DS_PARAM_STOPB, .val.ui = CSTOPB }, + { DS_PARAM_PARITY, .val.ui = 0 }, + { DS_PARAM_CHARSZ, .val.ui = CS8 }, + { DS_PARAM_FLOW_CTL, .val.ui = CTSXON } +#endif + }; + static ds_port_params_t params = { + ents, + sizeof (ents) / sizeof (ents[0]) + }; + + rval = uftdi_set_port_params(uf, portno, ¶ms); + if (rval != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_DEF_PIPE, uf->uf_lh, + "uftdi_open_hw_port: failed 9600/2/n/8 rval %d", + rval); + } + } + + return (rval); +} + +static int +uftdi_cmd_vendor_write0(uftdi_state_t *uf, + uint16_t reqno, uint16_t val, uint16_t idx) +{ + usb_ctrl_setup_t req; + usb_cb_flags_t cb_flags; + usb_cr_t cr; + int rval; + + ASSERT(!mutex_owned(&uf->uf_lock)); + + req.bmRequestType = + USB_DEV_REQ_TYPE_VENDOR | USB_DEV_REQ_HOST_TO_DEV; + req.bRequest = (uchar_t)reqno; + req.wValue = val; + req.wIndex = idx; + req.wLength = 0; + req.attrs = USB_ATTRS_NONE; + + if ((rval = usb_pipe_ctrl_xfer_wait(uf->uf_def_ph, + &req, NULL, &cr, &cb_flags, 0)) != USB_SUCCESS) { + USB_DPRINTF_L2(DPRINT_DEF_PIPE, uf->uf_lh, + "uftdi_cmd_vendor_write0: 0x%x 0x%x 0x%x failed %d %d 0x%x", + reqno, val, idx, rval, cr, cb_flags); + } + + return (rval); +} + +/* + * misc routines + */ + +/* + * link a message block to tail of message + * account for the case when message is null + */ +static void +uftdi_put_tail(mblk_t **mpp, mblk_t *bp) +{ + if (*mpp) + linkb(*mpp, bp); + else + *mpp = bp; +} + +/* + * put a message block at the head of the message + * account for the case when message is null + */ +static void +uftdi_put_head(mblk_t **mpp, mblk_t *bp) +{ + if (*mpp) + linkb(bp, *mpp); + *mpp = bp; +} + +/*ARGSUSED*/ +static usb_pipe_handle_t +uftdi_out_pipe(ds_hdl_t hdl, uint_t portno) +{ + return (((uftdi_state_t *)hdl)->uf_bulkout_ph); +} + +/*ARGSUSED*/ +static usb_pipe_handle_t +uftdi_in_pipe(ds_hdl_t hdl, uint_t portno) +{ + return (((uftdi_state_t *)hdl)->uf_bulkin_ph); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/clients/usbser/usbftdi/usbftdi.conf Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,42 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Many devices using the FT232R chip are not "classic" serial port +# modems at all - and for those devices, hardware designers seem +# quite casual about configuring some of the modem status lines +# - in particular carrier detect, which is often left floating. +# Even "regular" serial ports are often 3-wire configurations. +# +# Given the usage is rarely as a fully-fledged modem, this configuration +# file makes the default for the driver to ignore the state of the +# carrier detect line; set this property to zero, or comment it out to +# have the device provide full "modem" semantics +# +# Note that 'ignore-cd' applies to all ports supported by the driver +# while the 'port-N-ignore-cd' applies only to port N +# + +ignore-cd=1;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/clients/usbser/usbftdi/usbser_uftdi.c Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,188 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * This driver supports FTDI FT232R USB-to-serial adapters. It is a + * device-specific driver (DSD) working with the USB generic serial + * driver (GSD) usbser. + * + * It implements the USB-to-serial device-specific driver interface (DSDI) + * which is exported by GSD. The DSDI is defined by ds_ops_t structure. + * + * Also may work with the older FTDI 8U232AM devices. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/stream.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +#include <sys/usb/clients/usbser/usbser.h> +#include <sys/usb/clients/usbser/usbftdi/uftdi_var.h> + +static void *usbser_uftdi_statep; /* soft state handle for usbser */ + +extern ds_ops_t uftdi_ds_ops; /* DSD operations */ + +static int +usbser_uftdi_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, + void **result) +{ + return (usbser_getinfo(dip, infocmd, arg, result, usbser_uftdi_statep)); +} + + +static int +usbser_uftdi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) +{ + return (usbser_attach(dip, cmd, usbser_uftdi_statep, &uftdi_ds_ops)); +} + + +static int +usbser_uftdi_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) +{ + return (usbser_detach(dip, cmd, usbser_uftdi_statep)); +} + + +static int +usbser_uftdi_open(queue_t *rq, dev_t *dev, int flag, int sflag, cred_t *cr) +{ + return (usbser_open(rq, dev, flag, sflag, cr, usbser_uftdi_statep)); +} + +/* + * Several linked data structures to tie it together .. + */ +struct module_info uftdi_modinfo = { + 0, /* module id */ + "uftdi", /* module name */ + USBSER_MIN_PKTSZ, /* min pkt size */ + USBSER_MAX_PKTSZ, /* max pkt size */ + USBSER_HIWAT, /* hi watermark */ + USBSER_LOWAT /* low watermark */ +}; + +static struct qinit uftdi_rinit = { + putq, + usbser_rsrv, + usbser_uftdi_open, + usbser_close, + NULL, + &uftdi_modinfo, +}; + +static struct qinit uftdi_winit = { + usbser_wput, + usbser_wsrv, + NULL, + NULL, + NULL, + &uftdi_modinfo, +}; + +static struct streamtab uftdi_str_info = { + &uftdi_rinit, + &uftdi_winit, +}; + +static struct cb_ops uftdi_cb_ops = { + nodev, /* cb_open */ + nodev, /* cb_close */ + nodev, /* cb_strategy */ + nodev, /* cb_print */ + nodev, /* cb_dump */ + nodev, /* cb_read */ + nodev, /* cb_write */ + nodev, /* cb_ioctl */ + nodev, /* cb_devmap */ + nodev, /* cb_mmap */ + nodev, /* cb_segmap */ + nochpoll, /* cb_chpoll */ + ddi_prop_op, /* cb_prop_op */ + &uftdi_str_info, /* cb_stream */ + (int)(D_64BIT | D_NEW | D_MP | D_HOTPLUG) /* cb_flag */ +}; + +static struct dev_ops uftdi_ops = { + DEVO_REV, /* devo_rev */ + 0, /* devo_refcnt */ + usbser_uftdi_getinfo, + nulldev, /* devo_identify */ + nulldev, /* devo_probe */ + usbser_uftdi_attach, + usbser_uftdi_detach, + nodev, /* devo_reset */ + &uftdi_cb_ops, + (struct bus_ops *)NULL, /* devo_bus_ops */ + usbser_power, /* devo_power */ + ddi_quiesce_not_needed +}; + +static struct modldrv modldrv = { + &mod_driverops, + "FTDI FT232R USB UART driver", + &uftdi_ops, +}; + +static struct modlinkage modlinkage = { + MODREV_1, + &modldrv +}; + +int +_init(void) +{ + int error; + + if ((error = mod_install(&modlinkage)) != 0) + return (error); + if ((error = ddi_soft_state_init(&usbser_uftdi_statep, + usbser_soft_state_size(), 1)) != 0) + (void) mod_remove(&modlinkage); + return (error); +} + + +int +_fini(void) +{ + int error; + + if ((error = mod_remove(&modlinkage)) == 0) + ddi_soft_state_fini(&usbser_uftdi_statep); + return (error); +} + + +int +_info(struct modinfo *modinfop) +{ + return (mod_info(&modlinkage, modinfop)); +}
--- a/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c Sun Apr 12 10:48:30 2009 -0700 @@ -18,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - /* * USB Serial CDC ACM driver * @@ -466,7 +466,8 @@ 153600, /* B153600 */ 230400, /* B230400 */ 307200, /* B307200 */ - 460800 /* B460800 */ + 460800, /* B460800 */ + 921600 /* B921600 */ };
--- a/usr/src/uts/common/io/usb/clients/usbser/usbser.c Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/io/usb/clients/usbser/usbser.c Sun Apr 12 10:48:30 2009 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2622,18 +2622,18 @@ error = -1; usbser_serialize_port_act(pp, USBSER_ACT_CTL); mutex_exit(&pp->port_mutex); - break; + case TCSBRK: /* serialize breaks */ - if (pp->port_act & USBSER_ACT_BREAK) { - + if (pp->port_act & USBSER_ACT_BREAK) return (USB_FAILURE); - } + /*FALLTHRU*/ default: usbser_serialize_port_act(pp, USBSER_ACT_CTL); mutex_exit(&pp->port_mutex); (void) ttycommon_ioctl(tp, q, mp, &error); + break; } if (error == 0) { @@ -2648,21 +2648,19 @@ case TCSETAW: case TCSETAF: (void) USBSER_DS_FIFO_DRAIN(pp, DS_TX); - - /* FALLTHRU */ + /*FALLTHRU*/ + case TCSETS: mutex_enter(&pp->port_mutex); error = usbser_port_program(pp); mutex_exit(&pp->port_mutex); - break; } - goto end; + } else if (error > 0) { USB_DPRINTF_L3(DPRINT_IOCTL, pp->port_lh, "usbser_ioctl: " "ttycommon_ioctl returned %d", error); - goto end; } @@ -2672,55 +2670,53 @@ error = 0; switch (cmd) { case TCSBRK: - if ((error = miocpullup(mp, sizeof (int))) != 0) { - + if ((error = miocpullup(mp, sizeof (int))) != 0) break; - } + /* drain output */ (void) USBSER_DS_FIFO_DRAIN(pp, USBSER_TX_FIFO_DRAIN_TIMEOUT); + /* * if required, set break */ if (*(int *)mp->b_cont->b_rptr == 0) { if (USBSER_DS_BREAK_CTL(pp, DS_ON) != USB_SUCCESS) { error = EIO; - break; } + mutex_enter(&pp->port_mutex); pp->port_act |= USBSER_ACT_BREAK; pp->port_delay_id = timeout(usbser_restart, pp, drv_usectohz(250000)); mutex_exit(&pp->port_mutex); } - + mioc2ack(mp, NULL, 0, 0); break; - case TIOCSBRK: - /* set break */ - if (USBSER_DS_BREAK_CTL(pp, DS_ON) != USB_SUCCESS) { + + case TIOCSBRK: /* set break */ + if (USBSER_DS_BREAK_CTL(pp, DS_ON) != USB_SUCCESS) error = EIO; - } - + else + mioc2ack(mp, NULL, 0, 0); break; - case TIOCCBRK: - /* clear break */ - if (USBSER_DS_BREAK_CTL(pp, DS_OFF) != USB_SUCCESS) { + + case TIOCCBRK: /* clear break */ + if (USBSER_DS_BREAK_CTL(pp, DS_OFF) != USB_SUCCESS) error = EIO; - } - + else + mioc2ack(mp, NULL, 0, 0); break; - case TIOCMSET: - case TIOCMBIS: - case TIOCMBIC: + + case TIOCMSET: /* set all modem bits */ + case TIOCMBIS: /* bis modem bits */ + case TIOCMBIC: /* bic modem bits */ if (iocp->ioc_count == TRANSPARENT) { mcopyin(mp, NULL, sizeof (int), NULL); - break; } - if ((error = miocpullup(mp, sizeof (int))) != 0) { - + if ((error = miocpullup(mp, sizeof (int))) != 0) break; - } val = *(int *)mp->b_cont->b_rptr; if (cmd == TIOCMSET) { @@ -2730,97 +2726,75 @@ } else if (cmd == TIOCMBIC) { rval = USBSER_DS_SET_MODEM_CTL(pp, val, 0); } - if (rval != USB_SUCCESS) { + if (rval == USB_SUCCESS) + mioc2ack(mp, NULL, 0, 0); + else error = EIO; - } - break; - case (tIOC | 109): /* TIOCSILOOP */ + + case TIOCSILOOP: if (USBSER_DS_LOOPBACK_SUPPORTED(pp)) { - if (USBSER_DS_LOOPBACK(pp, DS_ON) != USB_SUCCESS) { + if (USBSER_DS_LOOPBACK(pp, DS_ON) == USB_SUCCESS) + mioc2ack(mp, NULL, 0, 0); + else error = EIO; - } else { - iocp->ioc_error = 0; - mp->b_datap->db_type = M_IOCACK; - } - } else { - error = EINVAL; - } - - break; - case (tIOC | 108): /* TIOCCILOOP */ - if (USBSER_DS_LOOPBACK_SUPPORTED(pp)) { - if (USBSER_DS_LOOPBACK(pp, DS_OFF) != USB_SUCCESS) { - error = EIO; - } else { - iocp->ioc_error = 0; - mp->b_datap->db_type = M_IOCACK; - } } else { error = EINVAL; } - break; - case TIOCMGET: - datamp = allocb(sizeof (int), BPRI_MED); - if (datamp == NULL) { + + case TIOCCILOOP: + if (USBSER_DS_LOOPBACK_SUPPORTED(pp)) { + if (USBSER_DS_LOOPBACK(pp, DS_OFF) == USB_SUCCESS) + mioc2ack(mp, NULL, 0, 0); + else + error = EIO; + } else { + error = EINVAL; + } + break; + + case TIOCMGET: /* get all modem bits */ + if ((datamp = allocb(sizeof (int), BPRI_MED)) == NULL) { error = EAGAIN; - break; } - rval = USBSER_DS_GET_MODEM_CTL(pp, -1, (int *)datamp->b_rptr); if (rval != USB_SUCCESS) { error = EIO; - break; } - - if (iocp->ioc_count == TRANSPARENT) { + if (iocp->ioc_count == TRANSPARENT) mcopyout(mp, NULL, sizeof (int), NULL, datamp); - } else { - if (mp->b_cont != NULL) { - freemsg(mp->b_cont); - } - mp->b_cont = datamp; - mp->b_cont->b_wptr += sizeof (int); - iocp->ioc_count = sizeof (int); - } - + else + mioc2ack(mp, datamp, sizeof (int), 0); break; + case CONSOPENPOLLEDIO: error = usbser_polledio_init(pp); if (error != 0) - break; error = miocpullup(mp, sizeof (struct cons_polledio *)); if (error != 0) - break; *(struct cons_polledio **)mp->b_cont->b_rptr = &usbser_polledio; - - mp->b_datap->db_type = M_IOCACK; - + mioc2ack(mp, NULL, 0, 0); break; + case CONSCLOSEPOLLEDIO: usbser_polledio_fini(pp); - mp->b_datap->db_type = M_IOCACK; - mp->b_datap->db_type = M_IOCACK; - iocp->ioc_error = 0; - iocp->ioc_rval = 0; - + mioc2ack(mp, NULL, 0, 0); break; + case CONSSETABORTENABLE: error = secpolicy_console(iocp->ioc_cr); if (error != 0) - break; if (iocp->ioc_count != TRANSPARENT) { error = EINVAL; - break; } @@ -2836,12 +2810,9 @@ usbser_console_abort = 1; else usbser_console_abort = 0; - - mp->b_datap->db_type = M_IOCACK; - iocp->ioc_error = 0; - iocp->ioc_rval = 0; - + mioc2ack(mp, NULL, 0, 0); break; + case CONSGETABORTENABLE: /*CONSTANTCONDITION*/ ASSERT(sizeof (boolean_t) <= sizeof (boolean_t *)); @@ -2851,19 +2822,18 @@ */ mcopyout(mp, NULL, sizeof (boolean_t), NULL, NULL); *(boolean_t *)mp->b_cont->b_rptr = (usbser_console_abort != 0); - + mioc2ack(mp, NULL, 0, 0); break; + default: error = EINVAL; - break; } end: - if (error != 0) { - iocp->ioc_error = error; - mp->b_datap->db_type = M_IOCNAK; - } - qreply(q, mp); + if (error != 0) + miocnak(q, mp, 0, error); + else + qreply(q, mp); mutex_enter(&pp->port_mutex); usbser_release_port_act(pp, USBSER_ACT_CTL); @@ -2880,7 +2850,6 @@ { tty_common_t *tp = &pp->port_ttycommon; queue_t *q = tp->t_writeq; - struct iocblk *ip; struct copyresp *csp; int cmd; int val; @@ -2888,31 +2857,28 @@ ASSERT(mutex_owned(&pp->port_mutex)); - ip = (struct iocblk *)mp->b_rptr; csp = (struct copyresp *)mp->b_rptr; cmd = csp->cp_cmd; if (csp->cp_rval != 0) { freemsg(mp); - return; } switch (cmd) { - case TIOCMSET: - case TIOCMBIS: - case TIOCMBIC: + case TIOCMSET: /* set all modem bits */ + case TIOCMBIS: /* bis modem bits */ + case TIOCMBIC: /* bic modem bits */ if ((mp->b_cont == NULL) || (MBLKL(mp->b_cont) < sizeof (int))) { miocnak(q, mp, 0, EINVAL); - break; } val = *(int *)mp->b_cont->b_rptr; usbser_serialize_port_act(pp, USBSER_ACT_CTL); - mutex_exit(&pp->port_mutex); + if (cmd == TIOCMSET) { rval = USBSER_DS_SET_MODEM_CTL(pp, -1, val); } else if (cmd == TIOCMBIS) { @@ -2925,33 +2891,26 @@ freemsg(mp->b_cont); mp->b_cont = NULL; } - ip->ioc_rval = 0; - if (rval == USB_SUCCESS) { + + if (rval == USB_SUCCESS) miocack(q, mp, 0, 0); - } else { + else miocnak(q, mp, 0, EIO); - } + mutex_enter(&pp->port_mutex); - usbser_release_port_act(pp, USBSER_ACT_CTL); - break; - case TIOCMGET: + + case TIOCMGET: /* get all modem bits */ mutex_exit(&pp->port_mutex); - if (mp->b_cont) { - freemsg(mp->b_cont); - mp->b_cont = NULL; - } - ip->ioc_rval = 0; miocack(q, mp, 0, 0); mutex_enter(&pp->port_mutex); - break; + default: mutex_exit(&pp->port_mutex); miocnak(q, mp, 0, EINVAL); mutex_enter(&pp->port_mutex); - break; } } @@ -3291,7 +3250,7 @@ * ---- * * - * returns !=0 if device is online, 0 otherwise + * returns != 0 if device is online, 0 otherwise */ static int usbser_dev_is_online(usbser_state_t *usp) @@ -3311,10 +3270,8 @@ static void usbser_serialize_port_act(usbser_port_t *pp, int act) { - while (pp->port_act & act) { + while (pp->port_act & act) cv_wait(&pp->port_act_cv, &pp->port_mutex); - } - pp->port_act |= act; } @@ -3385,8 +3342,8 @@ case TIOCMBIS: str = "TIOCMBIS"; break; case TIOCMBIC: str = "TIOCMBIC"; break; case TIOCMGET: str = "TIOCMGET"; break; - case (tIOC | 109): str = "TIOCSILOOP"; break; - case (tIOC | 108): str = "TIOCCILOOP"; break; + case TIOCSILOOP: str = "TIOCSILOOP"; break; + case TIOCCILOOP: str = "TIOCCILOOP"; break; case TCGETX: str = "TCGETX"; break; case TCSETX: str = "TCGETX"; break; case TCSETXW: str = "TCGETX"; break; @@ -3411,13 +3368,11 @@ /* only one serial line console supported */ if (console_input != NULL) - return (USB_FAILURE); /* check if underlying driver supports polled io */ if (ds_ops->ds_version < DS_OPS_VERSION_V1 || ds_ops->ds_out_pipe == NULL || ds_ops->ds_in_pipe == NULL) - return (USB_FAILURE); /* init polled input pipe */ @@ -3425,7 +3380,6 @@ err = usb_console_input_init(pp->port_usp->us_dip, hdl, &console_input_buf, &console_input); if (err) - return (USB_FAILURE); /* init polled output pipe */ @@ -3435,7 +3389,6 @@ if (err) { (void) usb_console_input_fini(console_input); console_input = NULL; - return (USB_FAILURE); } @@ -3495,12 +3448,10 @@ uint_t num_bytes; if (console_input_start < console_input_end) - - return (1); + return (B_TRUE); if (usb_console_read(console_input, &num_bytes) != USB_SUCCESS) - - return (0); + return (B_FALSE); console_input_start = console_input_buf; console_input_end = console_input_buf + num_bytes;
--- a/usr/src/uts/common/io/usb/inc.flg Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/io/usb/inc.flg Sun Apr 12 10:48:30 2009 -0700 @@ -18,9 +18,9 @@ # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END -# + # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -79,6 +79,7 @@ usr/src/uts/sparc/mixer \ usr/src/uts/sparc/amsrc2 \ usr/src/uts/sparc/ugen \ + usr/src/uts/sparc/usbftdi \ usr/src/uts/sparc/usbser \ usr/src/uts/sparc/usbsksp \ usr/src/uts/sparc/usbsprl \ @@ -113,6 +114,7 @@ usr/src/uts/intel/mixer \ usr/src/uts/intel/amsrc2 \ usr/src/uts/intel/ugen \ + usr/src/uts/intel/usbftdi \ usr/src/uts/intel/usbser \ usr/src/uts/intel/usbsksp \ usr/src/uts/intel/usbsprl \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/usbdevs Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,2515 @@ +SRC/uts/common/io/usb/usbdevs + +/* $FreeBSD: usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp $ */ + +/* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ + +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * List of known USB vendors + * + * Please note that these IDs do not do anything. Adding an ID here and + * regenerating usbdevs.h only makes a symbolic name + * available to the source code and does not change any functionality, nor + * does it make your device available to a specific driver. + * + * After adding a vendor ID VNDR and a product ID PRDCT you will have the + * following extra defines: + * #define USB_VENDOR_VNDR 0x???? + * #define USB_PRODUCT_VNDR_PRDCT 0x???? + * + * You may have to add these defines to the respective probe routines to + * make the device recognised by the appropriate device driver. + * + * You may have to add these definitions to the driver aliases mechanism + * for the device to be discovered by the driver. + */ + +vendor UNKNOWN1 0x0053 Unknown vendor +vendor UNKNOWN2 0x0105 Unknown vendor +vendor EGALAX2 0x0123 eGalax, Inc. +vendor HUMAX 0x02ad HUMAX +vendor LTS 0x0386 LTS +vendor BWCT 0x03da Bernd Walter Computer Technology +vendor AOX 0x03e8 AOX +vendor THESYS 0x03e9 Thesys +vendor DATABROADCAST 0x03ea Data Broadcasting +vendor ATMEL 0x03eb Atmel +vendor IWATSU 0x03ec Iwatsu America +vendor MITSUMI 0x03ee Mitsumi +vendor HP 0x03f0 Hewlett Packard +vendor GENOA 0x03f1 Genoa +vendor OAK 0x03f2 Oak +vendor ADAPTEC 0x03f3 Adaptec +vendor DIEBOLD 0x03f4 Diebold +vendor SIEMENSELECTRO 0x03f5 Siemens Electromechanical +vendor EPSONIMAGING 0x03f8 Epson Imaging +vendor KEYTRONIC 0x03f9 KeyTronic +vendor OPTI 0x03fb OPTi +vendor ELITEGROUP 0x03fc Elitegroup +vendor XILINX 0x03fd Xilinx +vendor FARALLON 0x03fe Farallon Communications +vendor NATIONAL 0x0400 National Semiconductor +vendor NATIONALREG 0x0401 National Registry +vendor ACERLABS 0x0402 Acer Labs +vendor FTDI 0x0403 Future Technology Devices +vendor NCR 0x0404 NCR +vendor SYNOPSYS2 0x0405 Synopsys +vendor FUJITSUICL 0x0406 Fujitsu-ICL +vendor FUJITSU2 0x0407 Fujitsu Personal Systems +vendor QUANTA 0x0408 Quanta +vendor NEC 0x0409 NEC +vendor KODAK 0x040a Eastman Kodak +vendor WELTREND 0x040b Weltrend +vendor VIA 0x040d VIA +vendor MCCI 0x040e MCCI +vendor MELCO 0x0411 Melco +vendor LEADTEK 0x0413 Leadtek +vendor WINBOND 0x0416 Winbond +vendor PHOENIX 0x041a Phoenix +vendor CREATIVE 0x041e Creative Labs +vendor NOKIA 0x0421 Nokia +vendor ADI 0x0422 ADI Systems +vendor CATC 0x0423 Computer Access Technology +vendor SMC2 0x0424 Standard Microsystems +vendor MOTOROLA_HK 0x0425 Motorola HK +vendor GRAVIS 0x0428 Advanced Gravis Computer +vendor CIRRUSLOGIC 0x0429 Cirrus Logic +vendor INNOVATIVE 0x042c Innovative Semiconductors +vendor MOLEX 0x042f Molex +vendor SUN 0x0430 Sun Microsystems +vendor UNISYS 0x0432 Unisys +vendor TAUGA 0x0436 Taugagreining HF +vendor AMD 0x0438 Advanced Micro Devices +vendor LEXMARK 0x043d Lexmark International +vendor LG 0x043e LG Electronics +vendor NANAO 0x0440 NANAO +vendor GATEWAY 0x0443 Gateway 2000 +vendor NMB 0x0446 NMB +vendor ALPS 0x044e Alps Electric +vendor THRUST 0x044f Thrustmaster +vendor TI 0x0451 Texas Instruments +vendor ANALOGDEVICES 0x0456 Analog Devices +vendor SIS 0x0457 Silicon Integrated Systems Corp. +vendor KYE 0x0458 KYE Systems +vendor DIAMOND2 0x045a Diamond (Supra) +vendor RENESAS 0x045b Renesas +vendor MICROSOFT 0x045e Microsoft +vendor PRIMAX 0x0461 Primax Electronics +vendor MGE 0x0463 MGE UPS Systems +vendor AMP 0x0464 AMP +vendor CHERRY 0x046a Cherry Mikroschalter +vendor MEGATRENDS 0x046b American Megatrends +vendor LOGITECH 0x046d Logitech +vendor BTC 0x046e Behavior Tech. Computer +vendor PHILIPS 0x0471 Philips +vendor SUN2 0x0472 Sun Microsystems (offical) +vendor SANYO 0x0474 Sanyo Electric +vendor SEAGATE 0x0477 Seagate +vendor CONNECTIX 0x0478 Connectix +vendor SEMTECH 0x047a Semtech +vendor KENSINGTON 0x047d Kensington +vendor LUCENT 0x047e Lucent +vendor PLANTRONICS 0x047f Plantronics +vendor KYOCERA 0x0482 Kyocera Wireless Corp. +vendor STMICRO 0x0483 STMicroelectronics +vendor FOXCONN 0x0489 Foxconn +vendor YAMAHA 0x0499 YAMAHA +vendor COMPAQ 0x049f Compaq +vendor HITACHI 0x04a4 Hitachi +vendor ACERP 0x04a5 Acer Peripherals +vendor DAVICOM 0x04a6 Davicom +vendor VISIONEER 0x04a7 Visioneer +vendor CANON 0x04a9 Canon +vendor NIKON 0x04b0 Nikon +vendor PAN 0x04b1 Pan International +vendor IBM 0x04b3 IBM +vendor CYPRESS 0x04b4 Cypress Semiconductor +vendor ROHM 0x04b5 ROHM +vendor COMPAL 0x04b7 Compal +vendor EPSON 0x04b8 Seiko Epson +vendor RAINBOW 0x04b9 Rainbow Technologies +vendor IODATA 0x04bb I-O Data +vendor TDK 0x04bf TDK +vendor 3COMUSR 0x04c1 U.S. Robotics +vendor METHODE 0x04c2 Methode Electronics Far East +vendor MAXISWITCH 0x04c3 Maxi Switch +vendor LOCKHEEDMER 0x04c4 Lockheed Martin Energy Research +vendor FUJITSU 0x04c5 Fujitsu +vendor TOSHIBAAM 0x04c6 Toshiba America +vendor MICROMACRO 0x04c7 Micro Macro Technologies +vendor KONICA 0x04c8 Konica +vendor LITEON 0x04ca Lite-On Technology +vendor FUJIPHOTO 0x04cb Fuji Photo Film +vendor PHILIPSSEMI 0x04cc Philips Semiconductors +vendor TATUNG 0x04cd Tatung Co. Of America +vendor SCANLOGIC 0x04ce ScanLogic +vendor MYSON 0x04cf Myson Technology +vendor DIGI2 0x04d0 Digi +vendor ITTCANON 0x04d1 ITT Canon +vendor ALTEC 0x04d2 Altec Lansing +vendor LSI 0x04d4 LSI +vendor MENTORGRAPHICS 0x04d6 Mentor Graphics +vendor ITUNERNET 0x04d8 I-Tuner Networks +vendor HOLTEK 0x04d9 Holtek Semiconductor, Inc. +vendor PANASONIC 0x04da Panasonic (Matsushita) +vendor HUANHSIN 0x04dc Huan Hsin +vendor SHARP 0x04dd Sharp +vendor IIYAMA 0x04e1 Iiyama +vendor SHUTTLE 0x04e6 Shuttle Technology +vendor ELO 0x04e7 Elo TouchSystems +vendor SAMSUNG 0x04e8 Samsung Electronics +vendor NORTHSTAR 0x04eb Northstar +vendor TOKYOELECTRON 0x04ec Tokyo Electron +vendor ANNABOOKS 0x04ed Annabooks +vendor JVC 0x04f1 JVC +vendor CHICONY 0x04f2 Chicony Electronics +vendor ELAN 0x04f3 Elan +vendor NEWNEX 0x04f7 Newnex +vendor BROTHER 0x04f9 Brother Industries +vendor DALLAS 0x04fa Dallas Semiconductor +vendor SUNPLUS 0x04fc Sunplus +vendor PFU 0x04fe PFU +vendor FUJIKURA 0x0501 Fujikura/DDK +vendor ACER 0x0502 Acer +vendor 3COM 0x0506 3Com +vendor HOSIDEN 0x0507 Hosiden Corporation +vendor AZTECH 0x0509 Aztech Systems +vendor BELKIN 0x050d Belkin Components +vendor KAWATSU 0x050f Kawatsu Semiconductor +vendor FCI 0x0514 FCI +vendor LONGWELL 0x0516 Longwell +vendor COMPOSITE 0x0518 Composite +vendor STAR 0x0519 Star Micronics +vendor APC 0x051d American Power Conversion +vendor SCIATLANTA 0x051e Scientific Atlanta +vendor TSM 0x0520 TSM +vendor CONNECTEK 0x0522 Advanced Connectek USA +vendor NETCHIP 0x0525 NetChip Technology +vendor ALTRA 0x0527 ALTRA +vendor ATI 0x0528 ATI Technologies +vendor AKS 0x0529 Aladdin Knowledge Systems +vendor TEKOM 0x052b Tekom +vendor CANONDEV 0x052c Canon +vendor WACOMTECH 0x0531 Wacom +vendor INVENTEC 0x0537 Inventec +vendor SHYHSHIUN 0x0539 Shyh Shiun Terminals +vendor PREHWERKE 0x053a Preh Werke Gmbh & Co. KG +vendor SYNOPSYS 0x053f Synopsys +vendor UNIACCESS 0x0540 Universal Access +vendor VIEWSONIC 0x0543 ViewSonic +vendor XIRLINK 0x0545 Xirlink +vendor ANCHOR 0x0547 Anchor Chips +vendor SONY 0x054c Sony +vendor FUJIXEROX 0x0550 Fuji Xerox +vendor VISION 0x0553 VLSI Vision +vendor ASAHIKASEI 0x0556 Asahi Kasei Microsystems +vendor ATEN 0x0557 ATEN International +vendor SAMSUNG2 0x055d Samsung Electronics +vendor MUSTEK 0x055f Mustek Systems +vendor TELEX 0x0562 Telex Communications +vendor CHINON 0x0564 Chinon +vendor PERACOM 0x0565 Peracom Networks +vendor ALCOR2 0x0566 Alcor Micro +vendor XYRATEX 0x0567 Xyratex +vendor WACOM 0x056a WACOM +vendor ETEK 0x056c e-TEK Labs +vendor EIZO 0x056d EIZO +vendor ELECOM 0x056e Elecom +vendor CONEXANT 0x0572 Conexant +vendor HAUPPAUGE 0x0573 Hauppauge Computer Works +vendor BAFO 0x0576 BAFO/Quality Computer Accessories +vendor YEDATA 0x057b Y-E Data +vendor AVM 0x057c AVM +vendor QUICKSHOT 0x057f Quickshot +vendor ROLAND 0x0582 Roland +vendor ROCKFIRE 0x0583 Rockfire +vendor RATOC 0x0584 RATOC Systems +vendor ZYXEL 0x0586 ZyXEL Communication +vendor INFINEON 0x058b Infineon +vendor MICREL 0x058d Micrel +vendor ALCOR 0x058f Alcor Micro +vendor OMRON 0x0590 OMRON +vendor ZORAN 0x0595 Zoran Microelectronics +vendor NIIGATA 0x0598 Niigata +vendor IOMEGA 0x059b Iomega +vendor ATREND 0x059c A-Trend Technology +vendor AID 0x059d Advanced Input Devices +vendor LACIE 0x059f LaCie +vendor FUJIFILM 0x05a2 Fuji Film +vendor ARC 0x05a3 ARC +vendor ORTEK 0x05a4 Ortek +vendor BOSE 0x05a7 Bose +vendor OMNIVISION 0x05a9 OmniVision +vendor INSYSTEM 0x05ab In-System Design +vendor APPLE 0x05ac Apple Computer +vendor YCCABLE 0x05ad Y.C. Cable +vendor DIGITALPERSONA 0x05ba DigitalPersona +vendor 3G 0x05bc 3G Green Green Globe +vendor RAFI 0x05bd RAFI +vendor TYCO 0x05be Tyco +vendor KAWASAKI 0x05c1 Kawasaki +vendor DIGI 0x05c5 Digi International +vendor QUALCOMM2 0x05c6 Qualcomm +vendor QTRONIX 0x05c7 Qtronix +vendor FOXLINK 0x05c8 Foxlink +vendor RICOH 0x05ca Ricoh +vendor ELSA 0x05cc ELSA +vendor SCIWORX 0x05ce sci-worx +vendor BRAINBOXES 0x05d1 Brainboxes Limited +vendor ULTIMA 0x05d8 Ultima +vendor AXIOHM 0x05d9 Axiohm Transaction Solutions +vendor MICROTEK 0x05da Microtek +vendor SUNTAC 0x05db SUN Corporation +vendor LEXAR 0x05dc Lexar Media +vendor ADDTRON 0x05dd Addtron +vendor SYMBOL 0x05e0 Symbol Technologies +vendor SYNTEK 0x05e1 Syntek +vendor GENESYS 0x05e3 Genesys Logic +vendor FUJI 0x05e5 Fuji Electric +vendor KEITHLEY 0x05e6 Keithley Instruments +vendor EIZONANAO 0x05e7 EIZO Nanao +vendor KLSI 0x05e9 Kawasaki LSI +vendor FFC 0x05eb FFC +vendor ANKO 0x05ef Anko Electronic +vendor PIENGINEERING 0x05f3 P.I. Engineering +vendor AOC 0x05f6 AOC International +vendor CHIC 0x05fe Chic Technology +vendor BARCO 0x0600 Barco Display Systems +vendor BRIDGE 0x0607 Bridge Information +vendor SOLIDYEAR 0x060b Solid Year +vendor BIORAD 0x0614 Bio-Rad Laboratories +vendor MACALLY 0x0618 Macally +vendor ACTLABS 0x061c Act Labs +vendor ALARIS 0x0620 Alaris +vendor APEX 0x0624 Apex +vendor CREATIVE3 0x062a Creative Labs +vendor VIVITAR 0x0636 Vivitar +vendor GUNZE 0x0637 Gunze Electronics USA +vendor AVISION 0x0638 Avision +vendor TEAC 0x0644 TEAC +vendor SGI 0x065e Silicon Graphics +vendor SANWASUPPLY 0x0663 Sanwa Supply +vendor LINKSYS 0x066b Linksys +vendor ACERSA 0x066e Acer Semiconductor America +vendor SIGMATEL 0x066f Sigmatel +vendor DRAYTEK 0x0675 DrayTek +vendor AIWA 0x0677 Aiwa +vendor ACARD 0x0678 ACARD Technology +vendor PROLIFIC 0x067b Prolific Technology +vendor SIEMENS 0x067c Siemens +vendor AVANCELOGIC 0x0680 Avance Logic +vendor SIEMENS2 0x0681 Siemens +vendor MINOLTA 0x0686 Minolta +vendor CHPRODUCTS 0x068e CH Products +vendor HAGIWARA 0x0693 Hagiwara Sys-Com +vendor CTX 0x0698 Chuntex +vendor ASKEY 0x069a Askey Computer +vendor SAITEK 0x06a3 Saitek +vendor ALCATELT 0x06b9 Alcatel Telecom +vendor AGFA 0x06bd AGFA-Gevaert +vendor ASIAMD 0x06be Asia Microelectronic Development +vendor BIZLINK 0x06c4 Bizlink International +vendor KEYSPAN 0x06cd Keyspan / InnoSys Inc. +vendor AASHIMA 0x06d6 Aashima Technology +vendor MULTITECH 0x06e0 MultiTech +vendor ADS 0x06e1 ADS Technologies +vendor ALCATELM 0x06e4 Alcatel Microelectronics +vendor SIRIUS 0x06ea Sirius Technologies +vendor GUILLEMOT 0x06f8 Guillemot +vendor BOSTON 0x06fd Boston Acoustics +vendor SMC 0x0707 Standard Microsystems +vendor PUTERCOM 0x0708 Putercom +vendor MCT 0x0711 MCT +vendor IMATION 0x0718 Imation +vendor SONYERICSSON 0x0731 Sony Ericsson +vendor EICON 0x0734 Eicon Networks +vendor SYNTECH 0x0745 Syntech Information +vendor DIGITALSTREAM 0x074e Digital Stream +vendor AUREAL 0x0755 Aureal Semiconductor +vendor MIDIMAN 0x0763 Midiman +vendor CYBERPOWER 0x0764 Cyber Power Systems, Inc. +vendor SURECOM 0x0769 Surecom Technology +vendor LINKSYS2 0x077b Linksys +vendor GRIFFIN 0x077d Griffin Technology +vendor SANDISK 0x0781 SanDisk +vendor JENOPTIK 0x0784 Jenoptik +vendor LOGITEC 0x0789 Logitec +vendor BRIMAX 0x078e Brimax +vendor AXIS 0x0792 Axis Communications +vendor ABL 0x0794 ABL Electronics +vendor SAGEM 0x079b Sagem +vendor SUNCOMM 0x079c Sun Communications, Inc. +vendor ALFADATA 0x079d Alfadata Computer +vendor NATIONALTECH 0x07a2 National Technical Systems +vendor ONNTO 0x07a3 Onnto +vendor BE 0x07a4 Be +vendor ADMTEK 0x07a6 ADMtek +vendor COREGA 0x07aa Corega +vendor FREECOM 0x07ab Freecom +vendor MICROTECH 0x07af Microtech +vendor GENERALINSTMNTS 0x07b2 General Instruments (Motorola) +vendor OLYMPUS 0x07b4 Olympus +vendor ABOCOM 0x07b8 AboCom Systems +vendor KEISOKUGIKEN 0x07c1 Keisokugiken +vendor ONSPEC 0x07c4 OnSpec +vendor APG 0x07c5 APG Cash Drawer +vendor BUG 0x07c8 B.U.G. +vendor ALLIEDTELESYN 0x07c9 Allied Telesyn International +vendor AVERMEDIA 0x07ca AVerMedia Technologies +vendor SIIG 0x07cc SIIG +vendor CASIO 0x07cf CASIO +vendor DLINK2 0x07d1 D-Link +vendor APTIO 0x07d2 Aptio Products +vendor ARASAN 0x07da Arasan Chip Systems +vendor ALLIEDCABLE 0x07e6 Allied Cable +vendor STSN 0x07ef STSN +vendor CENTURY 0x07f7 Century Corp +vendor ZOOM 0x0803 Zoom Telephonics +vendor PCS 0x0810 Personal Communication Systems +vendor BROADLOGIC 0x0827 BroadLogic +vendor HANDSPRING 0x082d Handspring +vendor PALM 0x0830 Palm Computing +vendor SOURCENEXT 0x0833 SOURCENEXT +vendor ACTIONSTAR 0x0835 Action Star Enterprise +vendor SAMSUNG_TECHWIN 0x0839 Samsung Techwin +vendor ACCTON 0x083a Accton Technology +vendor DIAMOND 0x0841 Diamond +vendor NETGEAR 0x0846 BayNETGEAR +vendor TOPRE 0x0853 Topre Corporation +vendor ACTIVEWIRE 0x0854 ActiveWire +vendor BBELECTRONICS 0x0856 B&B Electronics +vendor PORTGEAR 0x085a PortGear +vendor NETGEAR2 0x0864 Netgear +vendor SYSTEMTALKS 0x086e System Talks +vendor METRICOM 0x0870 Metricom +vendor ADESSOKBTEK 0x087c ADESSO/Kbtek America +vendor JATON 0x087d Jaton +vendor APT 0x0880 APT Technologies +vendor BOCARESEARCH 0x0885 Boca Research +vendor ANDREA 0x08a8 Andrea Electronics +vendor BURRBROWN 0x08bb Burr-Brown Japan +vendor 2WIRE 0x08c8 2Wire +vendor AIPTEK 0x08ca AIPTEK International +vendor SMARTBRIDGES 0x08d1 SmartBridges +vendor BILLIONTON 0x08dd Billionton Systems +vendor EXTENDED 0x08e9 Extended Systems +vendor MSYSTEMS 0x08ec M-Systems +vendor AUTHENTEC 0x08ff AuthenTec +vendor AUDIOTECHNICA 0x0909 Audio-Technica +vendor TRUMPION 0x090a Trumpion Microelectronics +vendor FEIYA 0x090c Feiya +vendor ALATION 0x0910 Alation Systems +vendor GLOBESPAN 0x0915 Globespan +vendor CONCORDCAMERA 0x0919 Concord Camera +vendor GARMIN 0x091e Garmin International +vendor GOHUBS 0x0921 GoHubs +vendor XEROX 0x0924 Xerox +vendor BIOMETRIC 0x0929 American Biometric Company +vendor TOSHIBA 0x0930 Toshiba +vendor PLEXTOR 0x093b Plextor +vendor INTREPIDCS 0x093c Intrepid +vendor YANO 0x094f Yano +vendor KINGSTON 0x0951 Kingston Technology +vendor BLUEWATER 0x0956 BlueWater Systems +vendor AGILENT 0x0957 Agilent Technologies +vendor GUDE 0x0959 Gude ADS +vendor PORTSMITH 0x095a Portsmith +vendor ACERW 0x0967 Acer +vendor ADIRONDACK 0x0976 Adirondack Wire & Cable +vendor BECKHOFF 0x0978 Beckhoff +vendor MINDSATWORK 0x097a Minds At Work +vendor POINTCHIPS 0x09a6 PointChips +vendor INTERSIL 0x09aa Intersil +vendor ALTIUS 0x09b3 Altius Solutions +vendor ARRIS 0x09c1 Arris Interactive +vendor ACTIVCARD 0x09c3 ACTIVCARD +vendor ACTISYS 0x09c4 ACTiSYS +vendor NOVATEL2 0x09d7 Novatel Wireless +vendor AFOURTECH 0x09da A-FOUR TECH +vendor AIMEX 0x09dc AIMEX +vendor ADDONICS 0x09df Addonics Technologies +vendor AKAI 0x09e8 AKAI professional M.I. +vendor ARESCOM 0x09f5 ARESCOM +vendor BAY 0x09f9 Bay Associates +vendor ALTERA 0x09fb Altera +vendor CSR 0x0a12 Cambridge Silicon Radio +vendor TREK 0x0a16 Trek Technology +vendor ASAHIOPTICAL 0x0a17 Asahi Optical +vendor BOCASYSTEMS 0x0a43 Boca Systems +vendor SHANTOU 0x0a46 ShanTou +vendor MEDIAGEAR 0x0a48 MediaGear +vendor BROADCOM 0x0a5c Broadcom +vendor GREENHOUSE 0x0a6b GREENHOUSE +vendor GEOCAST 0x0a79 Geocast Network Systems +vendor IDQUANTIQUE 0x0aba id Quantique +vendor ZYDAS 0x0ace Zydas Technology Corporation +vendor NEODIO 0x0aec Neodio +vendor OPTION 0x0af0 Option N.V: +vendor ASUS 0x0b05 ASUSTeK Computer +vendor TODOS 0x0b0c Todos Data System +vendor SIIG2 0x0b39 SIIG +vendor TEKRAM 0x0b3b Tekram Technology +vendor HAL 0x0b41 HAL Corporation +vendor EMS 0x0b43 EMS Production +vendor NEC2 0x0b62 NEC +vendor ATI2 0x0b6f ATI +vendor ZEEVO 0x0b7a Zeevo, Inc. +vendor KURUSUGAWA 0x0b7e Kurusugawa Electronics, Inc. +vendor ASIX 0x0b95 ASIX Electronics +vendor O2MICRO 0x0b97 O2 Micro, Inc. +vendor USR 0x0baf U.S. Robotics +vendor AMBIT 0x0bb2 Ambit Microsystems +vendor HTC 0x0bb4 HTC +vendor REALTEK 0x0bda Realtek +vendor ADDONICS2 0x0bf6 Addonics Technology +vendor FSC 0x0bf8 Fujitsu Siemens Computers +vendor AGATE 0x0c08 Agate Technologies +vendor DMI 0x0c0b DMI +vendor MICRODIA 0x0c45 Chicony +vendor SEALEVEL 0x0c52 Sealevel System +vendor LUWEN 0x0c76 Luwen +vendor KYOCERA2 0x0c88 Kyocera Wireless Corp. +vendor ZCOM 0x0cde Z-Com +vendor ATHEROS2 0x0cf3 Atheros Communications +vendor TANGTOP 0x0d3d Tangtop +vendor SMC3 0x0d5c Standard Microsystems +vendor ADDON 0x0d7d Add-on Technology +vendor ACDC 0x0d7e American Computer & Digital Components +vendor ABC 0x0d8c ABC +vendor CONCEPTRONIC 0x0d8e Conceptronic +vendor SKANHEX 0x0d96 Skanhex Technology, Inc. +vendor MSI 0x0db0 Micro Star International +vendor ELCON 0x0db7 ELCON Systemtechnik +vendor NETAC 0x0dd8 Netac +vendor SITECOMEU 0x0df6 Sitecom Europe +vendor MOBILEACTION 0x0df7 Mobile Action +vendor SPEEDDRAGON 0x0e55 Speed Dragon Multimedia +vendor HAWKING 0x0e66 Hawking +vendor FOSSIL 0x0e67 Fossil, Inc +vendor GMATE 0x0e7e G.Mate, Inc +vendor OTI 0x0ea0 Ours Technology +vendor PILOTECH 0x0eaf Pilotech +vendor NOVATECH 0x0eb0 NovaTech +vendor ITEGNO 0x0eba iTegno +vendor WINMAXGROUP 0x0ed1 WinMaxGroup +vendor TOD 0x0ede TOD +vendor EGALAX 0x0eef eGalax, Inc. +vendor AIRPRIME 0x0f3d AirPrime, Inc. +vendor MICROTUNE 0x0f4d Microtune +vendor VTECH 0x0f88 VTech +vendor FALCOM 0x0f94 Falcom Wireless Communications GmbH +vendor RIM 0x0fca Research In Motion +vendor DYNASTREAM 0x0fcf Dynastream Innovations +vendor QUALCOMM 0x1004 Qualcomm +vendor DESKNOTE 0x1019 Desknote +vendor GIGABYTE 0x1044 GIGABYTE +vendor WESTERN 0x1058 Western Digital +vendor MOTOROLA 0x1063 Motorola +vendor CCYU 0x1065 CCYU Technology +vendor CURITEL 0x106c Curitel Communications Inc +vendor SILABS2 0x10a6 SILABS2 +vendor USI 0x10ab USI +vendor PLX 0x10b5 PLX +vendor ASANTE 0x10bd Asante +vendor SILABS 0x10c4 Silicon Labs +vendor ANALOG 0x1110 Analog Devices +vendor TENX 0x1130 Ten X Technology, Inc. +vendor ISSC 0x1131 Integrated System Solution Corp. +vendor JRC 0x1145 Japan Radio Company +vendor SPHAIRON 0x114b Sphairon Access Systems GmbH +vendor DELORME 0x1163 DeLorme +vendor SERVERWORKS 0x1166 ServerWorks +vendor ACERCM 0x1189 Acer Communications & Multimedia +vendor SIERRA 0x1199 Sierra Wireless +vendor TOPFIELD 0x11db Topfield Co., Ltd +vendor SIEMENS3 0x11f5 Siemens +vendor PROLIFIC2 0x11f6 Prolific +vendor ALCATEL 0x11f7 Alcatel +vendor UNKNOWN3 0x1233 Unknown vendor +vendor TSUNAMI 0x1241 Tsunami +vendor PHEENET 0x124a Pheenet +vendor TARGUS 0x1267 Targus +vendor TWINMOS 0x126f TwinMOS +vendor TENDA 0x1286 Tenda +vendor CREATIVE2 0x1292 Creative Labs +vendor BELKIN2 0x1293 Belkin Components +vendor CYBERTAN 0x129b CyberTAN Technology +vendor HUAWEI 0x12d1 Huawei Technologies +vendor ARANEUS 0x12d8 Araneus Information Systems +vendor TAPWAVE 0x12ef Tapwave +vendor AINCOMM 0x12fd Aincomm +vendor MOBILITY 0x1342 Mobility +vendor DICKSMITH 0x1371 Dick Smith Electronics +vendor NETGEAR3 0x1385 Netgear +vendor BALTECH 0x13ad Baltech +vendor CISCOLINKSYS 0x13b1 Cisco-Linksys +vendor SHARK 0x13d2 Shark +vendor NOVATEL 0x1410 Novatel Wireless +vendor MERLIN 0x1416 Merlin +vendor WISTRONNEWEB 0x1435 Wistron NeWeb +vendor RADIOSHACK 0x1453 Radio Shack +vendor HUAWEI3COM 0x1472 Huawei-3Com +vendor SILICOM 0x1485 Silicom +vendor RALINK 0x148f Ralink Technology +vendor IMAGINATION 0x149a Imagination Technologies +vendor CONCEPTRONIC2 0x14b2 Conceptronic +vendor PLANEX3 0x14ea Planex Communications +vendor SILICONPORTALS 0x1527 Silicon Portals +vendor UBIQUAM 0x1529 UBIQUAM Co., Ltd. +vendor UBLOX 0x1546 U-blox +vendor PNY 0x154b PNY +vendor OQO 0x1557 OQO +vendor UMEDIA 0x157e U-MEDIA Communications +vendor FIBERLINE 0x1582 Fiberline +vendor SPARKLAN 0x15a9 SparkLAN +vendor SOHOWARE 0x15e8 SOHOware +vendor UMAX 0x1606 UMAX Data Systems +vendor INSIDEOUT 0x1608 Inside Out Networks +vendor GOODWAY 0x1631 Good Way Technology +vendor ENTREGA 0x1645 Entrega +vendor ACTIONTEC 0x1668 Actiontec Electronics +vendor ATHEROS 0x168c Atheros Communications +vendor GIGASET 0x1690 Gigaset +vendor GLOBALSUN 0x16ab Global Sun Technology +vendor ANYDATA 0x16d5 AnyDATA Corporation +vendor JABLOTRON 0x16d6 Jablotron +vendor CMOTECH 0x16d8 CMOTECH Co., Ltd. +vendor AXESSTEL 0x1726 Axesstel Co., Ltd. +vendor LINKSYS4 0x1737 Linksys +vendor SENAO 0x1740 Senao +vendor METAGEEK 0x1781 MetaGeek +vendor AMIT 0x18c5 AMIT +vendor QCOM 0x18e8 Qcom +vendor LINKSYS3 0x1915 Linksys +vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated +vendor DLINK 0x2001 D-Link +vendor PLANEX2 0x2019 Planex Communications +vendor ERICSSON 0x2282 Ericsson +vendor MOTOROLA2 0x22b8 Motorola +vendor TRIPPLITE 0x2478 Tripp-Lite +vendor HIROSE 0x2631 Hirose Electric +vendor NHJ 0x2770 NHJ +vendor PLANEX 0x2c02 Planex Communications +vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd +vendor AEI 0x3334 AEI +vendor HANK 0x3353 Hank Connection +vendor PQI 0x3538 PQI +vendor DAISY 0x3579 Daisy Technology +vendor NI 0x3923 National Instruments +vendor MICRONET 0x3980 Micronet Communications +vendor IODATA2 0x40bb I-O Data +vendor IRIVER 0x4102 iRiver +vendor DELL 0x413c Dell +vendor WCH 0x4348 QinHeng Electronics +vendor ACEECA 0x4766 Aceeca +vendor AVERATEC 0x50c2 Averatec +vendor SWEEX 0x5173 Sweex +vendor ONSPEC2 0x55aa OnSpec Electronic Inc. +vendor ZINWELL 0x5a57 Zinwell +vendor SITECOM 0x6189 Sitecom +vendor ARKMICRO 0x6547 Arkmicro Technologies Inc. +vendor 3COM2 0x6891 3Com +vendor INTEL 0x8086 Intel +vendor SITECOM2 0x9016 Sitecom +vendor MOSCHIP 0x9710 MosChip Semiconductor +vendor 3COM3 0xa727 3Com +vendor HP2 0xf003 Hewlett Packard +vendor USRP 0xfffe GNU Radio USRP + +/* + * List of known products. Grouped by vendor. + */ + +/* 3Com products */ +product 3COM HOMECONN 0x009d HomeConnect Camera +product 3COM 3CREB96 0x00a0 Bluetooth USB Adapter +product 3COM 3C19250 0x03e8 3C19250 Ethernet Adapter +product 3COM 3CRSHEW696 0x0a01 3CRSHEW696 Wireless Adapter +product 3COM 3C460 0x11f8 HomeConnect 3C460 +product 3COM USR56K 0x3021 U.S.Robotics 56000 Voice FaxModem Pro +product 3COM 3C460B 0x4601 HomeConnect 3C460B +product 3COM2 3CRUSB10075 0xa727 3CRUSB10075 +product 3COM3 AR5523_1 0x6893 AR5523 +product 3COM3 AR5523_2 0x6895 AR5523 +product 3COM3 AR5523_3 0x6897 AR5523 + +product 3COMUSR OFFICECONN 0x0082 3Com OfficeConnect Analog Modem +product 3COMUSR USRISDN 0x008f 3Com U.S. Robotics Pro ISDN TA +product 3COMUSR HOMECONN 0x009d 3Com HomeConnect Camera +product 3COMUSR USR56K 0x3021 U.S. Robotics 56000 Voice FaxModem Pro + +/* AboCom products */ +product ABOCOM XX1 0x110c XX1 +product ABOCOM XX2 0x200c XX2 +product ABOCOM URE450 0x4000 URE450 Ethernet Adapter +product ABOCOM UFE1000 0x4002 UFE1000 Fast Ethernet Adapter +product ABOCOM DSB650TX_PNA 0x4003 1/10/100 Ethernet Adapter +product ABOCOM XX4 0x4004 XX4 +product ABOCOM XX5 0x4007 XX5 +product ABOCOM XX6 0x400b XX6 +product ABOCOM XX7 0x400c XX7 +product ABOCOM RTL8151 0x401a RTL8151 +product ABOCOM XX8 0x4102 XX8 +product ABOCOM XX9 0x4104 XX9 +product ABOCOM UF200 0x420a UF200 Ethernet +product ABOCOM WL54 0x6001 WL54 +product ABOCOM XX10 0xabc1 XX10 +product ABOCOM BWU613 0xb000 BWU613 +product ABOCOM HWU54DM 0xb21b HWU54DM +product ABOCOM RT2573_2 0xb21c RT2573 +product ABOCOM RT2573_3 0xb21d RT2573 +product ABOCOM RT2573_4 0xb21e RT2573 +product ABOCOM WUG2700 0xb21f WUG2700 + +/* Accton products */ +product ACCTON USB320_EC 0x1046 USB320-EC Ethernet Adapter +product ACCTON 2664W 0x3501 2664W +product ACCTON 111 0x3503 T-Sinus 111 Wireless Adapter +product ACCTON SMCWUSBG 0x4505 SMCWUSB-G +product ACCTON PRISM_GT 0x4521 PrismGT USB 2.0 WLAN +product ACCTON SS1001 0x5046 SpeedStream Ethernet Adapter +product ACCTON ZD1211B 0xe501 ZD1211B + +/* Aceeca products */ +product ACEECA MEZ1000 0x0001 MEZ1000 RDA + +/* Acer Communications & Multimedia (oemd by Surecom) */ +product ACERCM EP1427X2 0x0893 EP-1427X-2 Ethernet Adapter + +/* Acer Labs products */ +product ACERLABS M5632 0x5632 USB 2.0 Data Link + +/* Acer Peripherals, Inc. products */ +product ACERP ACERSCAN_C310U 0x12a6 Acerscan C310U +product ACERP ACERSCAN_320U 0x2022 Acerscan 320U +product ACERP ACERSCAN_640U 0x2040 Acerscan 640U +product ACERP ACERSCAN_620U 0x2060 Acerscan 620U +product ACERP ACERSCAN_4300U 0x20b0 Benq 3300U/4300U +product ACERP ACERSCAN_640BT 0x20be Acerscan 640BT +product ACERP ACERSCAN_1240U 0x20c0 Acerscan 1240U +product ACERP ATAPI 0x6003 ATA/ATAPI Adapter +product ACERP AWL300 0x9000 AWL300 Wireless Adapter +product ACERP AWL400 0x9001 AWL400 Wireless Adapter + +/* Acer Warp products */ +product ACERW WARPLINK 0x0204 Warplink + +/* Actiontec, Inc. products */ +product ACTIONTEC PRISM_25 0x0408 Prism2.5 Wireless Adapter +product ACTIONTEC PRISM_25A 0x0421 Prism2.5 Wireless Adapter A +product ACTIONTEC FREELAN 0x6106 ROPEX FreeLan 802.11b +product ACTIONTEC UAT1 0x7605 UAT1 Wireless Ethernet Adapter + +/* ACTiSYS products */ +product ACTISYS IR2000U 0x0011 ACT-IR2000U FIR + +/* ActiveWire, Inc. products */ +product ACTIVEWIRE IOBOARD 0x0100 I/O Board +product ACTIVEWIRE IOBOARD_FW1 0x0101 I/O Board, rev. 1 firmware + +/* Adaptec products */ +product ADAPTEC AWN8020 0x0020 AWN-8020 WLAN + +/* Addtron products */ +product ADDTRON AWU120 0xff31 AWU-120 + +/* ADMtek products */ +product ADMTEK PEGASUSII_4 0x07c2 AN986A Ethernet +product ADMTEK PEGASUS 0x0986 AN986 Ethernet +product ADMTEK PEGASUSII 0x8511 AN8511 Ethernet +product ADMTEK PEGASUSII_2 0x8513 AN8513 Ethernet +product ADMTEK PEGASUSII_3 0x8515 AN8515 Ethernet + +/* ADDON products */ +/* PNY OEMs these */ +product ADDON ATTACHE 0x1300 USB 2.0 Flash Drive +product ADDON ATTACHE 0x1300 USB 2.0 Flash Drive +product ADDON A256MB 0x1400 Attache 256MB USB 2.0 Flash Drive +product ADDON DISKPRO512 0x1420 USB 2.0 Flash Drive (DANE-ELEC zMate 512MB USB flash drive) + +/* Addonics products */ +product ADDONICS2 CABLE_205 0xa001 Cable 205 + +/* ADS products */ +product ADS UBS10BT 0x0008 UBS-10BT Ethernet +product ADS UBS10BTX 0x0009 UBS-10BT Ethernet + +/* AEI products */ +product AEI FASTETHERNET 0x1701 Fast Ethernet + +/* Agate Technologies products */ +product AGATE QDRIVE 0x0378 Q-Drive + +/* AGFA products */ +product AGFA SNAPSCAN1212U 0x0001 SnapScan 1212U +product AGFA SNAPSCAN1236U 0x0002 SnapScan 1236U +product AGFA SNAPSCANTOUCH 0x0100 SnapScan Touch +product AGFA SNAPSCAN1212U2 0x2061 SnapScan 1212U +product AGFA SNAPSCANE40 0x208d SnapScan e40 +product AGFA SNAPSCANE50 0x208f SnapScan e50 +product AGFA SNAPSCANE20 0x2091 SnapScan e20 +product AGFA SNAPSCANE25 0x2095 SnapScan e25 +product AGFA SNAPSCANE26 0x2097 SnapScan e26 +product AGFA SNAPSCANE52 0x20fd SnapScan e52 + +/* Ain Communication Technology products */ +product AINCOMM AWU2000B 0x1001 AWU2000B Wireless Adapter + +/* AIPTEK products */ +product AIPTEK POCKETCAM3M 0x2011 PocketCAM 3Mega +product AIPTEK2 PENCAM_MEGA_1_3 0x504a PenCam Mega 1.3 + +/* AirPrime products */ +product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card + +/* AKS products */ +product AKS USBHASP 0x0001 USB-HASP 0.06 + +/* Alcor Micro, Inc. products */ +product ALCOR2 KBD_HUB 0x2802 Kbd Hub + +product ALCOR MA_KBD_HUB 0x9213 MacAlly Kbd Hub +product ALCOR AU9814 0x9215 AU9814 Hub +product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader +product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard +product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub + +/* Altec Lansing products */ +product ALTEC ADA70 0x0070 ADA70 Speakers +product ALTEC ASC495 0xff05 ASC495 Speakers + +/* Allied Telesyn International products */ +product ALLIEDTELESYN ATUSB100 0xb100 AT-USB100 + +/* American Power Conversion products */ +product APC UPS 0x0002 Uninterruptible Power Supply + +/* Ambit Microsystems products */ +product AMBIT WLAN 0x0302 WLAN +product AMBIT NTL_250 0x6098 NTL 250 cable modem + +/* AMIT products */ +product AMIT CGWLUSB2GO 0x0002 CG-WLUSB2GO + +/* Anchor products */ +product ANCHOR EZUSB 0x2131 EZUSB +product ANCHOR EZLINK 0x2720 EZLINK + +/* AnyData products */ +product ANYDATA ADU_E100X 0x6501 CDMA 2000 1xRTT/EV-DO USB Modem +product ANYDATA ADU_500A 0x6502 CDMA 2000 EV-DO USB Modem + +/* AOX, Inc. products */ +product AOX USB101 0x0008 Ethernet + +/* American Power Conversion products */ +product APC UPS 0x0002 Uninterruptible Power Supply + +/* Apple Computer products */ +product APPLE EXT_KBD 0x020c Apple Extended USB Keyboard +product APPLE OPTMOUSE 0x0302 Optical mouse +product APPLE MIGHTYMOUSE 0x0304 Mighty Mouse +product APPLE EXT_KBD_HUB 0x1003 Hub in Apple Extended USB Keyboard +product APPLE SPEAKERS 0x1101 Speakers +product APPLE IPOD 0x1201 iPod +product APPLE IPOD2G 0x1202 iPod 2G +product APPLE IPOD3G 0x1203 iPod 3G +product APPLE IPOD_04 0x1204 iPod '04' +product APPLE IPODMINI 0x1205 iPod Mini +product APPLE IPOD_06 0x1206 iPod '06' +product APPLE IPOD_07 0x1207 iPod '07' +product APPLE IPOD_08 0x1208 iPod '08' +product APPLE IPODVIDEO 0x1209 iPod Video +product APPLE IPODNANO 0x120a iPod Nano +product APPLE IPHONE 0x1290 iPhone +product APPLE IPHONE_3G 0x1292 iPhone 3G +product APPLE ETHERNET 0x1402 Ethernet A1277 + +/* Arkmicro Technologies */ +product ARKMICRO ARK3116 0x0232 ARK3116 Serial + +/* Asahi Optical products */ +product ASAHIOPTICAL OPTIO230 0x0004 Digital camera +product ASAHIOPTICAL OPTIO330 0x0006 Digital camera + +/* Asante products */ +product ASANTE EA 0x1427 Ethernet + +/* ASIX Electronics products */ +product ASIX AX88172 0x1720 10/100 Ethernet +product ASIX AX88178 0x1780 AX88178 +product ASIX AX88772 0x7720 AX88772 + +/* ASUS products */ +product ASUS WL167G 0x1707 WL-167g Wireless Adapter +product ASUS WL159G 0x170c WL-159g +product ASUS A9T_WIFI 0x171b A9T wireless +product ASUS RT2573_1 0x1723 RT2573 +product ASUS RT2573_2 0x1724 RT2573 +product ASUS LCM 0x1726 LCM display +product ASUS P535 0x420f ASUS P535 PDA + +/* ATen products */ +product ATEN UC1284 0x2001 Parallel printer +product ATEN UC10T 0x2002 10Mbps Ethernet +product ATEN UC110T 0x2007 UC-110T Ethernet +product ATEN UC232A 0x2008 Serial +product ATEN UC210T 0x2009 UC-210T Ethernet +product ATEN DSB650C 0x4000 DSB-650C + +/* Atheros Communications products */ +product ATHEROS AR5523 0x0001 AR5523 +product ATHEROS AR5523_NF 0x0002 AR5523 (no firmware) +product ATHEROS2 AR5523_1 0x0001 AR5523 +product ATHEROS2 AR5523_1_NF 0x0002 AR5523 (no firmware) +product ATHEROS2 AR5523_2 0x0003 AR5523 +product ATHEROS2 AR5523_2_NF 0x0004 AR5523 (no firmware) +product ATHEROS2 AR5523_3 0x0005 AR5523 +product ATHEROS2 AR5523_3_NF 0x0006 AR5523 (no firmware) + +/* Atmel Comp. products */ +product ATMEL UHB124 0x3301 UHB124 hub +product ATMEL DWL120 0x7603 DWL-120 Wireless Adapter +product ATMEL BW002 0x7605 BW002 Wireless Adapter +product ATMEL WL1130USB 0x7613 WL-1130 USB +product ATMEL AT76C505A 0x7614 AT76c505a Wireless Adapter + +/* Avision products */ +product AVISION 1200U 0x0268 1200U scanner + +/* Axesstel products */ +product AXESSTEL DATAMODEM 0x1000 Data Modem + +/* Baltech products */ +product BALTECH CARDREADER 0x9999 Card reader + +/* B&B Electronics products */ +product BBELECTRONICS USOTL4 0xAC01 RS-422/485 + +/* Belkin products */ +/* product BELKIN F5U111 0x???? F5U111 Ethernet */ +product BELKIN F5D6050 0x0050 F5D6050 802.11b Wireless Adapter +product BELKIN FBT001V 0x0081 FBT001v2 Bluetooth +product BELKIN FBT003V 0x0084 FBT003v2 Bluetooth +product BELKIN F5U103 0x0103 F5U103 Serial +product BELKIN F5U109 0x0109 F5U109 Serial +product BELKIN USB2SCSI 0x0115 USB to SCSI +product BELKIN F8T012 0x0121 F8T012xx1 Bluetooth USB Adapter +product BELKIN USB2LAN 0x0121 USB to LAN +product BELKIN F5U208 0x0208 F5U208 VideoBus II +product BELKIN F5U237 0x0237 F5U237 USB 2.0 7-Port Hub +product BELKIN F5U257 0x0257 F5U257 Serial +product BELKIN F5U409 0x0409 F5U409 Serial +product BELKIN F6C550AVR 0x0551 F6C550-AVR UPS +product BELKIN F5U120 0x1203 F5U120-PC Hub +product BELKIN ZD1211B 0x4050 ZD1211B +product BELKIN F5D5055 0x5055 F5D5055 +product BELKIN F5D7050 0x7050 F5D7050 Wireless Adapter +product BELKIN F5D7051 0x7051 F5D7051 54g USB Network Adapter +product BELKIN F5D7050A 0x705a F5D7050A Wireless Adapter +/* Also sold as 'Ativa 802.11g wireless card' */ +product BELKIN F5D7050_V4000 0x705c F5D7050 v4000 Wireless Adapter +product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter +product BELKIN2 F5U002 0x0002 F5U002 Parallel printer + +/* Billionton products */ +product BILLIONTON USB100 0x0986 USB100N 10/100 FastEthernet +product BILLIONTON USBLP100 0x0987 USB100LP +product BILLIONTON USBEL100 0x0988 USB100EL +product BILLIONTON USBE100 0x8511 USBE100 +product BILLIONTON USB2AR 0x90ff USB2AR Ethernet + +/* Broadcom products */ +product BROADCOM BCM2033 0x2033 BCM2033 Bluetooth USB dongle + +/* Brother Industries products */ +product BROTHER HL1050 0x0002 HL-1050 laser printer + +/* Behavior Technology Computer products */ +product BTC BTC7932 0x6782 Keyboard with mouse port + +/* Canon, Inc. products */ +product CANON N656U 0x2206 CanoScan N656U +product CANON N1220U 0x2207 CanoScan N1220U +product CANON D660U 0x2208 CanoScan D660U +product CANON N676U 0x220d CanoScan N676U +product CANON N1240U 0x220e CanoScan N1240U +product CANON LIDE25 0x2220 CanoScan LIDE 25 +product CANON S10 0x3041 PowerShot S10 +product CANON S100 0x3045 PowerShot S100 +product CANON S200 0x3065 PowerShot S200 +product CANON REBELXT 0x30ef Digital Rebel XT + +/* CATC products */ +product CATC NETMATE 0x000a Netmate Ethernet +product CATC NETMATE2 0x000c Netmate2 Ethernet +product CATC CHIEF 0x000d USB Chief Bus & Protocol Analyzer +product CATC ANDROMEDA 0x1237 Andromeda hub + +/* CASIO products */ +product CASIO QV_DIGICAM 0x1001 QV DigiCam +product CASIO EXS880 0x1105 Exilim EX-S880 +product CASIO BE300 0x2002 BE-300 PDA +product CASIO NAMELAND 0x4001 CASIO Nameland EZ-USB + +/* CCYU products */ +product CCYU ED1064 0x2136 EasyDisk ED1064 + +/* Century products */ +product CENTURY EX35QUAT 0x011e Century USB Disk Enclosure + +/* Cherry products */ +product CHERRY MY3000KBD 0x0001 My3000 keyboard +product CHERRY MY3000HUB 0x0003 My3000 hub +product CHERRY CYBOARD 0x0004 CyBoard Keyboard + +/* Chic Technology products */ +product CHIC MOUSE1 0x0001 mouse +product CHIC CYPRESS 0x0003 Cypress USB Mouse + +/* Chicony products */ +product CHICONY KB8933 0x0001 KB-8933 keyboard +product CHICONY2 TWINKLECAM 0x600d TwinkleCam USB camera + +/* CH Products */ +product CHPRODUCTS PROTHROTTLE 0x00f1 Pro Throttle +product CHPRODUCTS PROPEDALS 0x00f2 Pro Pedals +product CHPRODUCTS FIGHTERSTICK 0x00f3 Fighterstick +product CHPRODUCTS FLIGHTYOKE 0x00ff Flight Sim Yoke + +/* Cisco-Linksys products */ +product CISCOLINKSYS WUSB54G 0x000d WUSB54G Wireless Adapter +product CISCOLINKSYS WUSB54GP 0x0011 WUSB54GP Wireless Adapter +product CISCOLINKSYS USB200MV2 0x0018 USB200M v2 +product CISCOLINKSYS HU200TS 0x001a HU200TS Wireless Adapter +product CISCOLINKSYS WUSB54GC 0x0020 WUSB54GC +product CISCOLINKSYS WUSB54GR 0x0023 WUSB54GR +product CISCOLINKSYS WUSBF54G 0x0024 WUSBF54G + +/* CMOTECH products */ +product CMOTECH CNU510 0x5141 CMOTECH CDMA Technologies USB modem +product CMOTECH CNU550 0x5543 CDMA 2000 1xRTT/1xEVDO USB modem +product CMOTECH CDMA_MODEM1 0x6280 CMOTECH CDMA Technologies USB modem + +/* Compaq products */ +product COMPAQ IPAQPOCKETPC 0x0003 iPAQ PocketPC +product COMPAQ PJB100 0x504a Personal Jukebox PJB100 +product COMPAQ IPAQLINUX 0x505a iPAQ Linux + +/* Composite Corp products looks the same as "TANGTOP" */ +product COMPOSITE USBPS2 0x0001 USB to PS2 Adaptor + +/* Conceptronic products */ +product CONCEPTRONIC PRISM_GT 0x3762 PrismGT USB 2.0 WLAN +product CONCEPTRONIC C11U 0x7100 C11U +product CONCEPTRONIC WL210 0x7110 WL-210 +product CONCEPTRONIC AR5523_1 0x7801 AR5523 +product CONCEPTRONIC AR5523_1_NF 0x7802 AR5523 (no firmware) +product CONCEPTRONIC AR5523_2 0x7811 AR5523 +product CONCEPTRONIC AR5523_2_NF 0x7812 AR5523 (no firmware) +product CONCEPTRONIC2 C54RU 0x3c02 C54RU WLAN +product CONCEPTRONIC2 C54RU2 0x3c22 C54RU + +/* Connectix products */ +product CONNECTIX QUICKCAM 0x0001 QuickCam + +/* Corega products */ +product COREGA ETHER_USB_T 0x0001 Ether USB-T +product COREGA FETHER_USB_TX 0x0004 FEther USB-TX +product COREGA WLAN_USB_USB_11 0x000c WirelessLAN USB-11 +product COREGA FETHER_USB_TXS 0x000d FEther USB-TXS +product COREGA WLANUSB 0x0012 Wireless LAN Stick-11 +product COREGA FETHER_USB2_TX 0x0017 FEther USB2-TX +product COREGA WLUSB_11_KEY 0x001a ULUSB-11 Key +product COREGA CGWLUSB2GL 0x002d CG-WLUSB2GL +product COREGA CGWLUSB2GPX 0x002e CG-WLUSB2GPX +product COREGA WLUSB_11_STICK 0x7613 WLAN USB Stick 11 +product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC + +/* Creative products */ +product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player +product CREATIVE NOMAD_IIMG 0x4004 Nomad II MG +product CREATIVE NOMAD 0x4106 Nomad +product CREATIVE2 VOIP_BLASTER 0x0258 Voip Blaster +product CREATIVE3 OPTICAL_MOUSE 0x0001 Notebook Optical Mouse + +/* Cambridge Silicon Radio Ltd. products */ +product CSR BT_DONGLE 0x0001 Bluetooth USB dongle +product CSR CSRDFU 0xffff USB Bluetooth Device in DFU State + +/* CTX products */ +product CTX EX1300 0x9999 Ex1300 hub + +/* Curitel products */ +product CURITEL HX550C 0x1101 CDMA 2000 1xRTT USB modem (HX-550C) +product CURITEL HX57XB 0x2101 CDMA 2000 1xRTT USB modem (HX-570/575B/PR-600) +product CURITEL PC5740 0x3701 Broadband Wireless modem + +/* CyberPower products */ +product CYBERPOWER 1500CAVRLCD 0x0501 1500CAVRLCD + +/* CyberTAN Technology products */ +product CYBERTAN TG54USB 0x1666 TG54USB + +/* Cypress Semiconductor products */ +product CYPRESS MOUSE 0x0001 mouse +product CYPRESS THERMO 0x0002 thermometer +product CYPRESS WISPY1A 0x0bad MetaGeek Wi-Spy +product CYPRESS KBDHUB 0x0101 Keyboard/Hub +product CYPRESS FMRADIO 0x1002 FM Radio +product CYPRESS USBRS232 0x5500 USB-RS232 Interface +product CYPRESS SLIM_HUB 0x6560 Slim Hub + +/* Daisy Technology products */ +product DAISY DMC 0x6901 USB MultiMedia Reader + +/* Dallas Semiconductor products */ +product DALLAS J6502 0x4201 J-6502 speakers + +/* Dell products */ +product DELL PORT 0x0058 Port Replicator +product DELL AIO926 0x5115 Photo AIO Printer 926 +product DELL BC02 0x8000 BC02 Bluetooth USB Adapter +product DELL PRISM_GT_1 0x8102 PrismGT USB 2.0 WLAN +product DELL TM350 0x8103 TrueMobile 350 Bluetooth USB Adapter +product DELL PRISM_GT_2 0x8104 PrismGT USB 2.0 WLAN +product DELL U740 0x8135 Dell U740 CDMA + +/* Delorme Paublishing products */ +product DELORME EARTHMATE 0x0100 Earthmate GPS + +/* Desknote products */ +product DESKNOTE UCR_61S2B 0x0c55 UCR-61S2B + +/* Diamond products */ +product DIAMOND RIO500USB 0x0001 Rio 500 USB + +/* Dick Smith Electronics (really C-Net) products */ +product DICKSMITH RT2573 0x9022 RT2573 +product DICKSMITH CWD854F 0x9032 C-Net CWD-854 rev F + +/* Digi International products */ +product DIGI ACCELEPORT2 0x0002 AccelePort USB 2 +product DIGI ACCELEPORT4 0x0004 AccelePort USB 4 +product DIGI ACCELEPORT8 0x0008 AccelePort USB 8 + +/* D-Link products */ +/* product DLINK DSBS25 0x0100 DSB-S25 serial */ +product DLINK DUBE100 0x1a00 10/100 Ethernet +product DLINK DSB650TX4 0x200c 10/100 Ethernet +product DLINK DWL120E 0x3200 DWL-120 rev E +product DLINK DWL122 0x3700 DWL-122 +product DLINK DWLG120 0x3701 DWL-G120 +product DLINK DWL120F 0x3702 DWL-120 rev F +product DLINK DWLAG132 0x3a00 DWL-AG132 +product DLINK DWLAG132_NF 0x3a01 DWL-AG132 (no firmware) +product DLINK DWLG132 0x3a02 DWL-G132 +product DLINK DWLG132_NF 0x3a03 DWL-G132 (no firmware) +product DLINK DWLAG122 0x3a04 DWL-AG122 +product DLINK DWLAG122_NF 0x3a05 DWL-AG122 (no firmware) +product DLINK DWLG122 0x3c00 DWL-G122 b1 Wireless Adapter +product DLINK DUBE100B1 0x3c05 DUB-E100 rev B1 +product DLINK DSB650C 0x4000 10Mbps Ethernet +product DLINK DSB650TX1 0x4001 10/100 Ethernet +product DLINK DSB650TX 0x4002 10/100 Ethernet +product DLINK DSB650TX_PNA 0x4003 1/10/100 Ethernet +product DLINK DSB650TX3 0x400b 10/100 Ethernet +product DLINK DSB650TX2 0x4102 10/100 Ethernet +product DLINK DSB650 0xabc1 10/100 Ethernet +product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 +product DLINK2 WUA1340 0x3c04 WUA-1340 +product DLINK2 DWA111 0x3c06 DWA-111 +product DLINK2 DWA110 0x3c07 DWA-110 + +/* DMI products */ +product DMI CFSM_RW 0xa109 CF/SM Reader/Writer + +/* DrayTek products */ +product DRAYTEK VIGOR550 0x0550 Vigor550 + +/* Dynastream Innovations */ +product DYNASTREAM ANTDEVBOARD 0x1003 ANT dev board + +/* EIZO products */ +product EIZO HUB 0x0000 hub +product EIZO MONITOR 0x0001 monitor + +/* ELCON Systemtechnik products */ +product ELCON PLAN 0x0002 Goldpfeil P-LAN + +/* Elecom products */ +product ELECOM MOUSE29UO 0x0002 mouse 29UO +product ELECOM LDUSBTX0 0x200c LD-USB/TX +product ELECOM LDUSBTX1 0x4002 LD-USB/TX +product ELECOM LDUSBLTX 0x4005 LD-USBL/TX +product ELECOM LDUSBTX2 0x400b LD-USB/TX +product ELECOM LDUSB20 0x4010 LD-USB20 +product ELECOM UCSGT 0x5003 UC-SGT +product ELECOM UCSGT0 0x5004 UC-SGT +product ELECOM LDUSBTX3 0xabc1 LD-USB/TX + +/* Elsa products */ +product ELSA MODEM1 0x2265 ELSA Modem Board +product ELSA USB2ETHERNET 0x3000 Microlink USB2Ethernet + +/* EMS products */ +product EMS DUAL_SHOOTER 0x0003 PSX gun controller converter + +/* Entrega products */ +product ENTREGA 1S 0x0001 1S serial +product ENTREGA 2S 0x0002 2S serial +product ENTREGA 1S25 0x0003 1S25 serial +product ENTREGA 4S 0x0004 4S serial +product ENTREGA E45 0x0005 E45 Ethernet +product ENTREGA CENTRONICS 0x0006 Parallel Port +product ENTREGA XX1 0x0008 Ethernet +product ENTREGA 1S9 0x0093 1S9 serial +product ENTREGA EZUSB 0x8000 EZ-USB +/* product ENTREGA SERIAL 0x8001 DB25 Serial */ +product ENTREGA 2U4S 0x8004 2U4S serial/usb hub +product ENTREGA XX2 0x8005 Ethernet +/* product ENTREGA SERIAL_DB9 0x8093 DB9 Serial */ + +/* Epson products */ +product EPSON PRINTER1 0x0001 USB Printer +product EPSON PRINTER2 0x0002 ISD USB Smart Cable for Mac +product EPSON PRINTER3 0x0003 ISD USB Smart Cable +product EPSON PRINTER5 0x0005 USB Printer +product EPSON 636 0x0101 Perfection 636U / 636Photo scanner +product EPSON 610 0x0103 Perfection 610 scanner +product EPSON 1200 0x0104 Perfection 1200U / 1200Photo scanner +product EPSON 1600 0x0107 Expression 1600 scanner +product EPSON 1640 0x010a Perfection 1640SU scanner +product EPSON 1240 0x010b Perfection 1240U / 1240Photo scanner +product EPSON 640U 0x010c Perfection 640U scanner +product EPSON 1250 0x010f Perfection 1250U / 1250Photo scanner +product EPSON 1650 0x0110 Perfection 1650 scanner +product EPSON GT9700F 0x0112 GT-9700F scanner +product EPSON GT9300UF 0x011b GT-9300UF scanner +product EPSON 3200 0x011c Perfection 3200 scanner +product EPSON 1260 0x011d Perfection 1260 scanner +product EPSON 1660 0x011e Perfection 1660 scanner +product EPSON 1670 0x011f Perfection 1670 scanner +product EPSON 1270 0x0120 Perfection 1270 scanner +product EPSON 2480 0x0121 Perfection 2480 scanner +product EPSON 3590 0x0122 Perfection 3590 scanner +product EPSON 4990 0x012a Perfection 4990 Photo scanner +product EPSON STYLUS_875DC 0x0601 Stylus Photo 875DC Card Reader +product EPSON STYLUS_895 0x0602 Stylus Photo 895 Card Reader +product EPSON CX5400 0x0808 CX5400 scanner +product EPSON 3500 0x080e CX-3500/3600/3650 MFP +product EPSON RX425 0x080f Stylus Photo RX425 scanner +product EPSON 4800 0x0819 CX4800 MP scanner +product EPSON 4200 0x0820 CX4200 MP scanner +product EPSON 5000 0x082b DX-50x0 MFP scanner +product EPSON 6000 0x082e DX-60x0 MFP scanner +product EPSON DX7400 0x0838 DX7400/CX7300 scanner +product EPSON DX8400 0x0839 DX8400 scanner + +/* e-TEK Labs products */ +product ETEK 1COM 0x8007 Serial + +/* Extended Systems products */ +product EXTENDED XTNDACCESS 0x0100 XTNDAccess IrDA + +/* FEIYA products */ +product FEIYA 5IN1 0x1132 5-in-1 Card Reader + +/* Fiberline */ +product FIBERLINE WL430U 0x6003 WL-430U + +/* Fossil, Inc products */ +product FOSSIL WRISTPDA 0x0002 Wrist PDA + +/* Freecom products */ +product FREECOM DVD 0xfc01 DVD drive + +/* Fujitsu Siemens Computers products */ +product FSC E5400 0x1009 PrismGT USB 2.0 WLAN + +/* Future Technology Devices products */ +product FTDI SERIAL_8U100AX 0x8372 8U100AX Serial +product FTDI SERIAL_8U232AM 0x6001 8U232AM Serial +product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial +/* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ +product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi +product FTDI TACTRIX_OPENPORT_13S 0xcc49 OpenPort 1.3 Subaru +product FTDI TACTRIX_OPENPORT_13U 0xcc4a OpenPort 1.3 Universal +product FTDI EISCOU 0xe888 Expert ISDN Control USB +product FTDI UOPTBR 0xe889 USB-RS232 OptoBridge +product FTDI EMCU2D 0xe88a Expert mouseCLOCK USB II +product FTDI PCMSFU 0xe88b Precision Clock MSF USB +product FTDI EMCU2H 0xe88c Expert mouseCLOCK USB II HBG +product FTDI USBSERIAL 0xfa00 Matrix Orbital USB Serial +product FTDI MX2_3 0xfa01 Matrix Orbital MX2 or MX3 +product FTDI MX4_5 0xfa02 Matrix Orbital MX4 or MX5 +product FTDI LK202 0xfa03 Matrix Orbital VK/LK202 Family +product FTDI LK204 0xfa04 Matrix Orbital VK/LK204 Family +product FTDI CFA_632 0xfc08 Crystalfontz CFA-632 USB LCD +product FTDI CFA_634 0xfc09 Crystalfontz CFA-634 USB LCD +product FTDI CFA_633 0xfc0b Crystalfontz CFA-633 USB LCD +product FTDI CFA_631 0xfc0c Crystalfontz CFA-631 USB LCD +product FTDI CFA_635 0xfc0d Crystalfontz CFA-635 USB LCD +product FTDI SEMC_DSS20 0xfc82 SEMC DSS-20 SyncStation + +/* Fuji photo products */ +product FUJIPHOTO MASS0100 0x0100 Mass Storage + +/* Fujitsu protducts */ +product FUJITSU AH_F401U 0x105b AH-F401U Air H device + +/* Garmin products */ +product GARMIN IQUE_3600 0x0004 iQue 3600 + +/* General Instruments (Motorola) products */ +product GENERALINSTMNTS SB5100 0x5100 SURFboard SB5100 Cable modem + +/* Genesys Logic products */ +product GENESYS GL620USB 0x0501 GL620USB Host-Host interface +product GENESYS GL650 0x0604 GL650 Hub +product GENESYS GL641USB 0x0700 GL641USB CompactFlash Card Reader +product GENESYS GL641USB2IDE_2 0x0701 GL641USB USB-IDE Bridge No 2 +product GENESYS GL641USB2IDE 0x0702 GL641USB USB-IDE Bridge +product GENESYS GL641USB_2 0x0760 GL641USB 6-in-1 Card Reader + +/* GIGABYTE products */ +product GIGABYTE GN54G 0x8001 GN-54G +product GIGABYTE GNBR402W 0x8002 GN-BR402W +product GIGABYTE GNWLBM101 0x8003 GN-WLBM101 +product GIGABYTE GNWBKG 0x8007 GN-WBKG +product GIGABYTE GNWB01GS 0x8008 GN-WB01GS +product GIGABYTE GNWI05GS 0x800a GN-WI05GS + +/* Gigaset products */ +product GIGASET WLAN 0x0701 WLAN +product GIGASET SMCWUSBTG 0x0710 SMCWUSBT-G +product GIGASET SMCWUSBTG_NF 0x0711 SMCWUSBT-G (no firmware) +product GIGASET AR5523 0x0712 AR5523 +product GIGASET AR5523_NF 0x0713 AR5523 (no firmware) +product GIGASET RT2573 0x0722 RT2573 + +/* Global Sun Technology product */ +product GLOBALSUN AR5523_1 0x7801 AR5523 +product GLOBALSUN AR5523_1_NF 0x7802 AR5523 (no firmware) +product GLOBALSUN AR5523_2 0x7811 AR5523 +product GLOBALSUN AR5523_2_NF 0x7812 AR5523 (no firmware) + +/* Globespan products */ +product GLOBESPAN PRISM_GT_1 0x2000 PrismGT USB 2.0 WLAN +product GLOBESPAN PRISM_GT_2 0x2002 PrismGT USB 2.0 WLAN + +/* G.Mate, Inc products */ +product GMATE YP3X00 0x1001 YP3X00 PDA + +/* GoHubs products */ +product GOHUBS GOCOM232 0x1001 GoCOM232 Serial + +/* Good Way Technology products */ +product GOODWAY GWUSB2E 0x6200 GWUSB2E +product GOODWAY RT2573 0xc019 RT2573 + +/* Gravis products */ +product GRAVIS GAMEPADPRO 0x4001 GamePad Pro + +/* GREENHOUSE products */ +product GREENHOUSE KANA21 0x0001 CF-writer with MP3 + +/* Griffin Technology */ +product GRIFFIN IMATE 0x0405 iMate, ADB Adapter + +/* Guillemot Corporation */ +product GUILLEMOT DALEADER 0xa300 DA Leader +product GUILLEMOT HWGUSB254 0xe000 HWGUSB2-54 WLAN +product GUILLEMOT HWGUSB254LB 0xe010 HWGUSB2-54-LB +product GUILLEMOT HWGUSB254V2AP 0xe020 HWGUSB2-54V2-AP + +/* Hagiwara products */ +product HAGIWARA FGSM 0x0002 FlashGate SmartMedia Card Reader +product HAGIWARA FGCF 0x0003 FlashGate CompactFlash Card Reader +product HAGIWARA FG 0x0005 FlashGate + +/* HAL Corporation products */ +product HAL IMR001 0x0011 Crossam2+USB IR commander + +/* Handspring, Inc. */ +product HANDSPRING VISOR 0x0100 Handspring Visor +product HANDSPRING TREO 0x0200 Handspring Treo +product HANDSPRING TREO600 0x0300 Handspring Treo 600 + +/* Hauppauge Computer Works */ +product HAUPPAUGE WINTV_USB_FM 0x4d12 WinTV USB FM + +/* Hawking Technologies products */ +product HAWKING UF100 0x400c 10/100 USB Ethernet + +/* Hitachi, Ltd. products */ +product HITACHI DVDCAM_DZ_MV100A 0x0004 DVD-CAM DZ-MV100A Camcorder +product HITACHI DVDCAM_USB 0x001e DVDCAM USB HS Interface + +/* HP products */ +product HP 895C 0x0004 DeskJet 895C +product HP 4100C 0x0101 Scanjet 4100C +product HP S20 0x0102 Photosmart S20 +product HP 880C 0x0104 DeskJet 880C +product HP 4200C 0x0105 ScanJet 4200C +product HP CDWRITERPLUS 0x0107 CD-Writer Plus +product HP KBDHUB 0x010c Multimedia Keyboard Hub +product HP G55XI 0x0111 OfficeJet G55xi +product HP HN210W 0x011c HN210W 802.11b WLAN +product HP 49GPLUS 0x0121 49g+ graphing calculator +product HP 6200C 0x0201 ScanJet 6200C +product HP S20b 0x0202 PhotoSmart S20 +product HP 815C 0x0204 DeskJet 815C +product HP 3300C 0x0205 ScanJet 3300C +product HP CDW8200 0x0207 CD-Writer Plus 8200e +product HP MMKEYB 0x020c Multimedia keyboard +product HP 1220C 0x0212 DeskJet 1220C +product HP 810C 0x0304 DeskJet 810C/812C +product HP 4300C 0x0305 Scanjet 4300C +product HP CDW4E 0x0307 CD-Writer+ CD-4e +product HP G85XI 0x0311 OfficeJet G85xi +product HP 1200 0x0317 LaserJet 1200 +product HP 5200C 0x0401 Scanjet 5200C +product HP 830C 0x0404 DeskJet 830C +product HP 3400CSE 0x0405 ScanJet 3400cse +product HP 6300C 0x0601 Scanjet 6300C +product HP 840C 0x0604 DeskJet 840c +product HP 2200C 0x0605 ScanJet 2200C +product HP 5300C 0x0701 Scanjet 5300C +product HP 4400C 0x0705 Scanjet 4400C +product HP 82x0C 0x0b01 Scanjet 82x0C +product HP 2300D 0x0b17 Laserjet 2300d +product HP 970CSE 0x1004 Deskjet 970Cse +product HP 5400C 0x1005 Scanjet 5400C +product HP 2215 0x1016 iPAQ 22xx/Jornada 548 +product HP 568J 0x1116 Jornada 568 +product HP 930C 0x1204 DeskJet 930c +product HP P2000U 0x1801 Inkjet P-2000U +product HP 640C 0x2004 DeskJet 640c +product HP 4670V 0x3005 ScanJet 4670v +product HP P1100 0x3102 Photosmart P1100 +product HP OJ4215 0x3d11 OfficeJet 4215 +product HP HN210E 0x811c Ethernet HN210E +product HP2 C500 0x6002 PhotoSmart C500 + +/* HTC products */ +product HTC WINMOBILE 0x00ce HTC USB Sync +product HTC PPC6700MODEM 0x00cf PPC6700 Modem +product HTC SMARTPHONE 0x0a51 SmartPhone USB Sync + +/* HUAWEI products */ +product HUAWEI MOBILE 0x1001 Huawei Mobile +product HUAWEI E220 0x1003 Huawei HSDPA modem + +/* HUAWEI 3com products */ +product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g + +/* IBM Corporation */ +product IBM USBCDROMDRIVE 0x4427 USB CD-ROM Drive + +/* Imagination Technologies products */ +product IMAGINATION DBX1 0x2107 DBX1 DSP core + +/* Inside Out Networks products */ +product INSIDEOUT EDGEPORT4 0x0001 EdgePort/4 serial ports + +/* In-System products */ +product INSYSTEM F5U002 0x0002 Parallel printer +product INSYSTEM ATAPI 0x0031 ATAPI Adapter +product INSYSTEM ISD110 0x0200 IDE Adapter ISD110 +product INSYSTEM ISD105 0x0202 IDE Adapter ISD105 +product INSYSTEM USBCABLE 0x081a USB cable +product INSYSTEM STORAGE_V2 0x5701 USB Storage Adapter V2 + +/* Intel products */ +product INTEL EASYPC_CAMERA 0x0110 Easy PC Camera +product INTEL TESTBOARD 0x9890 82930 test board + +/* Intersil products */ +product INTERSIL PRISM_GT 0x1000 PrismGT USB 2.0 WLAN +product INTERSIL PRISM_2X 0x3642 Prism2.x or Atmel WLAN + +/* Interpid Control Systems products */ +product INTREPIDCS VALUECAN 0x0601 ValueCAN CAN bus interface +product INTREPIDCS NEOVI 0x0701 NeoVI Blue vehicle bus interface + +/* I/O DATA products */ +product IODATA IU_CD2 0x0204 DVD Multi-plus unit iU-CD2 +product IODATA DVR_UEH8 0x0206 DVD Multi-plus unit DVR-UEH8 +product IODATA USBSSMRW 0x0314 USB-SSMRW SD-card +product IODATA USBSDRW 0x031e USB-SDRW SD-card +product IODATA USBETT 0x0901 USB ETT +product IODATA USBETTX 0x0904 USB ETTX +product IODATA USBETTXS 0x0913 USB ETTX +product IODATA USBWNB11A 0x0919 USB WN-B11 +product IODATA USBWNB11 0x0922 USB Airport WN-B11 +product IODATA ETGUS2 0x0930 ETG-US2 +product IODATA USBRSAQ 0x0a03 Serial USB-RSAQ1 +product IODATA2 USB2SC 0x0a09 USB2.0-SCSI Bridge USB2-SC + +/* Iomega products */ +product IOMEGA ZIP100 0x0001 Zip 100 +product IOMEGA ZIP250 0x0030 Zip 250 + +/* Ituner networks products */ +product ITUNERNET USBLCD2X20 0x0002 USB-LCD 2x20 + +/* Jablotron products */ +product JABLOTRON PC60B 0x0001 PC-60B + +/* Jaton products */ +product JATON EDA 0x5704 Ethernet + +/* JVC products */ +product JVC GR_DX95 0x000a GR-DX95 +product JVC MP_PRX1 0x3008 MP-PRX1 Ethernet + +/* JRC products */ +product JRC AH_J3001V_J3002V 0x0001 AirH PHONE AH-J3001V/J3002V + +/* Kawatsu products */ +product KAWATSU MH4000P 0x0003 MiniHub 4000P + +/* Keisokugiken Corp. products */ +product KEISOKUGIKEN USBDAQ 0x0068 HKS-0200 USBDAQ + +/* Kensington products */ +product KENSINGTON ORBIT 0x1003 Orbit USB/PS2 trackball +product KENSINGTON TURBOBALL 0x1005 TurboBall + +/* Keyspan products */ +product KEYSPAN USA28_NF 0x0101 USA-28 serial Adapter (no firmware) +product KEYSPAN USA28X_NF 0x0102 USA-28X serial Adapter (no firmware) +product KEYSPAN USA19_NF 0x0103 USA-19 serial Adapter (no firmware) +product KEYSPAN USA18_NF 0x0104 USA-18 serial Adapter (no firmware) +product KEYSPAN USA18X_NF 0x0105 USA-18X serial Adapter (no firmware) +product KEYSPAN USA19W_NF 0x0106 USA-19W serial Adapter (no firmware) +product KEYSPAN USA19 0x0107 USA-19 serial Adapter +product KEYSPAN USA19W 0x0108 USA-19W serial Adapter +product KEYSPAN USA49W_NF 0x0109 USA-49W serial Adapter (no firmware) +product KEYSPAN USA49W 0x010a USA-49W serial Adapter +product KEYSPAN USA19QI_NF 0x010b USA-19QI serial Adapter (no firmware) +product KEYSPAN USA19QI 0x010c USA-19QI serial Adapter +product KEYSPAN USA19Q_NF 0x010d USA-19Q serial Adapter (no firmware) +product KEYSPAN USA19Q 0x010e USA-19Q serial Adapter +product KEYSPAN USA28 0x010f USA-28 serial Adapter +product KEYSPAN USA28XXB 0x0110 USA-28X/XB serial Adapter +product KEYSPAN USA18 0x0111 USA-18 serial Adapter +product KEYSPAN USA18X 0x0112 USA-18X serial Adapter +product KEYSPAN USA28XB_NF 0x0113 USA-28XB serial Adapter (no firmware) +product KEYSPAN USA28XA_NF 0x0114 USA-28XB serial Adapter (no firmware) +product KEYSPAN USA28XA 0x0115 USA-28XA serial Adapter +product KEYSPAN USA18XA_NF 0x0116 USA-18XA serial Adapter (no firmware) +product KEYSPAN USA18XA 0x0117 USA-18XA serial Adapter +product KEYSPAN USA19QW_NF 0x0118 USA-19WQ serial Adapter (no firmware) +product KEYSPAN USA19QW 0x0119 USA-19WQ serial Adapter +product KEYSPAN USA19HA 0x0121 USA-19HS serial Adapter +product KEYSPAN UIA10 0x0201 UIA-10 remote control +product KEYSPAN UIA11 0x0202 UIA-11 remote control + +/* Kingston products */ +product KINGSTON XX1 0x0008 Ethernet +product KINGSTON KNU101TX 0x000a KNU101TX USB Ethernet + +/* Kawasaki products */ +product KLSI DUH3E10BT 0x0008 USB Ethernet +product KLSI DUH3E10BTN 0x0009 USB Ethernet + +/* Kodak products */ +product KODAK DC220 0x0100 Digital Science DC220 +product KODAK DC260 0x0110 Digital Science DC260 +product KODAK DC265 0x0111 Digital Science DC265 +product KODAK DC290 0x0112 Digital Science DC290 +product KODAK DC240 0x0120 Digital Science DC240 +product KODAK DC280 0x0130 Digital Science DC280 + +/* Konica Corp. Products */ +product KONICA CAMERA 0x0720 Digital Color Camera + +/* KYE products */ +product KYE NICHE 0x0001 Niche mouse +product KYE NETSCROLL 0x0003 Genius NetScroll mouse +product KYE FLIGHT2000 0x1004 Flight 2000 joystick +product KYE VIVIDPRO 0x2001 ColorPage Vivid-Pro scanner + +/* Kyocera products */ +product KYOCERA FINECAM_S3X 0x0100 Finecam S3x +product KYOCERA FINECAM_S4 0x0101 Finecam S4 +product KYOCERA FINECAM_S5 0x0103 Finecam S5 +product KYOCERA FINECAM_L3 0x0105 Finecam L3 +product KYOCERA AHK3001V 0x0203 AH-K3001V +product KYOCERA2 CDMA_MSM_K 0x17da Qualcomm Kyocera CDMA Technologies MSM + +/* LaCie products */ +product LACIE HD 0xa601 Hard Disk +product LACIE CDRW 0xa602 CD R/W + +/* Lexar products */ +product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader +product LEXAR CF_READER 0xb002 USB CF Reader + +/* Lexmark products */ +product LEXMARK S2450 0x0009 Optra S 2450 + +/* Linksys products */ +product LINKSYS MAUSB2 0x0105 Camedia MAUSB-2 +product LINKSYS USB10TX1 0x200c USB10TX +product LINKSYS USB10T 0x2202 USB10T Ethernet +product LINKSYS USB100TX 0x2203 USB100TX Ethernet +product LINKSYS USB100H1 0x2204 USB100H1 Ethernet/HPNA +product LINKSYS USB10TA 0x2206 USB10TA Ethernet +product LINKSYS USB10TX2 0x400b USB10TX +product LINKSYS2 WUSB11 0x2219 WUSB11 Wireless Adapter +product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 Ethernet +product LINKSYS3 WUSB11v28 0x2233 WUSB11 v2.8 Wireless Adapter +product LINKSYS4 USB1000 0x0039 USB1000 + +/* Logitech products */ +product LOGITECH M2452 0x0203 M2452 keyboard +product LOGITECH M4848 0x0301 M4848 mouse +product LOGITECH PAGESCAN 0x040f PageScan +product LOGITECH QUICKCAMWEB 0x0801 QuickCam Web +product LOGITECH QUICKCAMPRO 0x0810 QuickCam Pro +product LOGITECH QUICKCAMEXP 0x0840 QuickCam Express +product LOGITECH QUICKCAM 0x0850 QuickCam +product LOGITECH N43 0xc000 N43 +product LOGITECH N48 0xc001 N48 mouse +product LOGITECH MBA47 0xc002 M-BA47 mouse +product LOGITECH WMMOUSE 0xc004 WingMan Gaming Mouse +product LOGITECH BD58 0xc00c BD58 mouse +product LOGITECH UN58A 0xc030 iFeel Mouse +product LOGITECH UN53B 0xc032 iFeel MouseMan +product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme +product LOGITECH WMRPAD 0xc20a WingMan RumblePad +product LOGITECH WMJOY 0xc281 WingMan Force joystick +product LOGITECH BB13 0xc401 USB-PS/2 Trackball +product LOGITECH RK53 0xc501 Cordless mouse +product LOGITECH RB6 0xc503 Cordless keyboard +product LOGITECH MX700 0xc506 Cordless optical mouse +product LOGITECH QUICKCAMPRO2 0xd001 QuickCam Pro + +/* Logitec Corp. products */ +product LOGITEC LDR_H443SU2 0x0033 DVD Multi-plus unit LDR-H443SU2 +product LOGITEC LDR_H443U2 0x00b3 DVD Multi-plus unit LDR-H443U2 + +/* Lucent products */ +product LUCENT EVALKIT 0x1001 USS-720 evaluation kit + +/* Luwen products */ +product LUWEN EASYDISK 0x0005 EasyDisc + +/* Macally products */ +product MACALLY MOUSE1 0x0101 mouse + +/* MCT Corp. */ +product MCT HUB0100 0x0100 Hub +product MCT DU_H3SP_USB232 0x0200 D-Link DU-H3SP USB BAY Hub +product MCT USB232 0x0210 USB-232 Interface +product MCT SITECOM_USB232 0x0230 Sitecom USB-232 Products + +/* Melco, Inc products */ +product MELCO LUATX1 0x0001 LUA-TX Ethernet +product MELCO LUATX5 0x0005 LUA-TX Ethernet +product MELCO LUA2TX5 0x0009 LUA2-TX Ethernet +product MELCO LUAKTX 0x0012 LUA-KTX Ethernet +product MELCO DUBPXXG 0x001c USB-IDE Bridge: DUB-PxxG +product MELCO LUAU2KTX 0x003d LUA-U2-KTX Ethernet +product MELCO KG54YB 0x005e WLI-U2-KG54-YB WLAN +product MELCO KG54 0x0066 WLI-U2-KG54 WLAN +product MELCO KG54AI 0x0067 WLI-U2-KG54-AI WLAN +product MELCO NINWIFI 0x008b Nintendo Wi-Fi +product MELCO PCOPRS1 0x00b3 PC-OP-RS1 RemoteStation +product MELCO SG54HP 0x00d8 WLI-U2-SG54HP +product MELCO G54HP 0x00d9 WLI-U2-G54HP +product MELCO KG54L 0x00da WLI-U2-KG54L + +/* Merlin products */ +product MERLIN V620 0x1110 Merlin V620 + +/* MetaGeek products */ +product METAGEEK WISPY1B 0x083e MetaGeek Wi-Spy +product METAGEEK WISPY24X 0x083f MetaGeek Wi-Spy 2.4x + +/* Metricom products */ +product METRICOM RICOCHET_GS 0x0001 Ricochet GS + +/* MGE UPS Systems */ +product MGE UPS1 0x0001 MGE UPS SYSTEMS PROTECTIONCENTER 1 +product MGE UPS2 0xffff MGE UPS SYSTEMS PROTECTIONCENTER 2 + +/* Micro Star International products */ +product MSI BT_DONGLE 0x1967 Bluetooth USB dongle +product MSI UB11B 0x6823 UB11B +product MSI RT2570 0x6861 RT2570 +product MSI RT2570_2 0x6865 RT2570 +product MSI RT2570_3 0x6869 RT2570 +product MSI RT2573_1 0x6874 RT2573 +product MSI RT2573_2 0x6877 RT2573 +product MSI RT2573_3 0xa861 RT2573 +product MSI RT2573_4 0xa874 RT2573 + +/* Microdia products */ +product MICRODIA TWINKLECAM 0x600d TwinkleCam USB camera + +/* Microsoft products */ +product MICROSOFT SIDEPREC 0x0008 SideWinder Precision Pro +product MICROSOFT INTELLIMOUSE 0x0009 IntelliMouse +product MICROSOFT NATURALKBD 0x000b Natural Keyboard Elite +product MICROSOFT DDS80 0x0014 Digital Sound System 80 +product MICROSOFT SIDEWINDER 0x001a Sidewinder Precision Racing Wheel +product MICROSOFT INETPRO 0x001c Internet Keyboard Pro +product MICROSOFT TBEXPLORER 0x0024 Trackball Explorer +product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse +product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro +product MICROSOFT MN510 0x006e MN510 Wireless +product MICROSOFT MN110 0x007a 10/100 USB NIC +product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse +product MICROSOFT WLNOTEBOOK 0x00b9 Wireless Optical Mouse (Model 1023) +product MICROSOFT COMFORT3000 0x00d1 Comfort Optical Mouse 3000 (Model 1043) +product MICROSOFT WLNOTEBOOK2 0x00e1 Wireless Optical Mouse 3000 (Model 1056) +product MICROSOFT WLNOTEBOOK3 0x00d2 Wireless Optical Mouse 3000 (Model 1049) +product MICROSOFT WLUSBMOUSE 0x00b9 Wireless USB Mouse +product MICROSOFT XBOX360 0x0292 XBOX 360 WLAN + +/* Microtech products */ +product MICROTECH SCSIDB25 0x0004 USB-SCSI-DB25 +product MICROTECH SCSIHD50 0x0005 USB-SCSI-HD50 +product MICROTECH DPCM 0x0006 USB CameraMate +product MICROTECH FREECOM 0xfc01 Freecom USB-IDE + +/* Microtek products */ +product MICROTEK 336CX 0x0094 Phantom 336CX - C3 scanner +product MICROTEK X6U 0x0099 ScanMaker X6 - X6U +product MICROTEK C6 0x009a Phantom C6 scanner +product MICROTEK 336CX2 0x00a0 Phantom 336CX - C3 scanner +product MICROTEK V6USL 0x00a3 ScanMaker V6USL +product MICROTEK V6USL2 0x80a3 ScanMaker V6USL +product MICROTEK V6UL 0x80ac ScanMaker V6UL + +/* Microtune, Inc. products */ +product MICROTUNE BT_DONGLE 0x1000 Bluetooth USB dongle + +/* Midiman products */ +product MIDIMAN MIDISPORT2X2 0x1001 Midisport 2x2 + +/* MindsAtWork products */ +product MINDSATWORK WALLET 0x0001 Digital Wallet + +/* Minolta Co., Ltd. */ +product MINOLTA 2300 0x4001 Dimage 2300 +product MINOLTA S304 0x4007 Dimage S304 +product MINOLTA X 0x4009 Dimage X +product MINOLTA 5400 0x400e Dimage 5400 +product MINOLTA F300 0x4011 Dimage F300 +product MINOLTA E223 0x4017 Dimage E223 + +/* Mitsumi products */ +product MITSUMI CDRRW 0x0000 CD-R/RW Drive +product MITSUMI BT_DONGLE 0x641f Bluetooth USB dongle +product MITSUMI FDD 0x6901 USB FDD + +/* Mobility products */ +product MOBILITY EA 0x0204 Ethernet +product MOBILITY EASIDOCK 0x0304 EasiDock Ethernet + +/* MosChip products */ +product MOSCHIP MCS7703 0x7703 MCS7703 Serial Port Adapter +product MOSCHIP MCS7830 0x7830 MCS7830 Ethernet + +/* Motorola products */ +product MOTOROLA MC141555 0x1555 MC141555 hub controller +product MOTOROLA SB4100 0x4100 SB4100 USB Cable Modem +product MOTOROLA2 A41XV32X 0x2a22 A41x/V32x Mobile Phones +product MOTOROLA2 E398 0x4810 E398 Mobile Phone +product MOTOROLA2 USBLAN 0x600c USBLAN +product MOTOROLA2 USBLAN2 0x6027 USBLAN + +/* MultiTech products */ +product MULTITECH ATLAS 0xf101 MT5634ZBA-USB modem + +/* Mustek products */ +product MUSTEK 1200CU 0x0001 1200 CU scanner +product MUSTEK 600CU 0x0002 600 CU scanner +product MUSTEK 1200USB 0x0003 1200 USB scanner +product MUSTEK 1200UB 0x0006 1200 UB scanner +product MUSTEK 1200USBPLUS 0x0007 1200 USB Plus scanner +product MUSTEK 1200CUPLUS 0x0008 1200 CU Plus scanner +product MUSTEK BEARPAW1200F 0x0010 BearPaw 1200F scanner +product MUSTEK BEARPAW1200TA 0x021e BearPaw 1200TA scanner +product MUSTEK 600USB 0x0873 600 USB scanner +product MUSTEK MDC800 0xa800 MDC-800 digital camera + +/* M-Systems products */ +product MSYSTEMS DISKONKEY 0x0010 DiskOnKey +product MSYSTEMS DISKONKEY2 0x0011 DiskOnKey + +/* Myson products */ +product MYSON HEDEN 0x8818 USB-IDE + +/* National Semiconductor */ +product NATIONAL BEARPAW1200 0x1000 BearPaw 1200 +product NATIONAL BEARPAW2400 0x1001 BearPaw 2400 + +/* NEC products */ +product NEC HUB 0x55aa hub +product NEC HUB_B 0x55ab hub + +/* NEODIO products */ +product NEODIO ND3260 0x3260 8-in-1 Multi-format Flash Controller +product NEODIO ND5010 0x5010 Multi-format Flash Controller + +/* Netac products */ +product NETAC CF_CARD 0x1060 USB-CF-Card +product NETAC ONLYDISK 0x0003 OnlyDisk + +/* NetChip Technology Products */ +product NETCHIP TURBOCONNECT 0x1080 Turbo-Connect +product NETCHIP CLIK_40 0xa140 USB Clik! 40 +product NETCHIP ETHERNETGADGET 0xa4a2 Linux Ethernet/RNDIS gadget on pxa210/25x/26x + +/* Netgear products */ +product NETGEAR EA101 0x1001 Ethernet +product NETGEAR EA101X 0x1002 Ethernet +product NETGEAR FA101 0x1020 Ethernet 10/100, USB1.1 +product NETGEAR FA120 0x1040 USB 2.0 Ethernet +product NETGEAR WG111V2_2 0x4240 PrismGT USB 2.0 WLAN +product NETGEAR WG111U 0x4300 WG111U +product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) +product NETGEAR2 MA101 0x4100 MA101 +product NETGEAR2 MA101B 0x4102 MA101 Rev B +product NETGEAR3 WG111T 0x4250 WG111T +product NETGEAR3 WG111T_NF 0x4251 WG111T (no firmware) +product NETGEAR3 WPN111 0x5f00 WPN111 +product NETGEAR3 WPN111_NF 0x5f01 WPN111 (no firmware) + +/* Nikon products */ +product NIKON E990 0x0102 Digital Camera E990 +product NIKON LS40 0x4000 CoolScan LS40 ED +product NIKON D300 0x041a Digital Camera D300 + +/* NovaTech Products */ +product NOVATECH NV902 0x9020 NovaTech NV-902W +product NOVATECH RT2573 0x9021 RT2573 + +/* Novatel Wireless products */ +product NOVATEL V640 0x1100 Merlin V620 +product NOVATEL CDMA_MODEM 0x1110 Novatel Wireless Merlin CDMA +product NOVATEL V620 0x1110 Merlin V620 +product NOVATEL V740 0x1120 Merlin V740 +product NOVATEL V720 0x1130 Merlin V720 +product NOVATEL U740 0x1400 Merlin U740 +product NOVATEL U740_2 0x1410 Merlin U740 +product NOVATEL U870 0x1420 Merlin U870 +product NOVATEL XU870 0x1430 Merlin XU870 +product NOVATEL X950D 0x1450 Merlin X950D +product NOVATEL ES620 0x2100 ES620 CDMA +product NOVATEL U720 0x2110 Merlin U720 +product NOVATEL U727 0x4100 Merlin U727 CDMA +product NOVATEL MC950D 0x4400 Novatel MC950D HSUPA +product NOVATEL ZEROCD 0x5010 Novatel ZeroCD +product NOVATEL2 FLEXPACKGPS 0x0100 NovAtel FlexPack GPS receiver + +/* Merlin products */ +product MERLIN V620 0x1110 Merlin V620 + +/* Olympus products */ +product OLYMPUS C1 0x0102 C-1 Digital Camera +product OLYMPUS C700 0x0105 C-700 Ultra Zoom + +/* OmniVision Technologies, Inc. products */ +product OMNIVISION OV511 0x0511 OV511 Camera +product OMNIVISION OV511PLUS 0xa511 OV511+ Camera + +/* OnSpec Electronic, Inc. */ +product ONSPEC SDS_HOTFIND_D 0x0400 SDS-infrared.com Hotfind-D Infrared Camera +product ONSPEC MDCFE_B_CF_READER 0xa000 MDCFE-B USB CF Reader +product ONSPEC CFMS_RW 0xa001 SIIG/Datafab Memory Stick+CF Reader/Writer +product ONSPEC READER 0xa003 Datafab-based Reader +product ONSPEC CFSM_READER 0xa005 PNY/Datafab CF+SM Reader +product ONSPEC CFSM_READER2 0xa006 Simple Tech/Datafab CF+SM Reader +product ONSPEC MDSM_B_READER 0xa103 MDSM-B reader +product ONSPEC CFSM_COMBO 0xa109 USB to CF + SM Combo (LC1) +product ONSPEC UCF100 0xa400 FlashLink UCF-100 CompactFlash Reader +product ONSPEC2 IMAGEMATE_SDDR55 0xa103 ImageMate SDDR55 + +/* Option products */ +product OPTION VODAFONEMC3G 0x5000 Vodafone Mobile Connect 3G datacard +product OPTION GT3G 0x6000 GlobeTrotter 3G datacard +product OPTION GT3GQUAD 0x6300 GlobeTrotter 3G QUAD datacard +product OPTION GT3GPLUS 0x6600 GlobeTrotter 3G+ datacard +product OPTION GTMAX36 0x6701 GlobeTrotter Max 3.6 Modem +product OPTION GTMAXHSUPA 0x7001 GlobeTrotter HSUPA + +/* OQO */ +product OQO WIFI01 0x0002 model 01 WiFi interface +product OQO BT01 0x0003 model 01 Bluetooth interface +product OQO ETHER01PLUS 0x7720 model 01+ Ethernet +product OQO ETHER01 0x8150 model 01 Ethernet interface + +/* Palm Computing, Inc. product */ +product PALM SERIAL 0x0080 USB Serial +product PALM M500 0x0001 Palm m500 +product PALM M505 0x0002 Palm m505 +product PALM M515 0x0003 Palm m515 +product PALM I705 0x0020 Palm i705 +product PALM TUNGSTEN_Z 0x0031 Palm Tungsten Z +product PALM M125 0x0040 Palm m125 +product PALM M130 0x0050 Palm m130 +product PALM TUNGSTEN_T 0x0060 Palm Tungsten T +product PALM ZIRE31 0x0061 Palm Zire 31 +product PALM ZIRE 0x0070 Palm Zire + +/* Panasonic products */ +product PANASONIC LS120CAM 0x0901 LS-120 Camera +product PANASONIC KXL840AN 0x0d01 CD-R Drive KXL-840AN +product PANASONIC KXLRW32AN 0x0d09 CD-R Drive KXL-RW32AN +product PANASONIC KXLCB20AN 0x0d0a CD-R Drive KXL-CB20AN +product PANASONIC KXLCB35AN 0x0d0e DVD-ROM & CD-R/RW +product PANASONIC SDCAAE 0x1b00 MultiMediaCard + +/* Peracom products */ +product PERACOM SERIAL1 0x0001 Serial +product PERACOM ENET 0x0002 Ethernet +product PERACOM ENET3 0x0003 At Home Ethernet +product PERACOM ENET2 0x0005 Ethernet + +/* Philips products */ +product PHILIPS DSS350 0x0101 DSS 350 Digital Speaker System +product PHILIPS DSS 0x0104 DSS XXX Digital Speaker System +product PHILIPS HUB 0x0201 hub +product PHILIPS PCA646VC 0x0303 PCA646VC PC Camera +product PHILIPS PCVC680K 0x0308 PCVC680K Vesta Pro PC Camera +product PHILIPS DSS150 0x0471 DSS 150 Digital Speaker System +product PHILIPS SNU5600 0x1236 SNU5600 +product PHILIPS UM10016 0x1552 ISP 1581 Hi-Speed USB MPEG2 Encoder Reference Kit +product PHILIPS DIVAUSB 0x1801 DIVA USB mp3 player + +/* Philips Semiconductor products */ +product PHILIPSSEMI HUB1122 0x1122 hub + +/* P.I. Engineering products */ +product PIENGINEERING PS2USB 0x020b PS2 to Mac USB Adapter + +/* Planex Communications products */ +product PLANEX GW_US11H 0x14ea GW-US11H WLAN +product PLANEX2 GW_US11S 0x3220 GW-US11S WLAN +product PLANEX2 GW_US54GXS 0x5303 GW-US54GXS WLAN +product PLANEX2 GWUS54HP 0xab01 GW-US54HP +product PLANEX2 GWUS54MINI2 0xab50 GW-US54Mini2 +product PLANEX2 GWUS54SG 0xc002 GW-US54SG +product PLANEX2 GWUS54GZL 0xc007 GW-US54GZL +product PLANEX2 GWUS54GD 0xed01 GW-US54GD +product PLANEX2 GWUSMM 0xed02 GW-USMM +product PLANEX3 GWUS54GZ 0xab10 GW-US54GZ +product PLANEX3 GU1000T 0xab11 GU-1000T +product PLANEX3 GWUS54MINI 0xab13 GW-US54Mini + +/* Plextor Corp. */ +product PLEXTOR 40_12_40U 0x0011 PlexWriter 40/12/40U + +/* PLX products */ +product PLX TESTBOARD 0x9060 test board + +/* PNY products */ +product PNY ATTACHE2 0x0010 USB 2.0 Flash Drive + +/* PortGear products */ +product PORTGEAR EA8 0x0008 Ethernet +product PORTGEAR EA9 0x0009 Ethernet + +/* Portsmith products */ +product PORTSMITH EEA 0x3003 Express Ethernet + +/* Primax products */ +product PRIMAX G2X300 0x0300 G2-200 scanner +product PRIMAX G2E300 0x0301 G2E-300 scanner +product PRIMAX G2300 0x0302 G2-300 scanner +product PRIMAX G2E3002 0x0303 G2E-300 scanner +product PRIMAX 9600 0x0340 Colorado USB 9600 scanner +product PRIMAX 600U 0x0341 Colorado 600u scanner +product PRIMAX 6200 0x0345 Visioneer 6200 scanner +product PRIMAX 19200 0x0360 Colorado USB 19200 scanner +product PRIMAX 1200U 0x0361 Colorado 1200u scanner +product PRIMAX G600 0x0380 G2-600 scanner +product PRIMAX 636I 0x0381 ReadyScan 636i +product PRIMAX G2600 0x0382 G2-600 scanner +product PRIMAX G2E600 0x0383 G2E-600 scanner +product PRIMAX COMFORT 0x4d01 Comfort +product PRIMAX MOUSEINABOX 0x4d02 Mouse-in-a-Box +product PRIMAX PCGAUMS1 0x4d04 Sony PCGA-UMS1 + +/* Prolific products */ +product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface +product PROLIFIC PL2302 0x0001 PL2302 Host-Host interface +product PROLIFIC RSAQ2 0x04bb PL2303 Serial (IODATA USB-RSAQ2) +product PROLIFIC PL2303 0x2303 PL2303 Serial (ATEN/IOGEAR UC232A) +product PROLIFIC PL2305 0x2305 Parallel printer +product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller +product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface +product PROLIFIC PHAROS 0xaaa0 Prolific Pharos +product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial Adapter (IODATA USB-RSAQ3) +product PROLIFIC2 WSIM 0x2001 Willcom WSIM + +/* Putercom products */ +product PUTERCOM UPA100 0x047e USB-1284 BRIDGE + +/* Qcom products */ +product QCOM RT2573 0x6196 RT2573 +product QCOM RT2573_2 0x6229 RT2573 + +/* Qualcomm products */ +product QUALCOMM CDMA_MSM 0x6000 CDMA Technologies MSM phone +product QUALCOMM2 RWT_FCT 0x3100 RWT FCT-CDMA 2000 1xRTT modem +product QUALCOMM2 CDMA_MSM 0x3196 CDMA Technologies MSM modem +product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem +product QUALCOMMINC ZTE_STOR 0x2000 USB ZTE Storage + +/* Qtronix products */ +product QTRONIX 980N 0x2011 Scorpion-980N keyboard + +/* Quickshot products */ +product QUICKSHOT STRIKEPAD 0x6238 USB StrikePad + +/* Radio Shack */ +product RADIOSHACK USBCABLE 0x4026 USB to Serial Cable + +/* Rainbow Technologies products */ +product RAINBOW IKEY2000 0x1200 i-Key 2000 + +/* Ralink Technology products */ +product RALINK RT2570 0x1706 RT2500USB Wireless Adapter +product RALINK RT2570_2 0x2570 RT2500USB Wireless Adapter +product RALINK RT2573 0x2573 RT2501USB Wireless Adapter +product RALINK RT2671 0x2671 RT2601USB Wireless Adapter +product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter +product RALINK RT2573_2 0x9021 RT2501USB Wireless Adapter + +/* ReakTek products */ +/* Green House and CompUSA OEM this part */ +product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet + +/* Ricoh products */ +product RICOH VGPVCC2 0x1830 VGP-VCC2 Camera +product RICOH VGPVCC3 0x1832 VGP-VCC3 Camera +product RICOH VGPVCC2_2 0x1833 VGP-VCC2 Camera +product RICOH VGPVCC2_3 0x1834 VGP-VCC2 Camera +product RICOH VGPVCC7 0x183a VGP-VCC7 Camera +product RICOH VGPVCC8 0x183b VGP-VCC8 Camera + +/* Roland products */ +product ROLAND UM1 0x0009 UM-1 MIDI I/F +product ROLAND UM880N 0x0014 EDIROL UM-880 MIDI I/F (native) +product ROLAND UM880G 0x0015 EDIROL UM-880 MIDI I/F (generic) + +/* Rockfire products */ +product ROCKFIRE GAMEPAD 0x2033 gamepad 203USB + +/* RATOC Systems products */ +product RATOC REXUSB60 0xb000 REX-USB60 + +/* Sagem products */ +product SAGEM USBSERIAL 0x0027 USB-Serial Controller +product SAGEM XG760A 0x004a XG-760A +product SAGEM XG76NA 0x0062 XG-76NA + +/* Samsung products */ +product SAMSUNG ML6060 0x3008 ML-6060 laser printer +product SAMSUNG YP_U2 0x5050 YP-U2 MP3 Player +product SAMSUNG I500 0x6601 I500 Palm USB Phone + +/* Samsung Techwin products */ +product SAMSUNG_TECHWIN DIGIMAX_410 0x000a Digimax 410 + +/* SanDisk products */ +product SANDISK SDDR05A 0x0001 ImageMate SDDR-05a +product SANDISK SDDR31 0x0002 ImageMate SDDR-31 +product SANDISK SDDR05 0x0005 ImageMate SDDR-05 +product SANDISK SDDR12 0x0100 ImageMate SDDR-12 +product SANDISK SDDR09 0x0200 ImageMate SDDR-09 +product SANDISK SDDR75 0x0810 ImageMate SDDR-75 +product SANDISK SDCZ2_256 0x7104 Cruzer Mini 256MB +product SANDISK SDCZ4_128 0x7112 Cruzer Micro 128MB +product SANDISK SDCZ4_256 0x7113 Cruzer Micro 256MB + +/* Sanyo Electric products */ +product SANYO SCP4900 0x0701 Sanyo SCP-4900 USB Phone + +/* ScanLogic products */ +product SCANLOGIC SL11R 0x0002 SL11R IDE Adapter +product SCANLOGIC 336CX 0x0300 Phantom 336CX - C3 scanner + +/* Senao products */ +product SENAO NUB8301 0x2000 NUB-8301 + +/* ShanTou products */ +product SHANTOU ST268 0x0268 ST268 +product SHANTOU DM9601 0x9601 DM 9601 + +/* Shark products */ +product SHARK PA 0x0400 Pocket Adapter + +/* Sharp products */ +product SHARP SL5500 0x8004 Zaurus SL-5500 PDA +product SHARP SLA300 0x8005 Zaurus SL-A300 PDA +product SHARP SL5600 0x8006 Zaurus SL-5600 PDA +product SHARP SLC700 0x8007 Zaurus SL-C700 PDA +product SHARP SLC750 0x9031 Zaurus SL-C750 PDA +product SHARP WZERO3ES 0x9123 W-ZERO3 ES Smartphone + +/* Shuttle Technology products */ +product SHUTTLE EUSB 0x0001 E-USB Bridge +product SHUTTLE EUSCSI 0x0002 eUSCSI Bridge +product SHUTTLE SDDR09 0x0003 ImageMate SDDR09 +product SHUTTLE EUSBCFSM 0x0005 eUSB SmartMedia / CompactFlash Adapter +product SHUTTLE ZIOMMC 0x0006 eUSB MultiMediaCard Adapter +product SHUTTLE HIFD 0x0007 Sony Hifd +product SHUTTLE EUSBATAPI 0x0009 eUSB ATA/ATAPI Adapter +product SHUTTLE CF 0x000a eUSB CompactFlash Adapter +product SHUTTLE EUSCSI_B 0x000b eUSCSI Bridge +product SHUTTLE EUSCSI_C 0x000c eUSCSI Bridge +product SHUTTLE CDRW 0x0101 CD-RW Device +product SHUTTLE EUSBORCA 0x0325 eUSB ORCA Quad Reader + +/* Siemens products */ +product SIEMENS SPEEDSTREAM 0x1001 SpeedStream +product SIEMENS SPEEDSTREAM22 0x1022 SpeedStream 1022 +product SIEMENS2 WLL013 0x001b WLL013 +product SIEMENS2 ES75 0x0034 GSM module MC35 +product SIEMENS2 WL54G 0x3c06 54g USB Network Adapter +product SIEMENS3 SX1 0x0001 SX1 +product SIEMENS3 X65 0x0003 X65 +product SIEMENS3 X75 0x0004 X75 + +/* Sierra Wireless products */ +product SIERRA AIRCARD580 0x0112 Sierra Wireless AirCard 580 +product SIERRA AIRCARD595 0x0019 Sierra Wireless AirCard 595 +product SIERRA AC595U 0x0120 Sierra Wireless AirCard 595U +product SIERRA AC597E 0x0021 Sierra Wireless AirCard 597E +product SIERRA C597 0x0023 Sierra Wireless Compass 597 +product SIERRA AC880 0x6850 Sierra Wireless AirCard 880 +product SIERRA AC881 0x6851 Sierra Wireless AirCard 881 +product SIERRA AC880E 0x6852 Sierra Wireless AirCard 880E +product SIERRA AC881E 0x6853 Sierra Wireless AirCard 881E +product SIERRA AC880U 0x6855 Sierra Wireless AirCard 880U +product SIERRA AC881U 0x6856 Sierra Wireless AirCard 881U +product SIERRA EM5625 0x0017 EM5625 +product SIERRA MC5720 0x0218 MC5720 Wireless Modem +product SIERRA MC5720_2 0x0018 MC5720 +product SIERRA MC5725 0x0020 MC5725 +product SIERRA MINI5725 0x0220 Sierra Wireless miniPCI 5275 +product SIERRA MC8755_2 0x6802 MC8755 +product SIERRA MC8765 0x6803 MC8765 +product SIERRA MC8755 0x6804 MC8755 +product SIERRA AC875U 0x6812 AC875U HSDPA USB Modem +product SIERRA MC8755_3 0x6813 MC8755 HSDPA +product SIERRA MC8775_2 0x6815 MC8775 +product SIERRA AIRCARD875 0x6820 Aircard 875 HSDPA +product SIERRA MC8780 0x6832 MC8780 +product SIERRA MC8781 0x6833 MC8781 +product SIERRA TRUINSTALL 0x0fff Aircard Tru Installer + +/* Sigmatel products */ +product SIGMATEL I_BEAD100 0x8008 i-Bead 100 MP3 Player + +/* SIIG products */ +/* Also: Omnidirectional Control Technology products */ +product SIIG DIGIFILMREADER 0x0004 DigiFilm-Combo Reader +product SIIG WINTERREADER 0x0330 WINTERREADER Reader +product SIIG2 USBTOETHER 0x0109 USB TO Ethernet +product SIIG2 US2308 0x0421 Serial + +/* Silicom products */ +product SILICOM U2E 0x0001 U2E +product SILICOM GPE 0x0002 Psion Gold Port Ethernet + +/* SI Labs */ +product SILABS POLOLU 0x803b Pololu Serial +product SILABS ARGUSISP 0x8066 Argussoft ISP +product SILABS CRUMB128 0x807a Crumb128 board +product SILABS DEGREE 0x80ca Degree Controls Inc +product SILABS TRAQMATE 0x80ed Track Systems Traqmate +product SILABS SUUNTO 0x80f6 Suunto Sports Instrument +product SILABS BURNSIDE 0x813d Burnside Telecon Deskmobile +product SILABS HELICOM 0x815e Helicomm IP-Link 1220-DVM +product SILABS CP2102 0xea60 SILABS USB UART +product SILABS LIPOWSKY_JTAG 0x81c8 Lipowsky Baby-JTAG +product SILABS LIPOWSKY_LIN 0x81e2 Lipowsky Baby-LIN +product SILABS LIPOWSKY_HARP 0x8218 Lipowsky HARP-1 +product SILABS CP2102 0xea60 SILABS USB UARTa +product SILABS CP210X_2 0xea61 CP210x Serial +product SILABS2 DCU11CLONE 0xaa26 DCU-11 clone + +/* Silicon Portals Inc. */ +product SILICONPORTALS YAPPH_NF 0x0200 YAP Phone (no firmware) +product SILICONPORTALS YAPPHONE 0x0201 YAP Phone + +/* Sirius Technologies products */ +product SIRIUS ROADSTER 0x0001 NetComm Roadster II 56 USB + +/* Sitecom products */ +product SITECOM LN029 0x182d USB 2.0 Ethernet +product SITECOM SERIAL 0x2068 USB to serial cable (v2) +product SITECOM2 WL022 0x182d WL-022 + +/* Sitecom Europe products */ +product SITECOMEU LN028 0x061c LN-028 +product SITECOMEU WL113 0x9071 WL-113 +product SITECOMEU ZD1211B 0x9075 ZD1211B +product SITECOMEU WL172 0x90ac WL-172 +product SITECOMEU WL113R2 0x9712 WL-113 rev 2 + +/* Skanhex Technology products */ +product SKANHEX MD_7425 0x410a MD 7425 Camera +product SKANHEX SX_520Z 0x5200 SX 520z Camera + +/* SmartBridges products */ +product SMARTBRIDGES SMARTLINK 0x0001 SmartLink USB Ethernet +product SMARTBRIDGES SMARTNIC 0x0003 smartNIC 2 PnP Ethernet + +/* SMC products */ +product SMC 2102USB 0x0100 10Mbps Ethernet +product SMC 2202USB 0x0200 10/100 Ethernet +product SMC 2206USB 0x0201 EZ Connect USB Ethernet +product SMC 2862WG 0xee13 EZ Connect Wireless Adapter +product SMC2 2020HUB 0x2020 USB Hub +product SMC3 2662WUSB 0xa002 2662W-AR Wireless + +/* SOHOware products */ +product SOHOWARE NUB100 0x9100 10/100 USB Ethernet +product SOHOWARE NUB110 0x9110 10/100 USB Ethernet + +/* SOLID YEAR products */ +product SOLIDYEAR KEYBOARD 0x2101 Solid Year USB keyboard + +/* SONY products */ +product SONY DSC 0x0010 DSC cameras +product SONY MS_NW_MS7 0x0025 Memorystick NW-MS7 +product SONY PORTABLE_HDD_V2 0x002b Portable USB Harddrive V2 +product SONY MSACUS1 0x002d Memorystick MSAC-US1 +product SONY HANDYCAM 0x002e Handycam +product SONY MSC 0x0032 MSC memory stick slot +product SONY CLIE_35 0x0038 Sony Clie v3.5 +product SONY MS_PEG_N760C 0x0058 PEG N760c Memorystick +product SONY CLIE_40 0x0066 Sony Clie v4.0 +product SONY MS_MSC_U03 0x0069 Memorystick MSC-U03 +product SONY CLIE_40_MS 0x006d Sony Clie v4.0 Memory Stick slot +product SONY CLIE_S360 0x0095 Sony Clie s360 +product SONY CLIE_41_MS 0x0099 Sony Clie v4.1 Memory Stick slot +product SONY CLIE_41 0x009a Sony Clie v4.1 +product SONY CLIE_NX60 0x00da Sony Clie nx60 +product SONY CLIE_TH55 0x0144 Sony Clie th55 +product SONY CLIE_TJ37 0x0169 Sony Clie tj37 +product SONY RF_RECEIVER 0x01db Sony RF mouse/kbd Receiver VGP-WRC1 + +/* Sony Ericsson products */ +product SONYERICSSON DCU10 0x0528 USB Cable + +/* SOURCENEXT products */ +product SOURCENEXT KEIKAI8 0x039f KeikaiDenwa 8 +product SOURCENEXT KEIKAI8_CHG 0x012e KeikaiDenwa 8 with charger + +/* SparkLAN products */ +product SPARKLAN RT2573 0x0004 RT2573 + +/* Sphairon Access Systems GmbH products */ +product SPHAIRON UB801R 0x0110 UB801R + +/* STMicroelectronics products */ +product STMICRO BIOCPU 0x2016 Biometric Coprocessor +product STMICRO COMMUNICATOR 0x7554 USB Communicator + +/* STSN products */ +product STSN STSN0001 0x0001 Internet Access Device + +/* SUN Corporation products */ +product SUNTAC DS96L 0x0003 SUNTAC U-Cable type D2 +product SUNTAC PS64P1 0x0005 SUNTAC U-Cable type P1 +product SUNTAC VS10U 0x0009 SUNTAC Slipper U +product SUNTAC IS96U 0x000a SUNTAC Ir-Trinity +product SUNTAC AS64LX 0x000b SUNTAC U-Cable type A3 +product SUNTAC AS144L4 0x0011 SUNTAC U-Cable type A4 + +/* Sun Microsystems products */ +product SUN KEYBOARD 0x0005 Type 6 USB keyboard +/* XXX The above is a North American PC style keyboard possibly */ +product SUN MOUSE 0x0100 Type 6 USB mouse + +/* Supra products */ +product DIAMOND2 SUPRAEXPRESS56K 0x07da Supra Express 56K modem +product DIAMOND2 SUPRA2890 0x0b4a SupraMax 2890 56K Modem +product DIAMOND2 RIO600USB 0x5001 Rio 600 USB +product DIAMOND2 RIO800USB 0x5002 Rio 800 USB + +/* Surecom Technology products */ +product SURECOM RT2570 0x11f3 RT2570 +product SURECOM RT2573 0x31f3 RT2573 + +/* Sweex products */ +product SWEEX ZD1211 0x1809 ZD1211 + +/* System TALKS, Inc. */ +product SYSTEMTALKS SGCX2UL 0x1920 SGC-X2UL + +/* Tapwave products */ +product TAPWAVE ZODIAC 0x0100 Zodiac + +/* Taugagreining products */ +product TAUGA CAMERAMATE 0x0005 CameraMate (DPCM_USB) + +/* TDK products */ +product TDK UPA9664 0x0115 USB-PDC Adapter UPA9664 +product TDK UCA1464 0x0116 USB-cdmaOne Adapter UCA1464 +product TDK UHA6400 0x0117 USB-PHS Adapter UHA6400 +product TDK UPA6400 0x0118 USB-PHS Adapter UPA6400 +product TDK BT_DONGLE 0x0309 Bluetooth USB dongle + +/* TEAC products */ +product TEAC FD05PUB 0x0000 FD-05PUB floppy + +/* Tekram Technology products */ +product TEKRAM QUICKWLAN 0x1630 QuickWLAN +product TEKRAM ZD1211_1 0x5630 ZD1211 +product TEKRAM ZD1211_2 0x6630 ZD1211 + +/* Telex Communications products */ +product TELEX MIC1 0x0001 Enhanced USB Microphone + +/* Ten X Technology, Inc. */ +product TENX UAUDIO0 0xf211 USB audio headset + +/* Texas Intel products */ +product TI UTUSB41 0x1446 UT-USB41 hub +product TI TUSB2046 0x2046 TUSB2046 hub + +/* Thrustmaster products */ +product THRUST FUSION_PAD 0xa0a3 Fusion Digital Gamepad + +/* Topre Corporation products */ +product TOPRE HHKB 0x0100 HHKB Professional + +/* Toshiba Corporation products */ +product TOSHIBA POCKETPC_E740 0x0706 PocketPC e740 + +/* Trek Technology products */ +product TREK THUMBDRIVE 0x1111 ThumbDrive +product TREK MEMKEY 0x8888 IBM USB Memory Key +product TREK THUMBDRIVE_8MB 0x9988 ThumbDrive_8MB + +/* Tripp-Lite products */ +product TRIPPLITE U209 0x2008 Serial + +/* Trumpion products */ +product TRUMPION T33520 0x1001 T33520 USB Flash Card Controller +product TRUMPION C3310 0x1100 Comotron C3310 MP3 player +product TRUMPION MP3 0x1200 MP3 player + +/* TwinMOS */ +product TWINMOS G240 0xa006 G240 +product TWINMOS MDIV 0x1325 Memory Disk IV + +/* Ubiquam products */ +product UBIQUAM UALL 0x3100 CDMA 1xRTT USB Modem (U-100/105/200/300/520) + +/* Ultima products */ +product ULTIMA 1200UBPLUS 0x4002 1200 UB Plus scanner + +/* UMAX products */ +product UMAX ASTRA1236U 0x0002 Astra 1236U Scanner +product UMAX ASTRA1220U 0x0010 Astra 1220U Scanner +product UMAX ASTRA2000U 0x0030 Astra 2000U Scanner +product UMAX ASTRA2100U 0x0130 Astra 2100U Scanner +product UMAX ASTRA2200U 0x0230 Astra 2200U Scanner +product UMAX ASTRA3400 0x0060 Astra 3400 Scanner + +/* U-MEDIA Communications products */ +product UMEDIA TEW444UBEU 0x3006 TEW-444UB EU +product UMEDIA TEW444UBEU_NF 0x3007 TEW-444UB EU (no firmware) +product UMEDIA TEW429UB_A 0x300a TEW-429UB_A +product UMEDIA TEW429UB 0x300b TEW-429UB +product UMEDIA TEW429UBC1 0x300d TEW-429UB C1 +product UMEDIA ALL0298V2 0x3204 ALL0298 v2 +product UMEDIA AR5523_2 0x3205 AR5523 +product UMEDIA AR5523_2_NF 0x3206 AR5523 (no firmware) + +/* Universal Access products */ +product UNIACCESS PANACHE 0x0101 Panache Surf USB ISDN Adapter + +/* U.S. Robotics products */ +product USR USR5423 0x0121 USR5423 WLAN + +/* VIA Technologies products */ +product VIA USB2IDEBRIDGE 0x6204 USB 2.0 IDE Bridge + +/* USI products */ +product USI MC60 0x10c5 MC60 Serial + +/* VidzMedia products */ +product VIDZMEDIA MONSTERTV 0x4fb1 MonsterTV P2H + +/* Vision products */ +product VISION VC6452V002 0x0002 CPiA Camera + +/* Visioneer products */ +product VISIONEER 7600 0x0211 OneTouch 7600 +product VISIONEER 5300 0x0221 OneTouch 5300 +product VISIONEER 3000 0x0224 Scanport 3000 +product VISIONEER 6100 0x0231 OneTouch 6100 +product VISIONEER 6200 0x0311 OneTouch 6200 +product VISIONEER 8100 0x0321 OneTouch 8100 +product VISIONEER 8600 0x0331 OneTouch 8600 + +/* Vivitar products */ +product VIVITAR 35XX 0x0003 Vivicam 35Xx + +/* VTech products */ +product VTECH RT2570 0x3012 RT2570 +product VTECH ZD1211B 0x3014 ZD1211B + +/* Wacom products */ +product WACOM CT0405U 0x0000 CT-0405-U Tablet +product WACOM GRAPHIRE 0x0010 Graphire +product WACOM GRAPHIRE3_4X5 0x0013 Graphire 3 4x5 +product WACOM INTUOSA5 0x0021 Intuos A5 +product WACOM GD0912U 0x0022 Intuos 9x12 Graphics Tablet +/* WCH products*/ +product WCH CH341SER 0x5523 CH341/CH340 USB-Serial Bridge +/* Western Digital products */ +product WESTERN COMBO 0x0200 Firewire USB Combo +product WESTERN EXTHDD 0x0400 External HDD +product WESTERN HUB 0x0500 USB HUB +product WESTERN MYBOOK 0x0901 MyBook External HDD + +/* Windbond Electronics */ +product WINBOND UH104 0x5518 4-port USB Hub + +/* WinMaxGroup products */ +product WINMAXGROUP FLASH64MC 0x6660 USB Flash Disk 64M-C + +/* Wistron NeWeb products */ +product WISTRONNEWEB UR045G 0x0427 PrismGT USB 2.0 WLAN +product WISTRONNEWEB UR055G 0x0711 UR055G +product WISTRONNEWEB AR5523_1 0x0826 AR5523 +product WISTRONNEWEB AR5523_1_NF 0x0827 AR5523 (no firmware) +product WISTRONNEWEB AR5523_2 0x082a AR5523 +product WISTRONNEWEB AR5523_2_NF 0x0829 AR5523 (no firmware) + +/* Xerox products */ +product XEROX WCM15 0xffef WorkCenter M15 + +/* Xirlink products */ +product XIRLINK PCCAM 0x8080 IBM PC Camera + +/* Xyratex products */ +product XYRATEX PRISM_GT_1 0x2000 PrismGT USB 2.0 WLAN +product XYRATEX PRISM_GT_2 0x2002 PrismGT USB 2.0 WLAN + +/* Y-E Data products */ +product YEDATA FLASHBUSTERU 0x0000 Flashbuster-U + +/* Yamaha products */ +product YAMAHA UX256 0x1000 UX256 MIDI I/F +product YAMAHA UX96 0x1008 UX96 MIDI I/F +product YAMAHA RTA54I 0x4000 NetVolante RTA54i Broadband&ISDN Router +product YAMAHA RTA55I 0x4004 NetVolante RTA55i Broadband VoIP Router +product YAMAHA RTW65B 0x4001 NetVolante RTW65b Broadband Wireless Router +product YAMAHA RTW65I 0x4002 NetVolante RTW65i Broadband&ISDN Wireless Router + +/* Yano products */ +product YANO U640MO 0x0101 U640MO-03 +product YANO FW800HD 0x05fc METALWEAR-HDD + +/* Z-Com products */ +product ZCOM M4Y750 0x0001 M4Y-750 +product ZCOM XI725 0x0002 XI-725/726 +product ZCOM XI735 0x0005 XI-735 +product ZCOM XG703A 0x0008 PrismGT USB 2.0 WLAN +product ZCOM ZD1211 0x0011 ZD1211 +product ZCOM AR5523 0x0012 AR5523 +product ZCOM AR5523_NF 0x0013 AR5523 driver (no firmware) +product ZCOM ZD1211B 0x001a ZD1211B + +/* Zinwell products */ +product ZINWELL RT2570 0x0260 RT2570 + +/* Zoom Telephonics, Inc. products */ +product ZOOM 2986L 0x9700 2986L Fax modem + +/* Zoran Microelectronics products */ +product ZORAN EX20DSC 0x4343 Digital Camera EX-20 DSC + +/* Zydas Technology Corporation products */ +product ZYDAS ZD1211 0x1211 ZD1211 WLAN abg +product ZYDAS ZD1211B 0x1215 ZD1211B + +/* ZyXEL Communication Co. products */ +product ZYXEL OMNI56K 0x1500 Omni 56K Plus +product ZYXEL 980N 0x2011 Scorpion-980N keyboard +product ZYXEL ZYAIRG220 0x3401 ZyAIR G-220 +product ZYXEL G200V2 0x3407 G-200 v2 +product ZYXEL AG225H 0x3409 AG-225H +product ZYXEL M202 0x340a M-202 +product ZYXEL G220V2 0x340f G-220 v2 +product ZYXEL G202 0x3410 G-202
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/usbdevs2h.awk Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,318 @@ +#! /usr/bin/awk -f + +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. + +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +#- +# $NetBSD: usb/devlist2h.awk,v 1.9 2001/01/18 20:28:22 jdolecek Exp $ +# $FreeBSD: src/sys/tools/usbdevs2h.awk,v 1.7 2005/01/07 02:29:25 imp Exp $ +# +# Copyright (c) 1995, 1996 Christopher G. Demetriou +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Christopher G. Demetriou. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +function usage() +{ + print "usage: usbdevs2h.awk <srcfile> [-d|-D|-h|-H]"; + exit 1; +} + +function header(file) +{ + if (os == "NetBSD") + printf("/*\t\$NetBSD\$\t*/\n\n") > file + else if (os == "FreeBSD") + printf("/* \$FreeBSD\$ */\n\n") > file + else if (os == "OpenBSD") + printf("/*\t\$OpenBSD\$\t*/\n\n") > file + + printf("/*\n") > file + printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > file + printf(" *\n") > file + printf(" * generated from:\n") > file + printf(" * %s\n", VERSION) > file + printf(" */\n") > file +} + +function header_guard(file) +{ + printf("\n") > file + printf("#ifndef\t_SYS_USB_USBDEVS_H\n") > file + printf("#define\t_SYS_USB_USBDEVS_H\n\n") > file +} + +function header_trailer(file) +{ + printf("\n") > file + printf("#endif\t/* _SYS_USB_USBDEVS_H */\n") > file +} + +function vendor(hfile) +{ + nvendors++ + + vendorindex[$2] = nvendors; # record index for this name, for later. + vendors[nvendors, 1] = $2; # name + vendors[nvendors, 2] = $3; # id + if (hfile) + printf("#define\tUSB_VENDOR_%s\t%s\t", vendors[nvendors, 1], + vendors[nvendors, 2]) > hfile + + i = 3; f = 4; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + if (hfile) + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + if (hfile) + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + if (hfile) + printf("%s", $f) > hfile + if (f < NF && hfile) + printf(" ") > hfile + f++ + continue + } + vendors[nvendors, i] = $f + if (hfile) + printf("%s", vendors[nvendors, i]) > hfile + if (f < NF && hfile) + printf(" ") > hfile + i++; f++; + } + if (oparen && hfile) + printf(")") > hfile + if (ocomment && hfile) + printf(" */") > hfile + if (hfile) + printf("\n") > hfile +} + +function product(hfile) +{ + nproducts++ + + products[nproducts, 1] = $2; # vendor name + products[nproducts, 2] = $3; # product id + products[nproducts, 3] = $4; # id + if (hfile) + printf("#define\tUSB_PRODUCT_%s_%s\t%s\t", \ + products[nproducts, 1], products[nproducts, 2], \ + products[nproducts, 3]) > hfile + + i=4; f = 5; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + if (hfile) + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + if (hfile) + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + if (hfile) + printf("%s", $f) > hfile + if (f < NF && hfile) + printf(" ") > hfile + f++ + continue + } + products[nproducts, i] = $f + if (hfile) + printf("%s", products[nproducts, i]) > hfile + if (f < NF && hfile) + printf(" ") > hfile + i++; f++; + } + if (oparen && hfile) + printf(")") > hfile + if (ocomment && hfile) + printf(" */") > hfile + if (hfile) + printf("\n") > hfile +} + +function dump_dfile(dfile) +{ + printf("\n") > dfile + printf("const struct usb_knowndev usb_knowndevs[] = {\n") > dfile + for (i = 1; i <= nproducts; i++) { + printf("\t{\n") > dfile + printf("\t USB_VENDOR_%s, USB_PRODUCT_%s_%s,\n", + products[i, 1], products[i, 1], products[i, 2]) > dfile + printf("\t ") > dfile + printf("0") > dfile + printf(",\n") > dfile + + vendi = vendorindex[products[i, 1]]; + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[vendi, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[vendi, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + + printf("\t \"") > dfile + j = 4; + needspace = 0; + while (products[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", products[i, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + printf("\t},\n") > dfile + } + for (i = 1; i <= nvendors; i++) { + printf("\t{\n") > dfile + printf("\t USB_VENDOR_%s, 0,\n", vendors[i, 1]) > dfile + printf("\t USB_KNOWNDEV_NOPROD,\n") > dfile + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[i, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + printf("\t NULL,\n") > dfile + printf("\t},\n") > dfile + } + printf("\t{ 0, 0, 0, NULL, NULL, }\n") > dfile + printf("};\n") > dfile +} + +BEGIN { + +nproducts = nvendors = 0 +# Process the command line +for (i = 1; i < ARGC; i++) { + arg = ARGV[i]; + if (arg !~ /^-[dDhH]+$/ && arg !~ /devs$/) + usage(); + if (arg ~ /^-.*d/) + dfile="usbdevs_data.h" + if (arg ~ /^-.*D/) + dfile="/dev/stdout" + if (arg ~ /^-.*h/) + hfile="usbdevs.h" + if (arg ~ /^-.*H/) + hfile="/dev/stdout" + if (arg ~ /devs$/) + srcfile = arg; +} +ARGC = 1; +line=0; + +while ((getline < srcfile) > 0) { + line++; + if (line == 1) { + VERSION = $0 + gsub("\\$", "", VERSION) + if (dfile) + header(dfile) + if (hfile) { + header(hfile) + header_guard(hfile) + } + continue; + } + if ($1 == "vendor") { + vendor(hfile) + continue + } + if ($1 == "product") { + product(hfile) + continue + } + if ($0 == "") + blanklines++ + if (hfile) + print $0 > hfile + if (blanklines < 2 && dfile) + print $0 > dfile +} + +# close off the header guard + +if (hfile) + header_trailer(hfile) + +# print out the match tables + +if (dfile) + dump_dfile(dfile) +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/warlock/usbftdi.wlcmd Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,90 @@ +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +one usbser_state +one uftdi_state + +### specify the root functions + +root usbser_first_device +root usbser_putchar +root usbser_getchar +root usbser_ischar +root usbser_polledio_enter +root usbser_polledio_exit +root usbser_soft_state_size +root usbser_uftdi_open +root usbser_close +root usbser_wput +root usbser_wsrv +root usbser_rsrv +root usbser_tx_cb +root usbser_rx_cb +root usbser_status_cb +root usbser_wq_thread +root usbser_rq_thread +root usbser_disconnect_cb +root usbser_reconnect_cb +root usbser_cpr_suspend +root usbser_cpr_resume + +root uftdi_bulkin_cb +root uftdi_bulkout_cb + +### specify uftdi function pointers + +add ds_ops::ds_attach targets uftdi_attach +add ds_ops::ds_detach targets uftdi_detach +add ds_ops::ds_register_cb targets uftdi_register_cb +add ds_ops::ds_unregister_cb targets uftdi_unregister_cb +add ds_ops::ds_open_port targets uftdi_open_port +add ds_ops::ds_close_port targets uftdi_close_port +add ds_ops::ds_usb_power targets uftdi_usb_power +add ds_ops::ds_suspend targets uftdi_suspend +add ds_ops::ds_resume targets uftdi_resume +add ds_ops::ds_disconnect targets uftdi_disconnect +add ds_ops::ds_reconnect targets uftdi_reconnect +add ds_ops::ds_set_port_params targets uftdi_set_port_params +add ds_ops::ds_set_modem_ctl targets uftdi_set_modem_ctl +add ds_ops::ds_get_modem_ctl targets uftdi_get_modem_ctl +add ds_ops::ds_break_ctl targets uftdi_break_ctl +add ds_ops::ds_tx targets uftdi_tx +add ds_ops::ds_rx targets uftdi_rx +add ds_ops::ds_stop targets uftdi_stop +add ds_ops::ds_start targets uftdi_start +add ds_ops::ds_fifo_flush targets uftdi_fifo_flush +add ds_ops::ds_fifo_drain targets uftdi_fifo_drain +add ds_ops::ds_out_pipe targets uftdi_out_pipe +add ds_ops::ds_in_pipe targets uftdi_in_pipe + +add uftdi_state::uf_cb.cb_tx targets usbser_tx_cb +add uftdi_state::uf_cb.cb_rx targets usbser_rx_cb + +add bus_ops::bus_add_eventcall targets warlock_dummy +add bus_ops::bus_get_eventcookie targets warlock_dummy +add bus_ops::bus_post_event targets warlock_dummy +add bus_ops::bus_remove_eventcall targets warlock_dummy +add bus_ops::bus_intr_ctl targets warlock_dummy +add bus_ops::bus_config targets warlock_dummy +add bus_ops::bus_unconfig targets warlock_dummy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/warlock/usbftdi_with_usba.wlcmd Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,217 @@ +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +one ohci_state +one ehci_state +one uhci_state +one usbser_state +one uftdi_state + +### specify the root functions + +root usbser_first_device +root usbser_putchar +root usbser_getchar +root usbser_ischar +root usbser_polledio_enter +root usbser_polledio_exit +root usb_console_output_fini +root usb_console_input_enter +root usb_console_input_exit +root usb_console_input_fini +root usb_console_input_init +root usb_console_read +root usb_get_dev_descr +root usb_get_if_number +root usb_parse_CV_cfg_descr +root usb_parse_CV_ep_descr +root usb_parse_CV_if_descr +root usb_pipe_get_private +root usb_get_current_frame_number +root usb_get_max_isoc_pkts +root usb_pipe_set_private +root usba_ready_interface_node +root usba_free_hcdi_ops +root usba_async_req_raise_power +root usba_async_req_lower_power +root usb_req_raise_power +root usb_req_lower_power +root usb_set_device_pwrlvl0 +root usb_set_device_pwrlvl1 +root usb_set_device_pwrlvl2 +root usb_set_device_pwrlvl3 +root usb_is_pm_enabled +root usb_async_req +root usb_pipe_bulk_transfer_size +root usb_get_ep_data +root usba_pipe_get_policy +root usb_pipe_ctrl_xfer_wait +root usb_pipe_drain_reqs +root usb_try_serialize_access +root usb_fini_serialization +root usb_init_serialization +root usb_release_access +root usb_serialize_access +root usb_clr_feature +root usb_clear_feature +root usb_get_alt_if +root usb_get_ep_descr +root usb_get_if_descr +root usb_log +root usb_pipe_isoc_xfer +root usb_pipe_stop_isoc_polling +root usb_set_alt_if +root usb_set_cfg +root usb_get_cfg +root usb_ep_num +root usb_get_status +root usb_pipe_reset +root usb_log_descr_tree +root usb_print_descr_tree +root usb_rval2errno +root usb_register_hotplug_cbs +root usb_get_current_cfgidx +root usb_register_client +root usb_reset_device + +root usb_ugen_attach +root usb_ugen_close +root usb_ugen_detach +root usb_ugen_disconnect_ev_cb +root usb_ugen_get_hdl +root usb_ugen_open +root usb_ugen_poll +root usb_ugen_power +root usb_ugen_read +root usb_ugen_reconnect_ev_cb +root usb_ugen_write + +root hcdi_autoclearing +root hcdi_cb_thread +root hcdi_shared_cb_thread + +root hubd_restore_state_cb +root hubd_disconnect_event_cb +root hubd_post_resume_event_cb +root hubd_pre_suspend_event_cb +root hubd_reconnect_event_cb +root hubd_hotplug_thread +root hubd_reset_thread +root hubd_cpr_post_user_callb +root hubd_root_hub_cleanup_thread +root hubd_bus_power + +root usba_common_power +root usba_common_register_events +root usba_ready_interface_association_node +root usba_pipe_do_async_func_thread +root usba_pipe_sync_reset +root usba_get_hc_dma_attr +root usba_hcdi_get_req_private +root usba_hcdi_set_req_private +root usba_dbuf_tail +root usba_hubdi_power +root usba_hubdi_root_hub_power +root usba_get_hotplug_stats +root usba_reset_hotplug_stats +root usba_ascii_string_descr +root usba_move_list +root usba_taskq_destroy +root usba_mk_mctl +root usb_fail_checkpoint + +root ohci_intr +root ehci_intr + +### specify the uftdi root functions + +root usbser_soft_state_size +root usbser_uftdi_open +root usbser_close +root usbser_wput +root usbser_wsrv +root usbser_rsrv +root usbser_tx_cb +root usbser_rx_cb +root usbser_status_cb +root usbser_wq_thread +root usbser_rq_thread +root usbser_disconnect_cb +root usbser_reconnect_cb +root usbser_cpr_suspend +root usbser_cpr_resume + +root uftdi_bulkin_cb +root uftdi_bulkout_cb + +### specify uftdi function pointers + +add ds_ops::ds_attach targets uftdi_attach +add ds_ops::ds_detach targets uftdi_detach +add ds_ops::ds_register_cb targets uftdi_register_cb +add ds_ops::ds_unregister_cb targets uftdi_unregister_cb +add ds_ops::ds_open_port targets uftdi_open_port +add ds_ops::ds_close_port targets uftdi_close_port +add ds_ops::ds_usb_power targets uftdi_usb_power +add ds_ops::ds_suspend targets uftdi_suspend +add ds_ops::ds_resume targets uftdi_resume +add ds_ops::ds_disconnect targets uftdi_disconnect +add ds_ops::ds_reconnect targets uftdi_reconnect +add ds_ops::ds_set_port_params targets uftdi_set_port_params +add ds_ops::ds_set_modem_ctl targets uftdi_set_modem_ctl +add ds_ops::ds_get_modem_ctl targets uftdi_get_modem_ctl +add ds_ops::ds_break_ctl targets uftdi_break_ctl +add ds_ops::ds_tx targets uftdi_tx +add ds_ops::ds_rx targets uftdi_rx +add ds_ops::ds_stop targets uftdi_stop +add ds_ops::ds_start targets uftdi_start +add ds_ops::ds_fifo_flush targets uftdi_fifo_flush +add ds_ops::ds_fifo_drain targets uftdi_fifo_drain +add ds_ops::ds_out_pipe targets uftdi_out_pipe +add ds_ops::ds_in_pipe targets uftdi_in_pipe + +add uftdi_state::uf_cb.cb_tx targets usbser_tx_cb +add uftdi_state::uf_cb.cb_rx targets usbser_rx_cb + +add usb_ctrl_req::ctrl_cb targets warlock_dummy +add usb_ctrl_req::ctrl_exc_cb targets warlock_dummy +add usb_bulk_req::bulk_cb targets uftdi_bulkin_cb +add usb_bulk_req::bulk_exc_cb targets uftdi_bulkin_cb +add usb_bulk_req::bulk_cb targets uftdi_bulkout_cb +add usb_bulk_req::bulk_exc_cb targets uftdi_bulkout_cb + +add usb_isoc_req::isoc_cb targets warlock_dummy +add usb_isoc_req::isoc_exc_cb targets warlock_dummy +add usba_pipe_async_req::callback targets warlock_dummy +add usba_pipe_async_req::sync_func targets warlock_dummy +add usba_pm_req::cb targets warlock_dummy + +add ohci_trans_wrapper::tw_handle_td targets ohci_handle_ctrl_td +add ohci_trans_wrapper::tw_handle_td targets ohci_handle_bulk_td +add ohci_trans_wrapper::tw_handle_td targets ohci_handle_intr_td +add ohci_trans_wrapper::tw_handle_td targets ohci_handle_isoc_td + +add ehci_trans_wrapper::tw_handle_qtd targets ehci_handle_bulk_qtd +add ehci_trans_wrapper::tw_handle_qtd targets ehci_handle_intr_qtd +add ehci_trans_wrapper::tw_handle_qtd targets ehci_handle_ctrl_qtd
--- a/usr/src/uts/common/sys/Makefile Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/sys/Makefile Sun Apr 12 10:48:30 2009 -0700 @@ -64,7 +64,8 @@ # Generated headers GENHDRS= \ priv_const.h \ - priv_names.h + priv_names.h \ + usb/usbdevs.h CHKHDRS= \ acpi_drv.h \ @@ -1273,6 +1274,9 @@ priv_names.h: $(PRIVS_AWK) $(PRIVS_DEF) $(NAWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) -v pubhfile=$@ +usb/usbdevs.h: $(USBDEVS_AWK) $(USBDEVS_DATA) + $(NAWK) -f $(USBDEVS_AWK) $(USBDEVS_DATA) -H > $@ + LVMDERIVED_H: cd $(SRC)/uts/common/sys/lvm; pwd; $(MAKE)
--- a/usr/src/uts/common/sys/termios.h Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/common/sys/termios.h Sun Apr 12 10:48:30 2009 -0700 @@ -23,15 +23,13 @@ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_TERMIOS_H #define _SYS_TERMIOS_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) @@ -478,6 +476,7 @@ #define TIOCSTOP (tIOC|111) /* stop output, like ^S */ #define TIOCSTART (tIOC|110) /* start output, like ^Q */ #define TIOCSILOOP (tIOC|109) /* private to Sun; do not use */ +#define TIOCCILOOP (tIOC|108) /* private to Sun; do not use */ #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ @@ -580,6 +579,7 @@ #define B230400 20 #define B307200 21 #define B460800 22 +#define B921600 23 #ifndef _SYS_TTOLD_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/sys/usb/clients/usbser/usbftdi/uftdi_reg.h Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,402 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _USBSER_USBFTDI_UFTDI_REG_H +#define _USBSER_USBFTDI_UFTDI_REG_H + +/* + * $NetBSD: uftdireg.h,v 1.6 2002/07/11 21:14:28 augustss Exp $ + * $FreeBSD: src/sys/dev/usb/uftdireg.h,v 1.2 2004/07/01 17:16:20 brooks Exp $ + */ + +/* + * Definitions for the FTDI USB Single Port Serial Converter - + * known as FTDI_SIO (Serial Input/Output application of the chipset) + * + * Thanx to FTDI (http://www.ftdi.co.uk) for so kindly providing details + * of the protocol required to talk to the device and ongoing assistence + * during development. + * + * Bill Ryder - bryder@sgi.com of Silicon Graphics, Inc. is the original + * author of this file. + */ +/* Modified by Lennart Augustsson */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Vendor Request Interface */ +#define FTDI_SIO_RESET 0 /* Reset the port */ +#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ +#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */ +#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */ +#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ +#define FTDI_SIO_GET_STATUS 5 /* Retrieve current value of status reg */ +#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */ +#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */ + +/* Port Identifier Table */ +#define FTDI_PIT_DEFAULT 0 /* SIOA */ +#define FTDI_PIT_SIOA 1 /* SIOA */ +#define FTDI_PIT_SIOB 2 /* SIOB */ +#define FTDI_PIT_PARALLEL 3 /* Parallel */ + +enum uftdi_type { + UFTDI_TYPE_SIO, + UFTDI_TYPE_8U232AM +}; + +/* + * BmRequestType: 0100 0000B + * bRequest: FTDI_SIO_RESET + * wValue: Control Value + * 0 = Reset SIO + * 1 = Purge RX buffer + * 2 = Purge TX buffer + * wIndex: Port + * wLength: 0 + * Data: None + * + * The Reset SIO command has this effect: + * + * Sets flow control set to 'none' + * Event char = 0x0d + * Event trigger = disabled + * Purge RX buffer + * Purge TX buffer + * Clear DTR + * Clear RTS + * baud and data format not reset + * + * The Purge RX and TX buffer commands affect nothing except the buffers + * + */ +/* FTDI_SIO_RESET */ +#define FTDI_SIO_RESET_SIO 0 +#define FTDI_SIO_RESET_PURGE_RX 1 +#define FTDI_SIO_RESET_PURGE_TX 2 + + +/* + * BmRequestType: 0100 0000B + * bRequest: FTDI_SIO_SET_BAUDRATE + * wValue: BaudRate value - see below + * wIndex: Port + * wLength: 0 + * Data: None + */ +/* FTDI_SIO_SET_BAUDRATE */ +enum { + ftdi_sio_b300 = 0, + ftdi_sio_b600 = 1, + ftdi_sio_b1200 = 2, + ftdi_sio_b2400 = 3, + ftdi_sio_b4800 = 4, + ftdi_sio_b9600 = 5, + ftdi_sio_b19200 = 6, + ftdi_sio_b38400 = 7, + ftdi_sio_b57600 = 8, + ftdi_sio_b115200 = 9 +}; + +enum { + ftdi_8u232am_b300 = 0x2710, + ftdi_8u232am_b600 = 0x1388, + ftdi_8u232am_b1200 = 0x09c4, + ftdi_8u232am_b2400 = 0x04e2, + ftdi_8u232am_b4800 = 0x0271, + ftdi_8u232am_b9600 = 0x4138, + ftdi_8u232am_b19200 = 0x809c, + ftdi_8u232am_b38400 = 0xc04e, + ftdi_8u232am_b57600 = 0x0034, + ftdi_8u232am_b115200 = 0x001a, + ftdi_8u232am_b230400 = 0x000d, + ftdi_8u232am_b460800 = 0x4006, + ftdi_8u232am_b921600 = 0x8003, + ftdi_8u232am_b2000000 = 0x0001, /* special case for 2M baud */ + ftdi_8u232am_b3000000 = 0x0000, /* special case for 3M baud */ +}; + +/* + * BmRequestType: 0100 0000B + * bRequest: FTDI_SIO_SET_DATA + * wValue: Data characteristics (see below) + * wIndex: Port + * wLength: 0 + * Data: No + * + * Data characteristics + * + * B0..7 Number of data bits + * B8..10 Parity + * 0 = None + * 1 = Odd + * 2 = Even + * 3 = Mark + * 4 = Space + * B11..13 Stop Bits + * 0 = 1 + * 1 = 1.5 + * 2 = 2 + * B14..15 Reserved + * + */ +/* FTDI_SIO_SET_DATA */ +#define FTDI_SIO_SET_DATA_BITS(n) (n) +#define FTDI_SIO_SET_DATA_BITS_MASK 0xff + +#define FTDI_SIO_SET_DATA_PARITY_SHIFT 8 +#define FTDI_SIO_SET_DATA_PARITY_MASK 0x7 +#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) +#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8) +#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8) +#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8) +#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8) + +#define FTDI_SIO_SET_DATA_STOP_BITS_SHIFT 11 +#define FTDI_SIO_SET_DATA_STOP_BITS_MASK 0x3 +#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) +#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) +#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) + +#define FTDI_SIO_SET_BREAK (0x1 << 14) + + +/* + * BmRequestType: 0100 0000B + * bRequest: FTDI_SIO_MODEM_CTRL + * wValue: ControlValue (see below) + * wIndex: Port + * wLength: 0 + * Data: None + * + * NOTE: If the device is in RTS/CTS flow control, the RTS set by this + * command will be IGNORED without an error being returned + * Also - you can not set DTR and RTS with one control message + * + * ControlValue + * B0 DTR state + * 0 = reset + * 1 = set + * B1 RTS state + * 0 = reset + * 1 = set + * B2..7 Reserved + * B8 DTR state enable + * 0 = ignore + * 1 = use DTR state + * B9 RTS state enable + * 0 = ignore + * 1 = use RTS state + * B10..15 Reserved + */ +/* FTDI_SIO_MODEM_CTRL */ +#define FTDI_SIO_SET_DTR_MASK 0x1 +#define FTDI_SIO_SET_DTR_HIGH (1 | (FTDI_SIO_SET_DTR_MASK << 8)) +#define FTDI_SIO_SET_DTR_LOW (0 | (FTDI_SIO_SET_DTR_MASK << 8)) +#define FTDI_SIO_SET_RTS_MASK 0x2 +#define FTDI_SIO_SET_RTS_HIGH (2 | (FTDI_SIO_SET_RTS_MASK << 8)) +#define FTDI_SIO_SET_RTS_LOW (0 | (FTDI_SIO_SET_RTS_MASK << 8)) + + +/* + * BmRequestType: 0100 0000b + * bRequest: FTDI_SIO_SET_FLOW_CTRL + * wValue: Xoff/Xon + * wIndex: Protocol/Port - hIndex is protocl / lIndex is port + * wLength: 0 + * Data: None + * + * hIndex protocol is: + * B0 Output handshaking using RTS/CTS + * 0 = disabled + * 1 = enabled + * B1 Output handshaking using DTR/DSR + * 0 = disabled + * 1 = enabled + * B2 Xon/Xoff handshaking + * 0 = disabled + * 1 = enabled + * + * A value of zero in the hIndex field disables handshaking + * + * If Xon/Xoff handshaking is specified, the hValue field should contain the + * XOFF character and the lValue field contains the XON character. + */ +/* FTDI_SIO_SET_FLOW_CTRL */ +#define FTDI_SIO_DISABLE_FLOW_CTRL 0x0 +#define FTDI_SIO_RTS_CTS_HS 0x1 +#define FTDI_SIO_DTR_DSR_HS 0x2 +#define FTDI_SIO_XON_XOFF_HS 0x4 + + +/* + * BmRequestType: 0100 0000b + * bRequest: FTDI_SIO_SET_EVENT_CHAR + * wValue: Event Char + * wIndex: Port + * wLength: 0 + * Data: None + * + * wValue: + * B0..7 Event Character + * B8 Event Character Processing + * 0 = disabled + * 1 = enabled + * B9..15 Reserved + * + * FTDI_SIO_SET_EVENT_CHAR + * + * Set the special event character for the specified communications port. + * If the device sees this character it will immediately return the + * data read so far - rather than wait 40ms or until 62 bytes are read + * which is what normally happens. + */ + + + +/* + * BmRequestType: 0100 0000b + * bRequest: FTDI_SIO_SET_ERROR_CHAR + * wValue: Error Char + * wIndex: Port + * wLength: 0 + * Data: None + * + * Error Char + * B0..7 Error Character + * B8 Error Character Processing + * 0 = disabled + * 1 = enabled + * B9..15 Reserved + * + * + * FTDI_SIO_SET_ERROR_CHAR + * Set the parity error replacement character for the specified communications + * port. + */ + + +/* + * BmRequestType: 1100 0000b + * bRequest: FTDI_SIO_GET_MODEM_STATUS + * wValue: zero + * wIndex: Port + * wLength: 1 + * Data: Status + * + * One byte of data is returned + * B0..3 0 + * B4 CTS + * 0 = inactive + * 1 = active + * B5 DSR + * 0 = inactive + * 1 = active + * B6 Ring Indicator (RI) + * 0 = inactive + * 1 = active + * B7 Receive Line Signal Detect (RLSD) + * 0 = inactive + * 1 = active + * + * FTDI_SIO_GET_MODEM_STATUS + * Retrieve the current value of the modem status register. + */ +#define FTDI_SIO_CTS_MASK 0x10 +#define FTDI_SIO_DSR_MASK 0x20 +#define FTDI_SIO_RI_MASK 0x40 +#define FTDI_SIO_RLSD_MASK 0x80 + + + +/* + * + * DATA FORMAT + * + * IN Endpoint + * + * The device reserves the first two bytes of data on this endpoint to contain + * the current values of the modem and line status registers. In the absence of + * data, the device generates a message consisting of these two status bytes + * every 40 ms. + * + * Byte 0: Modem Status + * NOTE: 4 upper bits have same layout as the MSR register in a 16550 + * + * Offset Description + * B0..3 Port + * B4 Clear to Send (CTS) + * B5 Data Set Ready (DSR) + * B6 Ring Indicator (RI) + * B7 Receive Line Signal Detect (RLSD) + * + * Byte 1: Line Status + * NOTE: same layout as the LSR register in a 16550 + * + * Offset Description + * B0 Data Ready (DR) + * B1 Overrun Error (OE) + * B2 Parity Error (PE) + * B3 Framing Error (FE) + * B4 Break Interrupt (BI) + * B5 Transmitter Holding Register (THRE) + * B6 Transmitter Empty (TEMT) + * B7 Error in RCVR FIFO + * + * + * OUT Endpoint + * + * This device reserves the first bytes of data on this endpoint contain the + * length and port identifier of the message. For the FTDI USB Serial converter + * the port identifier is always 1. + * + * Byte 0: Port & length + * + * Offset Description + * B0..1 Port + * B2..7 Length of message - (not including Byte 0) + * + */ +#define FTDI_PORT_MASK 0x0f +#define FTDI_MSR_MASK 0xf0 +#define FTDI_GET_MSR(p) (((p)[0]) & FTDI_MSR_MASK) +#define FTDI_GET_LSR(p) ((p)[1]) +#define FTDI_LSR_MASK (~0x60) /* interesting bits */ + +#define FTDI_MSR_STATUS_CTS 0x10 +#define FTDI_MSR_STATUS_DSR 0x20 +#define FTDI_MSR_STATUS_RI 0x40 +#define FTDI_MSR_STATUS_RLSD 0x80 /* aka Carrier Detect */ + +#define FTDI_OUT_TAG(len, port) (((len) << 2) | (port)) + +#ifdef __cplusplus +} +#endif + +#endif /* _USBSER_USBFTDI_UFTDI_REG_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/sys/usb/clients/usbser/usbftdi/uftdi_var.h Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,172 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _USBSER_USBFTDI_UFTDI_VAR_H +#define _USBSER_USBFTDI_UFTDI_VAR_H + +/* + * USB UFTDI definitions + */ + +#include <sys/types.h> +#include <sys/dditypes.h> +#include <sys/note.h> + +#include <sys/usb/clients/usbser/usbser_dsdi.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * PM support + */ +typedef struct uftdi_pm { + uint8_t pm_wakeup_enabled; /* remote wakeup enabled */ + uint8_t pm_pwr_states; /* bit mask of power states */ + boolean_t pm_raise_power; /* driver is about to raise power */ + uint8_t pm_cur_power; /* current power level */ + uint_t pm_busy_cnt; /* number of set_busy requests */ +} uftdi_pm_t; + +typedef struct uftdi_regs { + uint16_t ur_baud; + uint16_t ur_data; + uint16_t ur_flowval; + uint16_t ur_flowidx; +} uftdi_regs_t; + +_NOTE(SCHEME_PROTECTS_DATA("uftdi_regs", uftdi_regs)) + +/* + * per device state structure + */ +typedef struct uftdi_state { + kmutex_t uf_lock; /* structure lock */ + dev_info_t *uf_dip; /* device info */ + int uf_dev_flags; /* device flags */ + int uf_port_state; /* port state */ + int uf_port_flags; /* port flags */ + ds_cb_t uf_cb; /* DSD callbacks */ + + /* + * USBA + */ + usb_client_dev_data_t *uf_dev_data; /* registration data */ + usb_event_t *uf_usb_events; /* usb events */ + usb_pipe_handle_t uf_def_ph; /* default pipe hdl */ + usb_pipe_handle_t uf_bulkin_ph; /* in pipe hdl */ + int uf_bulkin_state; /* in pipe state */ + usb_pipe_handle_t uf_bulkout_ph; /* in pipe hdl */ + int uf_bulkout_state; /* out pipe state */ + usb_log_handle_t uf_lh; /* USBA log handle */ + int uf_dev_state; /* USB device state */ + size_t uf_xfer_sz; /* HCI bulk xfer size */ + + uftdi_pm_t *uf_pm; /* PM support */ + + /* + * data receive and transmit + */ + mblk_t *uf_rx_mp; /* rx data */ + mblk_t *uf_tx_mp; /* tx data */ + kcondvar_t uf_tx_cv; /* tx completion */ + + /* + * soft registers + */ + uftdi_regs_t uf_softr; /* config registers */ + uint16_t uf_mctl; /* modem control */ + uint8_t uf_msr; /* modem status */ + uint8_t uf_lsr; /* line status register */ + +} uftdi_state_t; + +_NOTE(MUTEX_PROTECTS_DATA(uftdi_state::uf_lock, uftdi_state)) +_NOTE(DATA_READABLE_WITHOUT_LOCK(uftdi_state::{ + uf_dip + uf_dev_data + uf_usb_events + uf_def_ph + uf_lh + uf_xfer_sz + uf_pm + uf_port_state + uf_cb.cb_rx + uf_cb.cb_tx + uf_cb.cb_arg + uf_bulkin_ph + uf_bulkout_ph +})) + +/* port state */ +enum { + UFTDI_PORT_CLOSED, /* port is closed */ + UFTDI_PORT_OPEN, /* port is open */ + UFTDI_PORT_CLOSING +}; + +/* port flags */ +enum { + UFTDI_PORT_TX_STOPPED = 0x0001 /* transmit not allowed */ +}; + +/* pipe state */ +enum { + UFTDI_PIPE_CLOSED, /* pipe is closed */ + UFTDI_PIPE_IDLE, /* open but no requests */ + UFTDI_PIPE_BUSY /* servicing request */ +}; + +/* various numbers */ +enum { + UFTDI_BULKOUT_TIMEOUT = 15, /* bulkout timeout */ + UFTDI_BULKIN_TIMEOUT = 15, /* bulkin timeout */ + UFTDI_XFER_SZ_MAX = 64, /* max xfer size */ + UFTDI_CLEANUP_LEVEL_MAX = 6 /* cleanup level */ +}; + + +/* + * debug printing masks + */ +#define DPRINT_ATTACH 0x00000001 +#define DPRINT_OPEN 0x00000002 +#define DPRINT_CLOSE 0x00000004 +#define DPRINT_DEF_PIPE 0x00000010 +#define DPRINT_IN_PIPE 0x00000020 +#define DPRINT_OUT_PIPE 0x00000040 +#define DPRINT_IN_DATA 0x00000400 +#define DPRINT_OUT_DATA 0x00000800 +#define DPRINT_CTLOP 0x00001000 +#define DPRINT_HOTPLUG 0x00002000 +#define DPRINT_PM 0x00004000 +#define DPRINT_MASK_ALL 0xFFFFFFFF + +#ifdef __cplusplus +} +#endif + +#endif /* _USBSER_USBFTDI_UFTDI_VAR_H */
--- a/usr/src/uts/intel/Makefile.intel.shared Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/intel/Makefile.intel.shared Sun Apr 12 10:48:30 2009 -0700 @@ -452,6 +452,7 @@ DRV_KMODS += usb_as DRV_KMODS += usbskel DRV_KMODS += usbvc +DRV_KMODS += usbftdi $(CLOSED_BUILD)CLOSED_DRV_KMODS += usbser_edge
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/intel/usbftdi/Makefile Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,140 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# uts/intel/usbftdi/Makefile +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# +# This makefile drives the production of the FT232R USB Serial +# Adapter driver. +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = usbftdi +OBJECTS = $(USBFTDI_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(USBFTDI_OBJS:%.o=$(LINTS_DIR)/%.ln) +WARLOCK_OUT = $(USBFTDI_OBJS:%.o=%.ll) +WARLOCK_OK = $(MODULE).ok +ROOTMODULE = $(USR_DRV_DIR)/$(MODULE) +CONF_SRCDIR = $(UTSBASE)/common/io/usb/clients/usbser/usbftdi +WLCMD_DIR = $(UTSBASE)/common/io/warlock + +# +# Include common rules. +# +include $(UTSBASE)/intel/Makefile.intel + +LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser + +# +# Define targets +# +ALL_TARGET = $(BINARY) $(SRC_CONFFILE) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) + +.KEEP_STATE: + +all: $(ALL_DEPS) + +def: $(DEF_DEPS) + +clean: $(CLEAN_DEPS) + $(RM) $(WARLOCK_OUT) $(WARLOCK_OK) + +clobber: $(CLOBBER_DEPS) + $(RM) $(WARLOCK_OUT) $(WARLOCK_OK) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/intel/Makefile.targ + +# +# Defines for local commands. +# +WLCC = wlcc +TOUCH = touch +WARLOCK = warlock +TEST = test + +# +# warlock +# +WARLOCK_CMD = $(WLCMD_DIR)/$(MODULE).wlcmd +USBSER_FILES = $(USBSER_OBJS:%.o=../usbser/%.ll) +USBA_FILES = $(USBA_OBJS:%.o=../usba/%.ll) +UHCI_FILES = $(UHCI_OBJS:%.o=../uhci/%.ll) +OHCI_FILES = $(OHCI_OBJS:%.o=../ohci/%.ll) +EHCI_FILES = $(EHCI_OBJS:%.o=../ehci/%.ll) + +warlock: $(WARLOCK_OK) + +$(WARLOCK_OK): warlock_with_usba warlock_with_usbser + $(TOUCH) $@ + +%.ll: $(UTSBASE)/common/io/usb/clients/usbser/usbftdi/%.c + $(WLCC) $(CPPFLAGS) -DDEBUG -o $@ $< + +warlock_with_usbser: $(WARLOCK_OUT) usbser_files warlock_ddi.files \ + $(WARLOCK_CMD) + $(WARLOCK) -c $(WARLOCK_CMD) $(WARLOCK_OUT) \ + $(USBSER_FILES) -l ../warlock/ddi_dki_impl.ll + +warlock_with_usba: $(WARLOCK_OUT) usbser_files \ + $(WLCMD_DIR)/usbftdi_with_usba.wlcmd usba_files ohci_files uhci_files \ + ehci_files warlock_ddi.files + $(WARLOCK) -c $(WLCMD_DIR)/usbftdi_with_usba.wlcmd \ + $(USBA_FILES) $(OHCI_FILES) $(EHCI_FILES) $(UHCI_FILES) \ + $(USBSER_FILES) \ + $(WARLOCK_OUT) -l ../warlock/ddi_dki_impl.ll + +usbser_files: + @cd ../usbser; pwd; $(MAKE) warlock + +usba_files: + @cd ../usba;pwd; $(MAKE) warlock + +uhci_files: + @cd ../uhci;pwd; $(MAKE) warlock + +ohci_files: + @cd ../ohci;pwd; $(MAKE) warlock + +ehci_files: + @cd ../ehci;pwd; $(MAKE) warlock + +warlock_ddi.files: + cd ../warlock; pwd; $(MAKE) warlock
--- a/usr/src/uts/sparc/Makefile.sparc.shared Sun Apr 12 18:46:02 2009 +0800 +++ b/usr/src/uts/sparc/Makefile.sparc.shared Sun Apr 12 10:48:30 2009 -0700 @@ -271,6 +271,7 @@ DRV_KMODS += usb_as usb_ac DRV_KMODS += usbskel DRV_KMODS += usbvc +DRV_KMODS += usbftdi DRV_KMODS += hci1394 av1394 scsa1394 dcam1394 DRV_KMODS += sbp2 DRV_KMODS += ib ibd rdsib sdp iser
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/sparc/usbftdi/Makefile Sun Apr 12 10:48:30 2009 -0700 @@ -0,0 +1,140 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# uts/sparc/usbftdi/Makefile +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# +# This makefile drives the production of the FT232R USB Serial +# Adapter driver. +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = usbftdi +OBJECTS = $(USBFTDI_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(USBFTDI_OBJS:%.o=$(LINTS_DIR)/%.ln) +WARLOCK_OUT = $(USBFTDI_OBJS:%.o=%.ll) +WARLOCK_OK = $(MODULE).ok +ROOTMODULE = $(USR_DRV_DIR)/$(MODULE) +CONF_SRCDIR = $(UTSBASE)/common/io/usb/clients/usbser/usbftdi +WLCMD_DIR = $(UTSBASE)/common/io/warlock + +# +# Include common rules. +# +include $(UTSBASE)/sparc/Makefile.sparc + +LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser + +# +# Define targets +# +ALL_TARGET = $(BINARY) $(SRC_CONFFILE) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) + +.KEEP_STATE: + +all: $(ALL_DEPS) + +def: $(DEF_DEPS) + +clean: $(CLEAN_DEPS) + $(RM) $(WARLOCK_OUT) $(WARLOCK_OK) + +clobber: $(CLOBBER_DEPS) + $(RM) $(WARLOCK_OUT) $(WARLOCK_OK) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/sparc/Makefile.targ + +# +# Defines for local commands. +# +WLCC = wlcc +TOUCH = touch +WARLOCK = warlock +TEST = test + +# +# warlock +# +WARLOCK_CMD = $(WLCMD_DIR)/$(MODULE).wlcmd +USBSER_FILES = $(USBSER_OBJS:%.o=../usbser/%.ll) +USBA_FILES = $(USBA_OBJS:%.o=../usba/%.ll) +UHCI_FILES = $(UHCI_OBJS:%.o=../uhci/%.ll) +OHCI_FILES = $(OHCI_OBJS:%.o=../ohci/%.ll) +EHCI_FILES = $(EHCI_OBJS:%.o=../ehci/%.ll) + +warlock: $(WARLOCK_OK) + +$(WARLOCK_OK): warlock_with_usba warlock_with_usbser + $(TOUCH) $@ + +%.ll: $(UTSBASE)/common/io/usb/clients/usbser/usbftdi/%.c + $(WLCC) $(CPPFLAGS) -DDEBUG -o $@ $< + +warlock_with_usbser: $(WARLOCK_OUT) usbser_files warlock_ddi.files \ + $(WARLOCK_CMD) + $(WARLOCK) -c $(WARLOCK_CMD) $(WARLOCK_OUT) \ + $(USBSER_FILES) -l ../warlock/ddi_dki_impl.ll + +warlock_with_usba: $(WARLOCK_OUT) usbser_files \ + $(WLCMD_DIR)/usbftdi_with_usba.wlcmd usba_files ohci_files uhci_files \ + ehci_files warlock_ddi.files + $(WARLOCK) -c $(WLCMD_DIR)/usbftdi_with_usba.wlcmd \ + $(USBA_FILES) $(OHCI_FILES) $(EHCI_FILES) $(UHCI_FILES) \ + $(USBSER_FILES) \ + $(WARLOCK_OUT) -l ../warlock/ddi_dki_impl.ll + +usbser_files: + @cd ../usbser; pwd; $(MAKE) warlock + +usba_files: + @cd ../usba;pwd; $(MAKE) warlock + +uhci_files: + @cd ../uhci;pwd; $(MAKE) warlock + +ohci_files: + @cd ../ohci;pwd; $(MAKE) warlock + +ehci_files: + @cd ../ehci;pwd; $(MAKE) warlock + +warlock_ddi.files: + cd ../warlock; pwd; $(MAKE) warlock