ChangeSet 1.1005.1.3, 2003/06/24 14:53:15-07:00, [EMAIL PROTECTED]

[PATCH] USB: Desknote/ECS UCR-61S2B card reader (2.4.21 patched)

 This is for 2.4.21 with the US_PR_DEVICE / US_SC_DEVICE patch in place.
 Tested and working.


 drivers/usb/storage/initializers.c |   48 +++++++++++++++++++++++++++++++++++++
 drivers/usb/storage/initializers.h |    6 ++++
 drivers/usb/storage/unusual_devs.h |   10 +++++++
 3 files changed, 64 insertions(+)


diff -Nru a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
--- a/drivers/usb/storage/initializers.c        Fri Jun 27 16:27:22 2003
+++ b/drivers/usb/storage/initializers.c        Fri Jun 27 16:27:22 2003
@@ -39,6 +39,7 @@
 
 #include "initializers.h"
 #include "debug.h"
+#include "transport.h"
 
 /* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target
  * mode */
@@ -57,4 +58,51 @@
        return 0;
 }
 
+/* This function is required to activate all four slots on the UCR-61S2B
+ * flash reader */
 
+int usb_stor_ucr61s2b_init(struct us_data *us)
+{
+       int pipe;
+       struct bulk_cb_wrap *bcb;
+       struct bulk_cs_wrap *bcs;
+       int res, partial;
+
+       bcb = kmalloc(sizeof *bcb, in_interrupt() ? GFP_ATOMIC : GFP_NOIO);
+       if (!bcb) {
+               return(-1);
+       }
+       bcs = kmalloc(sizeof *bcs, in_interrupt() ? GFP_ATOMIC : GFP_NOIO);
+       if (!bcs) {
+               kfree(bcb);
+               return(-1);
+       }
+
+       US_DEBUGP("Sending UCR-61S2B initialization packet...\n");
+
+       bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
+       bcb->Tag = ++(us->tag);
+       bcb->DataTransferLength = cpu_to_le32(0);
+       bcb->Flags = bcb->Lun = 0;
+       bcb->Length = sizeof(UCR61S2B_INIT);
+       memset(bcb->CDB, 0, sizeof(bcb->CDB));
+       memcpy(bcb->CDB, UCR61S2B_INIT, sizeof(UCR61S2B_INIT));
+
+       pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+       res = usb_stor_bulk_msg(us, bcb, pipe, US_BULK_CB_WRAP_LEN, &partial);
+       US_DEBUGP("-- result is %d\n", res);
+       kfree(bcb);
+
+       if(res) {
+               kfree(bcs);
+               return(res);
+       }
+
+       pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
+       res = usb_stor_bulk_msg(us, bcs, pipe, US_BULK_CS_WRAP_LEN, &partial);
+       US_DEBUGP("-- result of status read is %d\n", res);
+
+       kfree(bcs);
+
+       return(res ? -1 : 0);
+}
diff -Nru a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h
--- a/drivers/usb/storage/initializers.h        Fri Jun 27 16:27:22 2003
+++ b/drivers/usb/storage/initializers.h        Fri Jun 27 16:27:22 2003
@@ -39,6 +39,12 @@
 
 #include "usb.h"
 
+#define UCR61S2B_INIT "\xec\x0a\x06\x00$PCCHIPS"
+
 /* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target
  * mode */
 int usb_stor_euscsi_init(struct us_data *us);
+
+/* This function is required to activate all four slots on the UCR-61S2B
+ * flash reader */
+int usb_stor_ucr61s2b_init(struct us_data *us);
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h        Fri Jun 27 16:27:22 2003
+++ b/drivers/usb/storage/unusual_devs.h        Fri Jun 27 16:27:22 2003
@@ -649,6 +649,16 @@
                US_SC_SCSI, US_PR_BULK, NULL,
                US_FL_START_STOP ),
 
+/* Reported by Kevin Cernekee <[EMAIL PROTECTED]>
+ * Tested on hardware version 1.10.
+ * Entry is needed only for the initializer function override.
+ */
+UNUSUAL_DEV(  0x1019, 0x0c55, 0x0000, 0x9999,
+               "Desknote",
+               "UCR-61S2B",
+               US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
+               0 ),
+
 /* Reported by Dan Pilone <[EMAIL PROTECTED]>
  * The device needs the flags only.
  * Also reported by Brian Hall <[EMAIL PROTECTED]>, again for flags.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to