Skip to content

Commit

Permalink
USB: pl2303: initial TIOCGSERIAL support
Browse files Browse the repository at this point in the history
I've got a trivial patch for the pl2303 driver, that's what I needed to
make the wacom serial tablet driver work properly. It uses the
TIOCGSERIAL ioctl to determine if it's talking to a serial device or
not, which I gather is rather common, but the pl2303 driver didn't
implement that ioctl.

Here's a patch, I'm not sure it's absolutely correct, I mostly looked at
other similar usbserial drivers to see what I must do, but it works for
me.

Signed-off-by: John Tsiombikas <nuclear@member.fsf.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
John Tsiombikas authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent ac7d4ca commit 67b9946
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/usb/serial/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,10 +895,23 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
static int pl2303_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct serial_struct ser;
struct usb_serial_port *port = tty->driver_data;
dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd);

switch (cmd) {
case TIOCGSERIAL:
memset(&ser, 0, sizeof ser);
ser.type = PORT_16654;
ser.line = port->serial->minor;
ser.port = port->number;
ser.baud_base = 460800;

if (copy_to_user((void __user *)arg, &ser, sizeof ser))
return -EFAULT;

return 0;

case TIOCMIWAIT:
dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
return wait_modem_info(port, arg);
Expand Down

0 comments on commit 67b9946

Please sign in to comment.