Commit 08786bea authored by Siegfried Hildebrand's avatar Siegfried Hildebrand Committed by Greg Kroah-Hartman

[PATCH] USB: Fix problems with cyberjack usb-serial-module since kernel 2.6.2

> Send me a patch to back those changes out to fix your device and I'll
> apply it.  If the author is around to realize this, that should wake
> them up :)

Ok, here you are! :)
Attached is a patch for linux-2.6.7-rc2. (though the patch hasn't changed
since -rc1)

Again a short description:
(the patch removes most of the changes done in linux-2.6.2)
1. Removed the local buffer of cyberjack_write, because something goes wrong
upon a write-request bigger than the buffer. Without this, a write-request
stalls with error -3.
2. Removed some usb_clear_halt() lines. Without this, the device doesn't even
open and returns -7.

It works for my cyberjack pinpad USB card reader on
- nforce2 chipset
- VIA KM266 chipset
- AMD Irongate chipset
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 90dedc17
......@@ -109,7 +109,7 @@ struct cyberjack_private {
short rdtodo; /* Bytes still to read */
unsigned char wrbuf[5*64]; /* Buffer for collecting data to write */
short wrfilled; /* Overall data size we already got */
short wrsent; /* Data akready sent */
short wrsent; /* Data already sent */
};
/* do some startup allocations not currently performed by usb_serial_probe() */
......@@ -159,8 +159,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
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);
/* force low_latency on so that our tty_push actually forces
* the data through, otherwise it is scheduled, and with high
......@@ -212,7 +210,6 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
unsigned long flags;
int result;
int wrexpected;
unsigned char localbuf[CYBERJACK_LOCAL_BUF_SIZE]; /* Buffer for collecting data to write */
dbg("%s - port %d", __FUNCTION__, port->number);
dbg("%s - from_user %d", __FUNCTION__, from_user);
......@@ -229,29 +226,23 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
spin_lock_irqsave(&priv->lock, flags);
if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ||
(count>sizeof(localbuf)) ) {
if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) {
/* To much data for buffer. Reset buffer. */
priv->wrfilled=0;
spin_unlock_irqrestore(&priv->lock, flags);
return (0);
}
spin_unlock_irqrestore(&priv->lock, flags);
/* Copy data */
if (from_user) {
if (copy_from_user(localbuf, buf, count)) {
if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count)) {
spin_unlock_irqrestore(&priv->lock, flags);
return -EFAULT;
}
} else {
memcpy (localbuf, buf, count);
memcpy (priv->wrbuf+priv->wrfilled, buf, count);
}
spin_lock_irqsave(&priv->lock, flags);
memcpy (priv->wrbuf+priv->wrfilled, localbuf, count);
usb_serial_debug_data (__FILE__, __FUNCTION__, count,
priv->wrbuf+priv->wrfilled);
priv->wrfilled += count;
......
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