コード例 #1
0
ファイル: generic.c プロジェクト: AppEngine/linux-2.6
/* Push data to tty layer and resubmit the bulk read URB */
static void flush_and_resubmit_read_urb(struct usb_serial_port *port)
{
	struct urb *urb = port->read_urb;
	struct tty_struct *tty = tty_port_tty_get(&port->port);
	char *ch = (char *)urb->transfer_buffer;
	int i;

	if (!tty)
		goto done;

	/* The per character mucking around with sysrq path it too slow for
	   stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
	   where the USB serial is not a console anyway */
	if (!port->console || !port->sysrq)
		tty_insert_flip_string(tty, ch, urb->actual_length);
	else {
		/* Push data to tty */
		for (i = 0; i < urb->actual_length; i++, ch++) {
			if (!usb_serial_handle_sysrq_char(tty, port, *ch))
				tty_insert_flip_char(tty, *ch, TTY_NORMAL);
		}
	}
	tty_flip_buffer_push(tty);
	tty_kref_put(tty);
done:
	usb_serial_generic_resubmit_read_urb(port, GFP_ATOMIC);
}
コード例 #2
0
static void usb_debug_read_bulk_callback(struct urb *urb)
{
	struct usb_serial_port *port = urb->context;

	if (urb->actual_length == USB_DEBUG_BRK_SIZE &&
	    memcmp(urb->transfer_buffer, USB_DEBUG_BRK,
		   USB_DEBUG_BRK_SIZE) == 0) {
		usb_serial_handle_break(port);
		usb_serial_generic_resubmit_read_urb(port, GFP_ATOMIC);
		return;
	}

	usb_serial_generic_read_bulk_callback(urb);
}
コード例 #3
0
ファイル: generic.c プロジェクト: AppEngine/linux-2.6
void usb_serial_generic_unthrottle(struct tty_struct *tty)
{
	struct usb_serial_port *port = tty->driver_data;
	int was_throttled;
	unsigned long flags;

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

	/* Clear the throttle flags */
	spin_lock_irqsave(&port->lock, flags);
	was_throttled = port->throttled;
	port->throttled = port->throttle_req = 0;
	spin_unlock_irqrestore(&port->lock, flags);

	if (was_throttled) {
		/* Resume reading from device */
		usb_serial_generic_resubmit_read_urb(port, GFP_KERNEL);
	}
}