예제 #1
0
파일: ch341.c 프로젝트: matsufan/linux
static void ch341_close(struct usb_serial_port *port)
{
	dbg("%s - port %d", __func__, port->number);

	usb_serial_generic_close(port);
	usb_kill_urb(port->interrupt_in_urb);
}
static void klsi_105_close(struct usb_serial_port *port)
{
	int rc;

	dbg("%s port %d", __func__, port->number);

	mutex_lock(&port->serial->disc_mutex);
	if (!port->serial->disconnected) {
		/* send READ_OFF */
		rc = usb_control_msg(port->serial->dev,
				     usb_sndctrlpipe(port->serial->dev, 0),
				     KL5KUSB105A_SIO_CONFIGURE,
				     USB_TYPE_VENDOR | USB_DIR_OUT,
				     KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
				     0, /* index */
				     NULL, 0,
				     KLSI_TIMEOUT);
		if (rc < 0)
			dev_err(&port->dev,
				"Disabling read failed (error = %d)\n", rc);
	}
	mutex_unlock(&port->serial->disc_mutex);

	/* shutdown our bulk reads and writes */
	usb_serial_generic_close(port);

	/* wgg - do I need this? I think so. */
	usb_kill_urb(port->interrupt_in_urb);
}
예제 #3
0
static void csvt_ctrl_close(struct usb_serial_port *port)
{
	dev_dbg(&port->dev, "%s port %d", __func__, port->number);

	usb_serial_generic_close(port);
	usb_kill_urb(port->interrupt_in_urb);
}
예제 #4
0
static void mct_u232_close(struct usb_serial_port *port)
{
	dbg("%s port %d", __func__, port->number);

	usb_serial_generic_close(port);
	if (port->serial->dev)
		usb_kill_urb(port->interrupt_in_urb);
} /* mct_u232_close */
예제 #5
0
static void mct_u232_close(struct usb_serial_port *port)
{
	struct mct_u232_private *priv = usb_get_serial_port_data(port);

	usb_kill_urb(priv->read_urb);
	usb_kill_urb(port->interrupt_in_urb);

	usb_serial_generic_close(port);
} /* mct_u232_close */
예제 #6
0
파일: whiteheat.c 프로젝트: dgarnier/linux
static void whiteheat_close(struct usb_serial_port *port)
{
	firm_report_tx_done(port);
	firm_close(port);

	usb_serial_generic_close(port);

	stop_command_port(port->serial);
}
static void cp210x_close(struct usb_serial_port *port)
{
	dbg("%s - port %d", __func__, port->number);

	usb_serial_generic_close(port);

	mutex_lock(&port->serial->disc_mutex);
	if (!port->serial->disconnected)
		cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE);
	mutex_unlock(&port->serial->disc_mutex);
}
예제 #8
0
	/*
	 * The empeg-car player wants these particular tty settings.
	 * You could, for example, change the baud rate, however the
	 * player only supports 115200 (currently), so there is really
	 * no point in support for changes to the tty settings.
	 * (at least for now)
	 *
	 * The default requirements for this device are:
	 */
	termios->c_iflag
		&= ~(IGNBRK	/* disable ignore break */
		| BRKINT	/* disable break causes interrupt */
		| PARMRK	/* disable mark parity errors */
		| ISTRIP	/* disable clear high bit of input characters */
		| INLCR		/* disable translate NL to CR */
		| IGNCR		/* disable ignore CR */
		| ICRNL		/* disable translate CR to NL */
		| IXON);	/* disable enable XON/XOFF flow control */

	termios->c_oflag
		&= ~OPOST;	/* disable postprocess output characters */

	termios->c_lflag
		&= ~(ECHO	/* disable echo input characters */
		| ECHONL	/* disable echo new line */
		| ICANON	/* disable erase, kill, werase, and rprnt special characters */
		| ISIG		/* disable interrupt, quit, and suspend special characters */
		| IEXTEN);	/* disable non-POSIX special characters */

	termios->c_cflag
		&= ~(CSIZE	/* no size */
		| PARENB	/* disable parity bit */
		| CBAUD);	/* clear current baud rate */

	termios->c_cflag
		|= CS8;		/* character size 8 bits */

#if API <= 1
	port->tty->low_latency = 1;
	tty_encode_baud_rate(port->tty, 115200, 115200);
#else /* API >= 2 */
	tty_encode_baud_rate(tty, 115200, 115200);
#endif
}

#if API <= 1
static int wishbone_serial_open(struct usb_serial_port *port, struct file *filp)
#else /* API >= 2 */
static int wishbone_serial_open(struct tty_struct *tty, struct usb_serial_port *port)
#endif
{
	int retval;

	retval = usb_gsi_openclose(port, 1);
	if (retval) {
		dev_err(&port->serial->dev->dev,
		       "Could not mark device as open (%d)\n",
		       retval);
		return retval;
	}
	
#if API <= 1
	wishbone_serial_set_termios(port, NULL);
#endif

#if API <= 1
	retval = usb_serial_generic_open(port, filp);
#else /* API >= 2 */
	retval = usb_serial_generic_open(tty, port);
#endif
	if (retval)
		usb_gsi_openclose(port, 0);

	return retval;
}

#if API <= 1
static void wishbone_serial_close(struct usb_serial_port *port, struct file *filp)
#else /* API >= 2 */
static void wishbone_serial_close(struct usb_serial_port *port)
#endif
{
#if API <= 2
	usb_kill_urb(port->write_urb);
	usb_kill_urb(port->read_urb);
#else /* API >= 3 */
	usb_serial_generic_close(port);
#endif
	usb_gsi_openclose(port, 0);
}
예제 #9
0
파일: mct_u232.c 프로젝트: CoerWatt/linux
static void mct_u232_close(struct usb_serial_port *port)
{
	/*
	 * Must kill the read urb as it is actually an interrupt urb, which
	 * generic close thus fails to kill.
	 */
	usb_kill_urb(port->read_urb);
	usb_kill_urb(port->interrupt_in_urb);

	usb_serial_generic_close(port);
} /* mct_u232_close */
예제 #10
0
파일: mxu11x0.c 프로젝트: efferre79/mxu11x0
static void mxu1_close(struct usb_serial_port *port)
{
	int status;

	dev_dbg(&port->dev, "%s\n", __func__);

	usb_serial_generic_close(port);
	usb_kill_urb(port->interrupt_in_urb);

	status = mxu1_send_ctrl_urb(port->serial, MXU1_CLOSE_PORT,
				    0, MXU1_UART1_PORT);
	if (status)
		dev_err(&port->dev, "failed to send close port command: %d\n",
			status);
}
예제 #11
0
파일: kl5kusb105.c 프로젝트: 7799/linux
static void klsi_105_close(struct usb_serial_port *port)
{
	int rc;

	/* send READ_OFF */
	rc = usb_control_msg(port->serial->dev,
			     usb_sndctrlpipe(port->serial->dev, 0),
			     KL5KUSB105A_SIO_CONFIGURE,
			     USB_TYPE_VENDOR | USB_DIR_OUT,
			     KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
			     0, /* index */
			     NULL, 0,
			     KLSI_TIMEOUT);
	if (rc < 0)
		dev_err(&port->dev, "failed to disable read: %d\n", rc);

	/* shutdown our bulk reads and writes */
	usb_serial_generic_close(port);
}
예제 #12
0
static void f81232_close(struct usb_serial_port *port)
{
	usb_serial_generic_close(port);
	usb_kill_urb(port->interrupt_in_urb);
}
예제 #13
0
파일: ssu100.c 프로젝트: CoerWatt/linux
static void ssu100_close(struct usb_serial_port *port)
{
	usb_serial_generic_close(port);
}
예제 #14
0
static void ssu100_close(struct usb_serial_port *port)
{
	dbg("%s", __func__);
	usb_serial_generic_close(port);
}
예제 #15
0
static void zte_ev_usb_serial_close(struct usb_serial_port *port)
{
	struct usb_device *udev = port->serial->dev;
	struct device *dev = &port->dev;
	int result = 0;
	int len;
	unsigned char *buf;

	buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
	if (!buf)
		return;

	/* send 1st ctl cmd(CTL    21 22 02 00  00 00 00 00) */
	len = 0;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x22, 0x21,
				 0x0002, 0x0000, NULL, len,
				 USB_CTRL_GET_TIMEOUT);
	dev_dbg(dev, "result = %d\n", result);

	/* send 2st ctl cmd(CTL    21 22 03 00  00 00 00 00 ) */
	len = 0;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x22, 0x21,
				 0x0003, 0x0000, NULL, len,
				 USB_CTRL_GET_TIMEOUT);
	dev_dbg(dev, "result = %d\n", result);

	/* send  3st cmd and recieve data */
	/*
	 * 16.0  CTL    a1 21 00 00  00 00 07 00      CLASS         25.1.0(5)
	 * 16.0  DI     00 08 07 00  00 00 08
	 */
	len = 0x0007;
	result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
				 0x21, 0xa1,
				 0x0000, 0x0000, buf, len,
				 USB_CTRL_GET_TIMEOUT);
	debug_data(dev, __func__, len, buf, result);

	/* send 4th cmd */
	/*
	 * 16.0 CTL    21 20 00 00  00 00 07 00      CLASS            30.1.0
	 * 16.0  DO    00 c2 01 00  00 00 08         .%.....          30.2.0
	 */
	len = 0x0007;
	buf[0] = 0x00;
	buf[1] = 0xc2;
	buf[2] = 0x01;
	buf[3] = 0x00;
	buf[4] = 0x00;
	buf[5] = 0x00;
	buf[6] = 0x08;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x20, 0x21,
				 0x0000, 0x0000, buf, len,
				 USB_CTRL_GET_TIMEOUT);
	debug_data(dev, __func__, len, buf, result);

	/* send 5th cmd */
	/*
	 * 16.0 CTL    21 22 03 00  00 00 00 00
	 */
	len = 0;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x22, 0x21,
				 0x0003, 0x0000, NULL, len,
				 USB_CTRL_GET_TIMEOUT);
	dev_dbg(dev, "result = %d\n", result);

	/* send 6th cmd */
	/*
	 * 16.0  CTL    a1 21 00 00  00 00 07 00        CLASS          33.1.0
	 * 16.0  DI     00 c2 01 00  00 00 08
	 */
	len = 0x0007;
	result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
				 0x21, 0xa1,
				 0x0000, 0x0000, buf, len,
				 USB_CTRL_GET_TIMEOUT);
	debug_data(dev, __func__, len, buf, result);

	/* send 7th cmd */
	/*
	 * 16.0  CTL    21 20 00 00  00 00 07 00  CLASS               354.1.0
	 * 16.0  DO     00 c2 01 00  00 00 08     .......             354.2.0
	 */
	len = 0x0007;
	buf[0] = 0x00;
	buf[1] = 0xc2;
	buf[2] = 0x01;
	buf[3] = 0x00;
	buf[4] = 0x00;
	buf[5] = 0x00;
	buf[6] = 0x08;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x20, 0x21,
				 0x0000, 0x0000, buf, len,
				 USB_CTRL_GET_TIMEOUT);
	debug_data(dev, __func__, len, buf, result);

	/* send 8th cmd */
	/*
	 * 16.0 CTL    21 22 03 00  00 00 00 00
	 */
	len = 0;
	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				 0x22, 0x21,
				 0x0003, 0x0000, NULL, len,
				 USB_CTRL_GET_TIMEOUT);
	dev_dbg(dev, "result = %d\n", result);

	kfree(buf);

	usb_serial_generic_close(port);
}
예제 #16
0
//this is called when i closed `sudo minicom`
static void
_serial_close(struct usb_serial_port *port)
{
   usb_serial_generic_close(port);
   printk("device close\n");
}