Commit 8639d2a4 authored by Thomas Wahrenbruch's avatar Thomas Wahrenbruch Committed by Greg Kroah-Hartman

[PATCH] USB: Fix kobil_sct with uhci

the kobil_sct didn't work with uhci hcds.
It used usb_fill_bulk_urb instead of usb_fill_int_urb.
The attached patch fixes this.

It starts reading in open now - this gives apps (CT-API) the chance to
detect the p'n'p string correctly.
parent f1022df9
......@@ -314,8 +314,8 @@ config USB_SERIAL_KLSI
module will be called kl5kusb105.
config USB_SERIAL_KOBIL_SCT
tristate "USB KOBIL chipcard reader (EXPERIMENTAL)"
depends on USB_SERIAL && EXPERIMENTAL
tristate "USB KOBIL chipcard reader"
depends on USB_SERIAL
---help---
Say Y here if you want to use one of the following KOBIL USB chipcard
readers:
......
......@@ -21,6 +21,9 @@
* Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus
* (Adapter K), B1 Professional and KAAN Professional (Adapter B)
*
* (21/05/2004) tw
* Fix bug with P'n'P readers
*
* (28/05/2003) tw
* Add support for KAAN SIM
*
......@@ -59,7 +62,7 @@
#include "usb-serial.h"
/* Version Information */
#define DRIVER_VERSION "28/05/2003"
#define DRIVER_VERSION "21/05/2004"
#define DRIVER_AUTHOR "KOBIL Systems GmbH - http://www.kobil.com"
#define DRIVER_DESC "KOBIL USB Smart Card Terminal Driver (experimental)"
......@@ -339,6 +342,12 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
);
dbg("%s - port %d Send reset_all_queues URB returns: %i", __FUNCTION__, port->number, result);
}
if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
// start reading (Adapter B 'cause PNP string)
result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC );
dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
}
kfree(transfer_buffer);
return 0;
......@@ -456,6 +465,11 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
if ( ((priv->device_type != KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 2) && (priv->filled >= (priv->buf[1] + 3))) ||
((priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 3) && (priv->filled >= (priv->buf[2] + 4))) ) {
// stop reading (except TWIN and KAAN SIM)
if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) ) {
usb_unlink_urb( port->interrupt_in_urb );
}
todo = priv->filled - priv->cur_pos;
while(todo > 0) {
......@@ -463,14 +477,14 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
length = (todo < 8) ? todo : 8;
// copy data to transfer buffer
memcpy(port->write_urb->transfer_buffer, priv->buf + priv->cur_pos, length );
usb_fill_bulk_urb( port->write_urb,
port->serial->dev,
usb_sndbulkpipe( port->serial->dev, priv->write_int_endpoint_address),
port->write_urb->transfer_buffer,
length,
kobil_write_callback,
port
usb_fill_int_urb( port->write_urb,
port->serial->dev,
usb_sndintpipe(port->serial->dev, priv->write_int_endpoint_address),
port->write_urb->transfer_buffer,
length,
kobil_write_callback,
port,
8
);
priv->cur_pos = priv->cur_pos + length;
......@@ -490,9 +504,14 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
// someone sets the dev to 0 if the close method has been called
port->interrupt_in_urb->dev = port->serial->dev;
// start reading
result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO );
dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
// start reading (except TWIN and KAAN SIM)
if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) ) {
// someone sets the dev to 0 if the close method has been called
port->interrupt_in_urb->dev = port->serial->dev;
result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO );
dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
}
}
return 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