Hi,

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.


Greg, please apply.

Best regards

        Thomas Wahrenbruch
diff -Naur -X dontdiff /space/linux-2.6.6/drivers/usb/serial/Kconfig linux-2.6.6/drivers/usb/serial/Kconfig
--- /space/linux-2.6.6/drivers/usb/serial/Kconfig	2004-05-10 04:32:54.000000000 +0200
+++ linux-2.6.6/drivers/usb/serial/Kconfig	2004-05-21 11:41:24.000000000 +0200
@@ -314,8 +314,8 @@
 	  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:
diff -Naur -X dontdiff /space/linux-2.6.6/drivers/usb/serial/kobil_sct.c linux-2.6.6/drivers/usb/serial/kobil_sct.c
--- /space/linux-2.6.6/drivers/usb/serial/kobil_sct.c	2004-05-10 04:33:13.000000000 +0200
+++ linux-2.6.6/drivers/usb/serial/kobil_sct.c	2004-05-21 11:16:29.000000000 +0200
@@ -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)"
 
@@ -342,6 +345,12 @@
 			);
 		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;
@@ -459,6 +468,11 @@
 	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) {
@@ -466,14 +480,14 @@
 			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;
@@ -495,9 +509,14 @@
 		// 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_ATOMIC ); 
-		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_ATOMIC ); 
+			dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
+		}
 	}
 	return count;
 }

Reply via email to