err("%s urb failed to set baurdrate", __FUNCTION__); 
err("%s urb failed to set baudrate", __FUNCTION__); 
static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_termios){ /* ftdi_termios */	struct usb_device *dev = port->serial->dev;	unsigned int cflag = port->tty->termios->c_cflag;	struct ftdi_private *priv = usb_get_serial_port_data(port);	__u16 urb_value; /* will hold the new flags */	char buf[1]; /* Perhaps I should dynamically alloc this? */		// Added for xon/xoff support	unsigned int iflag = port->tty->termios->c_iflag;	unsigned char vstop;	unsigned char vstart;		dbg("%s", __FUNCTION__);	/* Force baud rate if this device requires it, unless it is set to B0. */	if (priv->force_baud && ((port->tty->termios->c_cflag & CBAUD) != B0)) {		dbg("%s: forcing baud rate for this device", __FUNCTION__);		port->tty->termios->c_cflag &= ~CBAUD;		port->tty->termios->c_cflag |= priv->force_baud;	}	/* Force RTS-CTS if this device requires it. */	if (priv->force_rtscts) {		dbg("%s: forcing rtscts for this device", __FUNCTION__);		port->tty->termios->c_cflag |= CRTSCTS;	}	cflag = port->tty->termios->c_cflag;	/* FIXME -For this cut I don't care if the line is really changing or 	   not  - so just do the change regardless  - should be able to 	   compare old_termios and tty->termios */	/* NOTE These routines can get interrupted by 	   ftdi_sio_read_bulk_callback  - need to examine what this            means - don't see any problems yet */		/* Set number of data bits, parity, stop bits */		urb_value = 0;	urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :		      FTDI_SIO_SET_DATA_STOP_BITS_1);	urb_value |= (cflag & PARENB ? 		      (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD : 		       FTDI_SIO_SET_DATA_PARITY_EVEN) :		      FTDI_SIO_SET_DATA_PARITY_NONE);	if (cflag & CSIZE) {		switch (cflag & CSIZE) {		case CS5: urb_value |= 5; dbg("Setting CS5"); break;		case CS6: urb_value |= 6; dbg("Setting CS6"); break;		case CS7: urb_value |= 7; dbg("Setting CS7"); break;		case CS8: urb_value |= 8; dbg("Setting CS8"); break;		default:			err("CSIZE was set but not CS5-CS8");		}	}	/* This is needed by the break command since it uses the same command - but is	 *  or'ed with this value  */	priv->last_set_data_urb_value = urb_value;		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),			    FTDI_SIO_SET_DATA_REQUEST, 			    FTDI_SIO_SET_DATA_REQUEST_TYPE,			    urb_value , priv->interface,			    buf, 0, WDR_SHORT_TIMEOUT) < 0) {		err("%s FAILED to set databits/stopbits/parity", __FUNCTION__);	}	   	/* Now do the baudrate */	if ((cflag & CBAUD) == B0 ) {		/* Disable flow control */		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),				    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,				    0, priv->interface, 				    buf, 0, WDR_TIMEOUT) < 0) {			err("%s error from disable flowcontrol urb", __FUNCTION__);		}	    		/* Drop RTS and DTR */		clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);	} else {		/* set the baudrate determined before */		if (change_speed(port)) {			err("%s urb failed to set baurdrate", __FUNCTION__);		}		/* Ensure  RTS and DTR are raised */		set_mctrl(port, TIOCM_DTR | TIOCM_RTS);	}	/* Set flow control */	/* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */	if (cflag & CRTSCTS) {		dbg("%s Setting to CRTSCTS flow control", __FUNCTION__);		if (usb_control_msg(dev, 				    usb_sndctrlpipe(dev, 0),				    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,				    0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),				    buf, 0, WDR_TIMEOUT) < 0) {			err("urb failed to set to rts/cts flow control");		}					} else { 		/*		 * Xon/Xoff code		 *		 * Check the IXOFF status in the iflag component of the termios structure		 * if IXOFF is not set, the pre-xon/xoff code is executed.		*/		if (iflag & IXOFF) {			dbg("%s  request to enable xonxoff iflag=%04x",__FUNCTION__,iflag);			// Try to enable the XON/XOFF on the ftdi_sio			// Set the vstart and vstop -- could have been done up above where			// a lot of other dereferencing is done but that would be very			// inefficient as vstart and vstop are not always needed			vstart=port->tty->termios->c_cc[VSTART];			vstop=port->tty->termios->c_cc[VSTOP];			urb_value=(vstop << 8) | (vstart);			if (usb_control_msg(dev,					    usb_sndctrlpipe(dev, 0),					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,					    urb_value , (FTDI_SIO_XON_XOFF_HS							 | priv->interface),					    buf, 0, WDR_TIMEOUT) < 0) {				err("urb failed to set to xon/xoff flow control");			}		} else {			/* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */			/* CHECKME Assuming XON/XOFF handled by tty stack - not by device */			dbg("%s Turning off hardware flow control", __FUNCTION__);			if (usb_control_msg(dev, 					    usb_sndctrlpipe(dev, 0),					    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,					    0, priv->interface, 					    buf, 0, WDR_TIMEOUT) < 0) {				err("urb failed to clear flow control");			}						}			}	return;} /* ftdi_termios */
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/72a755fce0243d4168a6153813a1b533b05a7d72/ftdi_sio.c/buggy/drivers/usb/serial/ftdi_sio.c