 case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */ dbg("%s TIOCMBIS", __FUNCTION__); if (get_user(mask, (unsigned long __user *) arg)) return -EFAULT; if (mask & TIOCM_DTR){ if ((ret = set_dtr(port, HIGH)) < 0) { err("Urb to set DTR failed"); return(ret); } } if (mask & TIOCM_RTS) { if ((ret = set_rts(port, HIGH)) < 0){ err("Urb to set RTS failed"); return(ret); } } return(0); break;  case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */ dbg("%s TIOCMBIC", __FUNCTION__); if (get_user(mask, (unsigned long __user *) arg)) return -EFAULT; if (mask & TIOCM_DTR){ if ((ret = set_dtr(port, LOW)) < 0){ err("Urb to unset DTR failed"); return(ret); } } if (mask & TIOCM_RTS) { if ((ret = set_rts(port, LOW)) < 0){ err("Urb to unset RTS failed"); return(ret); } } return(0); break;  /* * I had originally implemented TCSET{A,S}{,F,W} and * TCGET{A,S} here separately, however when testing I * found that the higher layers actually do the termios * conversions themselves and pass the call onto * ftdi_sio_set_termios. * */ 
static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg){	struct ftdi_private *priv = usb_get_serial_port_data(port);	int  ret, mask;		dbg("%s cmd 0x%04x", __FUNCTION__, cmd);	/* Based on code from acm.c and others */	switch (cmd) {	case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */		dbg("%s TIOCMBIS", __FUNCTION__); 	        if (get_user(mask, (unsigned long __user *) arg))			return -EFAULT;  	        if (mask & TIOCM_DTR){			if ((ret = set_dtr(port, HIGH)) < 0) {				err("Urb to set DTR failed");				return(ret);			}		}		if (mask & TIOCM_RTS) {			if ((ret = set_rts(port, HIGH)) < 0){				err("Urb to set RTS failed");				return(ret);			}		}		return(0);		break;	case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */		dbg("%s TIOCMBIC", __FUNCTION__); 	        if (get_user(mask, (unsigned long __user *) arg))			return -EFAULT;  	        if (mask & TIOCM_DTR){			if ((ret = set_dtr(port, LOW)) < 0){				err("Urb to unset DTR failed");				return(ret);			}		}			if (mask & TIOCM_RTS) {			if ((ret = set_rts(port, LOW)) < 0){				err("Urb to unset RTS failed");				return(ret);			}		}		return(0);		break;		/*		 * I had originally implemented TCSET{A,S}{,F,W} and		 * TCGET{A,S} here separately, however when testing I		 * found that the higher layers actually do the termios		 * conversions themselves and pass the call onto		 * ftdi_sio_set_termios. 		 *		 */	case TIOCGSERIAL: /* gets serial port data */		return get_serial_info(port, (struct serial_struct __user *) arg);	case TIOCSSERIAL: /* sets serial port data */		return set_serial_info(port, (struct serial_struct __user *) arg);	/*	 * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change	 * - mask passed in arg for lines of interest	 *   (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)	 * Caller should use TIOCGICOUNT to see which one it was.	 *	 * This code is borrowed from linux/drivers/char/serial.c	 */	case TIOCMIWAIT:		while (priv != NULL) {			interruptible_sleep_on(&priv->delta_msr_wait);			/* see if a signal did it */			if (signal_pending(current))				return -ERESTARTSYS;			else {				char diff = priv->diff_status;				if (diff == 0) {					return -EIO; /* no change => error */				}				/* Consume all events */				priv->diff_status = 0;				/* Return 0 if caller wanted to know about these bits */				if ( ((arg & TIOCM_RNG) && (diff & FTDI_RS0_RI)) ||				     ((arg & TIOCM_DSR) && (diff & FTDI_RS0_DSR)) ||				     ((arg & TIOCM_CD)  && (diff & FTDI_RS0_RLSD)) ||				     ((arg & TIOCM_CTS) && (diff & FTDI_RS0_CTS)) ) {					return 0;				}				/*				 * Otherwise caller can't care less about what happened,				 * and so we continue to wait for more events.				 */			}		}		return(0);		break;	default:		break;			}	/* This is not necessarily an error - turns out the higher layers will do 	 *  some ioctls itself (see comment above)	 */	dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd);	return(-ENOIOCTLCMD);} /* ftdi_ioctl */
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/7e33ae67815372a93e8e77624fd47e39a986415d/ftdi_sio.c/buggy/drivers/usb/serial/ftdi_sio.c