Commit 0ca02093 authored by Harald Welte's avatar Harald Welte Committed by Greg Kroah-Hartman

[PATCH] USB: Hackish fix for cyberjack driver

The following patch is in use by REINER-SCT customres for some time and
works for them in about 90% of all cases.  I would really appreciate
this going in before 2.6.8-final, since the device doesn't work at all
with current 2.6.x driver.

Changes:
- bump version number
- open interrupt endpoint in startup() rather than open
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 23fba86c
...@@ -44,7 +44,7 @@ static int debug; ...@@ -44,7 +44,7 @@ static int debug;
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v1.0" #define DRIVER_VERSION "v1.01"
#define DRIVER_AUTHOR "Matthias Bruestle" #define DRIVER_AUTHOR "Matthias Bruestle"
#define DRIVER_DESC "REINER SCT cyberJack pinpad/e-com USB Chipcard Reader Driver" #define DRIVER_DESC "REINER SCT cyberJack pinpad/e-com USB Chipcard Reader Driver"
...@@ -128,6 +128,16 @@ static int cyberjack_startup (struct usb_serial *serial) ...@@ -128,6 +128,16 @@ static int cyberjack_startup (struct usb_serial *serial)
init_waitqueue_head(&serial->port[0]->write_wait); init_waitqueue_head(&serial->port[0]->write_wait);
for (i = 0; i < serial->num_ports; ++i) {
int result;
serial->port[i]->interrupt_in_urb->dev = serial->dev;
result = usb_submit_urb(serial->port[i]->interrupt_in_urb,
GFP_KERNEL);
if (result)
err(" usb_submit_urb(read int) failed");
dbg("%s - usb_submit_urb(int urb)", __FUNCTION__);
}
return( 0 ); return( 0 );
} }
...@@ -138,6 +148,7 @@ static void cyberjack_shutdown (struct usb_serial *serial) ...@@ -138,6 +148,7 @@ static void cyberjack_shutdown (struct usb_serial *serial)
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
for (i=0; i < serial->num_ports; ++i) { for (i=0; i < serial->num_ports; ++i) {
usb_unlink_urb (serial->port[i]->interrupt_in_urb);
/* My special items, the standard routines free my urbs */ /* My special items, the standard routines free my urbs */
kfree(usb_get_serial_port_data(serial->port[i])); kfree(usb_get_serial_port_data(serial->port[i]));
usb_set_serial_port_data(serial->port[i], NULL); usb_set_serial_port_data(serial->port[i], NULL);
...@@ -168,17 +179,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) ...@@ -168,17 +179,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
priv->wrsent = 0; priv->wrsent = 0;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
/* shutdown any bulk reads that might be going on */
usb_unlink_urb (port->write_urb);
usb_unlink_urb (port->read_urb);
usb_unlink_urb (port->interrupt_in_urb);
port->interrupt_in_urb->dev = port->serial->dev;
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
if (result)
err(" usb_submit_urb(read int) failed");
dbg("%s - usb_submit_urb(int urb)", __FUNCTION__);
return result; return result;
} }
...@@ -190,11 +190,6 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp) ...@@ -190,11 +190,6 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp)
/* shutdown any bulk reads that might be going on */ /* shutdown any bulk reads that might be going on */
usb_unlink_urb (port->write_urb); usb_unlink_urb (port->write_urb);
usb_unlink_urb (port->read_urb); usb_unlink_urb (port->read_urb);
usb_unlink_urb (port->interrupt_in_urb);
dbg("%s - usb_clear_halt", __FUNCTION__ );
usb_clear_halt(port->serial->dev, port->write_urb->pipe);
usb_clear_halt(port->serial->dev, port->read_urb->pipe);
usb_clear_halt(port->serial->dev, port->interrupt_in_urb->pipe);
} }
} }
...@@ -376,6 +371,10 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs) ...@@ -376,6 +371,10 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
} }
tty = port->tty; tty = port->tty;
if (!tty) {
dbg("%s - ignoring since device not open\n", __FUNCTION__);
return;
}
if (urb->actual_length) { if (urb->actual_length) {
for (i = 0; i < urb->actual_length ; ++i) { for (i = 0; i < urb->actual_length ; ++i) {
/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment