Adaptec USBXchange and USB2Xchange support
Subsystems (2)
PATCH 1/1 Adaptec USBXchange and USB2Xchange support
Hi all,
attached is a patch adding support for Adaptec's USBXchange and USB2Xchange USB to SCSI converter dongles.
In 2004 Beier & Dauskardt IT <[email protected]> already posted a patch, that was not accepted because it was for 2.4 and included the firmware.
This patch is based on that work, but ported to 2.6 as well as to the new firmware loader. Support for the USBXchange was added as well as cleanups done.
Compatible firmware dumps, obtained by USB I/O logging, are available here:
http://dl.exactcode.de/adaptec-usbxchange/
Alternatively people can dump it out from the windows driver looking for the offset.
After the firmware upload the devices behave as normal usb-storage devices.
This version was only tested with the USB 1.x version - but I get a USB2Xchange, hopefully tomorrow.
Please apply - suggestions welcome,
Signature · 3 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
http://www.exactcode.de | http://www.t2-project.org
+49 (0)30 255 897 45drivers/usb/storage/Kconfig +14 -0
@@ -111,3 +111,17 @@ Say Y here to include additional code to support the Lexar Jumpshot USB CompactFlash reader. +config USB_STORAGE_USBXCHANGE + bool "Adaptec USBXchange and USB2Xchange support" + depends on USB_STORAGE + help + Say Y here to include additional code to support the Adaptec + USBXchange and USB2Xchange USB --> SCSI converter dongle. + +config USB_USBXCHANGE + tristate "Adaptec USBXchange and USB2Xchange firmware loader" + depends on USB_STORAGE_USBXCHANGE + help + Say Y here to include additional code to load the firmware into + Adaptec USBXchange and USB2Xchange USB --> SCSI converter dongle. +
drivers/usb/storage/Makefile +5 -0
@@ -19,5 +19,10 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o +usb-storage-obj-$(CONFIG_USB_STORAGE_USBXCHANGE) += usbxchange.o + usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ initializers.o $(usb-storage-obj-y) + +obj-$(CONFIG_USB_USBXCHANGE) += usbxchange_fw.o +
drivers/usb/storage/unusual_devs.h +19 -0
@@ -1039,3 +1039,22 @@ US_SC_SCSI, US_PR_SDDR55, NULL, US_FL_SINGLE_LUN),#endif + +#ifdef CONFIG_USB_STORAGE_USBXCHANGE + +/* Adaptec USBXchange and USB2Xchange, after firmware download. +* Requires Ez-USB Style firmware loader. -Ren� Rebe <[email protected]> */ + +UNUSUAL_DEV (0x03f3 ,0x2001 ,0x0000 ,0xffff , +"Adaptec" , +"USBXchange" , +US_SC_SCSI ,US_PR_BULK ,NULL , +0 ), + +UNUSUAL_DEV (0x03f3 ,0x2003 ,0x0000 ,0xffff , +"Adaptec" , +"USB2Xchange" , +US_SC_SCSI ,US_PR_BULK , usb2xchange_init, + 0 ), +#endif +
drivers/usb/storage/usb.c +3 -0
@@ -90,6 +90,9 @@#ifdef CONFIG_USB_STORAGE_JUMPSHOT #include "jumpshot.h" #endif +#ifdef CONFIG_USB_STORAGE_USBXCHANGE +#include "usbxchange.h" +#endif /* Some informational data */
drivers/usb/storage/usbxchange.c +60 -0
60 lines not on this page · raw message
drivers/usb/storage/usbxchange.h +25 -0
@@ -0,0 +1,25 @@ +/* +* Firmware Initialisation for the Adaptec USB2Xchange. +* +* Current development and maintenance by: +* (c) 2005 Ren� Rebe <[email protected]> +* +* Initial work by: +* (c) 2004 Beier & Dauskardt IT <[email protected]> +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, as published by +* the Free Software Foundation, version 2. +*/ + +#ifndef _USB_USBXCHANGE_H_INCLUDED +#define _USB_USBXCHANGE_H_INCLUDED + +extern int usb2xchange_init (struct us_data *us); + +#endif
drivers/usb/storage/usbxchange_fw.c +233 -0
233 lines not on this page · raw message
drivers/usb/storage/usbxchange_fw.h +60 -0
60 lines not on this page · raw message
Quoted 3 lines · René Rebe
attached is a patch adding support for Adaptec's USBXchange and USB2Xchange USB to SCSI converter dongles.
Please fix the wordwrapping in your email client (email the patch to yourself, make sure that it applies), then resend the patch, cc'ing [email protected], thanks.
Hi all,
Quoted 2 lines · Andrew Morton
..., then resend the patch, cc'ing
[email protected], thanks.
please find attached the revisited patch for the Adaptec USBXchange and USB2Xchange USB<->SCSI cable.
Aside that the existing usb-storage code gives up scannign too early when there is just a device with a high SCSI ID (e.g. 5 or 6) conected to the USB2Xchange it works fine.
I'll try to come up with a solution for this high ID issue with the USB2Xchange when I have the next free time slot.
Extracted, firmware loader compatible firmware is here:
http://dl.exactcode.de/adaptec-usbxchange/
drivers/usb/storage/Kconfig +7 -0
@@ -134,6 +134,13 @@ this input in any keybinding software. (e.g. gnome's keyboard short- cuts) +config USB_USBXCHANGE + tristate "Adaptec USBXchange and USB2Xchange firmware loader" + depends on USB_STORAGE_USBXCHANGE + help + Say Y here to include additional code to load the firmware into the + Adaptec USBXchange and USB2Xchange USB --> SCSI converter dongle. + config USB_LIBUSUAL bool "The shared table of common (or usual) storage devices" depends on USB
drivers/usb/storage/Makefile +2 -0
@@ -24,6 +24,8 @@ usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ initializers.o $(usb-storage-obj-y) +obj-$(CONFIG_USB_USBXCHANGE) += usbxchange_fw.o + ifneq ($(CONFIG_USB_LIBUSUAL),) obj-$(CONFIG_USB) += libusual.o endif
drivers/usb/storage/initializers.c +24 -0
@@ -164,3 +164,27 @@return USB_STOR_TRANSPORT_FAILED ; } +/* Firmware Initialisation for the Adaptec USB2Xchange, needed for +* to recognize devices properly. René Rebe <[email protected]> */ +int usb2xchange_init (struct us_data *us) +{ +int result; + +US_DEBUGP ("usb2xchange_init: initialising after reenumeration.\n" ); + + result =usb_control_msg (us->pusb_dev, us->send_ctrl_pipe, +0x5a ,0x40 ,0x01 , +0 ,0 ,// buffer, +0 ,// length, +300 ); +US_DEBUGP ("usb2xchange_init: reset #1 (%d)\n" , result); + + result =usb_control_msg (us->pusb_dev, us->send_ctrl_pipe, +0x5a ,0x40 ,0x02 , +0 ,0 ,// buffer, +0 ,// length, +300 ); +US_DEBUGP ("usb2xchange_init: reset #2 (%d)\n" , result); + +return result; +}
drivers/usb/storage/initializers.h +3 -0
@@ -49,3 +49,6 @@* flash reader */ int usb_stor_ucr61s2b_init (struct us_data *us);int rio_karma_init (struct us_data *us); + +/* Firmware Initialization for the Adaptec USB2Xchange */ +int usb2xchange_init (struct us_data *us);
drivers/usb/storage/unusual_devs.h +15 -0
@@ -1180,6 +1180,21 @@ US_FL_SINGLE_LUN), #endif +/* Adaptec USBXchange and USB2Xchange, after firmware download. +* Requires Ez-USB Style firmware loader. René Rebe <[email protected]> */ + +UNUSUAL_DEV (0x03f3 ,0x2001 ,0x0000 ,0xffff , +"Adaptec" , +"USBXchange" , +US_SC_SCSI ,US_PR_BULK ,NULL , +0 ), + +UNUSUAL_DEV (0x03f3 ,0x2003 ,0x0000 ,0xffff , +"Adaptec" , +"USB2Xchange" , +US_SC_SCSI ,US_PR_BULK , usb2xchange_init, +0 ), +/* Control/Bulk transport for all SubClass values */ USUAL_DEV (US_SC_RBC ,US_PR_CB ,USB_US_TYPE_STOR ), USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR),
drivers/usb/storage/usbxchange_fw.c +215 -0
215 lines not on this page · raw message
drivers/usb/storage/usbxchange_fw.h +45 -0
45 lines not on this page · raw message
Signature · 3 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
http://www.exactcode.de | http://www.t2-project.org
+49 (0)30 255 897 45Hi,
On Monday 30 January 2006 14:22, René Rebe wrote:
ouhm, one forgotten dependency slipped in due final code reorganization:
Review
Quoted 3 lines
(quoted diff) +3
-0+config USB_USBXCHANGE + tristate "Adaptec USBXchange and USB2Xchange firmware loader" + depends on USB_STORAGE_USBXCHANGE
adaptec-usbxchange.patch renamed from old +1 -1
@@ -7,7 +7,7 @@ +config USB_USBXCHANGE + tristate "Adaptec USBXchange and USB2Xchange firmware loader" -+ depends on USB_STORAGE_USBXCHANGE ++ depends on USB_STORAGE + help + Say Y here to include additional code to load the firmware into the + Adaptec USBXchange and USB2Xchange USB --> SCSI converter dongle.
Or just drop the depends entirely, since it only logically depends on USB_STORAGE - not technically.
Sorry - yours,
Signature · 3 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
http://www.exactcode.de | http://www.t2-project.org
+49 (0)30 255 897 45A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Quoted 21 lines · Oliver Neukum
Am Montag, 30. Januar 2006 14:22 schrieb René Rebe:
Quoted 8 lines
+ /* Stop CPU */
+ err =usbxchange_set_reset(dev, cpureg, 1);
+ err =usbxchange_set_reset(dev, cpureg, 1);
+ if (err < 0) {
+ printk(KERN_ERR "%s - error stopping dongle CPU: error = %d\n", +__FUNCTION__, err);
+ return err;
+ }[..]
Quoted 8 lines
+ /* De-assert reset (let the CPU run) */
+ err =usbxchange_set_reset(dev, cpureg, 1);
+ err =usbxchange_set_reset(dev, cpureg, 0);
+ if (err < 0) {
+ printk(KERN_ERR "%s - error resetting dongle CPU: error = %d\n", +__FUNCTION__, err);
+ return err;
+ }
Quoted 1 line
Do you really want to ignore errors the first usbxchange_set_reset()s return?
It is not really likely that the first one fails and the second succeeds. But yes, I could add an if (err == 0) before the 2nd send and skip it when the first already failed.
I can resent with more suggestions accumulated.
Yours,
Signature · 3 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
http://www.exactcode.de | http://www.t2-project.org
+49 (0)30 255 897 45Hi,
finally - I got multi target (that is a SCSI device other than ID = 0 and more than than one) working with the USB2Xchange. But it needs two ugly changes in transport.c:
The first one is only encoding the ID, no LUN:
usb/storage/transport.c renamed from linux-2.6.15/drivers/usb/storage/transport.c +1 -1
@@ -983,7 +983,7 @@ bcb->Tag = ++us->tag; bcb->Lun = srb->device->lun;if (us->flags &US_FL_SCM_MULT_TARG ) - bcb->Lun |= srb->device->id <<4 ; + bcb->Lun = srb->device->id; bcb->Length = srb->cmd_len;/* copy the command payload */
Would it be ok when special case that one only for the Adaptec device, for now? Or define a whole new 2nd MULTI_TARG(2) quirk?
And furthermore the device does not respond to request other than the attached targets, this might be needed:
@@ -1069,6 +1069,19 @@
US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
le32_to_cpu(bcs->Signature), bcs->Tag, residue, bcs->Status);
+
+ if (bcs->Status > US_BULK_STAT_FAIL) {
+ /* Adaptec USB2XCHANGE */
+ if (us->pusb_dev->descriptor.idVendor == 0x03f3 &&
+ us->pusb_dev->descriptor.idProduct == 0x2003) {
+
+ /* This device will send bcs->Status == 0x8a for unused targets and
+ == 0x02 for SRB's that require SENSE. */
+ bcs->Status = US_BULK_STAT_OK;
+ fake_sense = 1;
+ US_DEBUGP("Patched Bulk status to %d.\n", bcs->Status);
+ }
+ }
if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
US_DEBUGP("Bulk logical error\n");
return USB_STOR_TRANSPORT_ERROR;
Yours,
Signature · 3 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
http://www.exactcode.de | http://www.t2-project.org
+49 (0)30 255 897 45So how do you address a multi-LUN device with the USB2Xchange?
Matt
Quoted 62 lines · Ren? Rebe
Hi,
finally - I got multi target (that is a SCSI device other than ID = 0 and more than than one) working with the USB2Xchange. But it needs two ugly changes in
transport.c:The first one is only encoding the ID, no LUN:
usb/storage/transport.c renamed from linux-2.6.15/drivers/usb/storage/transport.c +1
-1@@ -983,7 +983,7 @@ bcb->Tag = ++us->tag; bcb->Lun = srb->device->lun;if (us->flags &US_FL_SCM_MULT_TARG ) - bcb->Lun |= srb->device->id <<4 ; + bcb->Lun = srb->device->id; bcb->Length = srb->cmd_len;/* copy the command payload */ Would it be ok when special case that one only for the Adaptec device, for now? Or define a whole new 2nd
MULTI_TARG(2)quirk?And furthermore the device does not respond to request other than the attached targets, this might be needed:
usb/storage/transport.c renamed from linux-2.6.15/drivers/usb/storage/transport.c +13
-0@@ -1069,6 +1069,19 @@US_DEBUGP ("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n" ,le32_to_cpu (bcs->Signature), bcs->Tag, residue, bcs->Status); + +if (bcs->Status >US_BULK_STAT_FAIL ) { +/* Adaptec USB2XCHANGE */ +if (us->pusb_dev->descriptor.idVendor ==0x03f3 && + us->pusb_dev->descriptor.idProduct ==0x2003 ) { + +/* This device will send bcs->Status == 0x8a for unused targets and +== 0x02 for SRB's that require SENSE. */ + bcs->Status =US_BULK_STAT_OK ; + fake_sense =1 ; +US_DEBUGP ("Patched Bulk status to %d.\n" , bcs->Status); + } + }if (bcs->Tag != us->tag || bcs->Status >US_BULK_STAT_PHASE ) {US_DEBUGP ("Bulk logical error\n" );return USB_STOR_TRANSPORT_ERROR ;Yours,
Signature · 13 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany) http://www.exactcode.de | http://www.t2-project.org +49 (0)30 255 897 45 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd_______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Signature · 6 lines
Matthew Dharm Home: [email protected] Maintainer, Linux USB Mass Storage Driver NYET! The evil stops here! -- Pitr User Friendly, 6/22/1998
So how do you address a multi-LUN target if you don't encode the LUN?
Matt
Quoted 62 lines · Ren? Rebe
Hi,
finally - I got multi target (that is a SCSI device other than ID = 0 and more than than one) working with the USB2Xchange. But it needs two ugly changes in
transport.c:The first one is only encoding the ID, no LUN:
usb/storage/transport.c renamed from linux-2.6.15/drivers/usb/storage/transport.c +1
-1@@ -983,7 +983,7 @@ bcb->Tag = ++us->tag; bcb->Lun = srb->device->lun;if (us->flags &US_FL_SCM_MULT_TARG ) - bcb->Lun |= srb->device->id <<4 ; + bcb->Lun = srb->device->id; bcb->Length = srb->cmd_len;/* copy the command payload */ Would it be ok when special case that one only for the Adaptec device, for now? Or define a whole new 2nd
MULTI_TARG(2)quirk?And furthermore the device does not respond to request other than the attached targets, this might be needed:
usb/storage/transport.c renamed from linux-2.6.15/drivers/usb/storage/transport.c +13
-0@@ -1069,6 +1069,19 @@US_DEBUGP ("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n" ,le32_to_cpu (bcs->Signature), bcs->Tag, residue, bcs->Status); + +if (bcs->Status >US_BULK_STAT_FAIL ) { +/* Adaptec USB2XCHANGE */ +if (us->pusb_dev->descriptor.idVendor ==0x03f3 && + us->pusb_dev->descriptor.idProduct ==0x2003 ) { + +/* This device will send bcs->Status == 0x8a for unused targets and +== 0x02 for SRB's that require SENSE. */ + bcs->Status =US_BULK_STAT_OK ; + fake_sense =1 ; +US_DEBUGP ("Patched Bulk status to %d.\n" , bcs->Status); + } + }if (bcs->Tag != us->tag || bcs->Status >US_BULK_STAT_PHASE ) {US_DEBUGP ("Bulk logical error\n" );return USB_STOR_TRANSPORT_ERROR ;Yours,
Signature · 13 lines
René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany) http://www.exactcode.de | http://www.t2-project.org +49 (0)30 255 897 45 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd_______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Signature · 6 lines
Matthew Dharm Home: [email protected] Maintainer, Linux USB Mass Storage Driver A female who groks UNIX? My universe is collapsing. -- Mike User Friendly, 10/11/1998