There was some discussion on this digital camera a few months back, but
I haven't seen anything since.  The last message was from Steve Kann and
included some instructions on the fix he proposed.  Thanks Steve, the
first part works.  Here is my implementation, it's not great, but it
works.  

Here's what I did:
 1. Added a function inquiryFixup() to the us_unusual_dev structure
 2. Changed the fix_inquiry_data() to use this function
 3. Added a function to fix the FP-1400Z's inquiry response.
 4. Cleaned up all function calls and unusual device declarations to use
    the new structures.  

The inquiry response isn't perfectly clean yet.  I need to find the SCSI
spec so I know what's supposed to be there.  Comments and professional
cleanup welcome.

If you have everything modularized you will have to load:
 1. usbcore
 2. (usb-uhci | usb-ohci | uhci )
 3. usb-storage
 4. sd_mod
 5. msdos

Then just mount the created SCSI partition as msdos and copy the
pictures out.  

Without further ado, the patch.

Nate
diff -ruN linux/drivers/usb/storage/Makefile linux-2.4.2/drivers/usb/storage/Makefile
--- linux/drivers/usb/storage/Makefile  Fri Dec 29 16:07:23 2000
+++ linux-2.4.2/drivers/usb/storage/Makefile    Sat Mar  3 12:53:53 2001
@@ -21,7 +21,7 @@
 usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM)     += dpcm.o
 
 usb-storage-objs :=    scsiglue.o protocol.o transport.o usb.o \
-                       initializers.o $(usb-storage-obj-y)
+                       initializers.o fixups.o $(usb-storage-obj-y)
 
 include $(TOPDIR)/Rules.make
 
diff -ruN linux/drivers/usb/storage/fixups.c linux-2.4.2/drivers/usb/storage/fixups.c
--- linux/drivers/usb/storage/fixups.c  Wed Dec 31 18:00:00 1969
+++ linux-2.4.2/drivers/usb/storage/fixups.c    Sat Mar  3 12:50:51 2001
@@ -0,0 +1,46 @@
+/* Special Fixups for certain USB Mass Storage devices
+ *
+ * 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; either version 2, or (at your option) any
+ * later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "fixups.h"
+#include "debug.h"
+
+
+/* Fix for FujiFilm FinePix 1400Zoom which doesn't return anything on INQUIRY
+ */
+int usb_finepix1400_fixup(struct us_data *us, Scsi_Cmnd *srb)
+{
+       unsigned char *data_ptr;
+
+       /* verify that it's an INQUIRY command */
+       if (srb->cmnd[0] != INQUIRY)
+               return;
+
+       US_DEBUGP("Fixing INQUIRY data FujiFilm FinePix 1400Zoom\n");
+
+       /* find the location of the data */
+       if (srb->use_sg) {
+               struct scatterlist *sg;
+
+               sg = (struct scatterlist *) srb->request_buffer;
+               data_ptr = (unsigned char *) sg[0].address;
+       } else
+               data_ptr = (unsigned char *)srb->request_buffer;
+
+       /* supposed to clear the SCSI type so it is set to Direct-Access */
+       data_ptr[0] &= 0xf0;
+
+}
diff -ruN linux/drivers/usb/storage/fixups.h linux-2.4.2/drivers/usb/storage/fixups.h
--- linux/drivers/usb/storage/fixups.h  Wed Dec 31 18:00:00 1969
+++ linux-2.4.2/drivers/usb/storage/fixups.h    Sat Mar  3 12:52:39 2001
@@ -0,0 +1,22 @@
+/* Header file for Special Fixups for certain USB Mass Storage devices
+ *
+ * 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; either version 2, or (at your option) any
+ * later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "usb.h"
+
+/* Fix for FujiFilm FinePix 1400Zoom which doesn't return anything on INQUIRY
+ */
+int usb_finepix1400_fixup(struct us_data *us, Scsi_Cmnd *srb);
diff -ruN linux/drivers/usb/storage/protocol.c 
linux-2.4.2/drivers/usb/storage/protocol.c
--- linux/drivers/usb/storage/protocol.c        Tue Nov 28 23:50:07 2000
+++ linux-2.4.2/drivers/usb/storage/protocol.c  Sat Mar  3 12:50:53 2001
@@ -56,7 +56,7 @@
 /* Fix-up the return data from an INQUIRY command to show 
  * ANSI SCSI rev 2 so we don't confuse the SCSI layers above us
  */
-void fix_inquiry_data(Scsi_Cmnd *srb)
+void fix_inquiry_data(Scsi_Cmnd *srb, struct us_data *us)
 {
        unsigned char *data_ptr;
 
@@ -76,7 +76,11 @@
                data_ptr = (unsigned char *)srb->request_buffer;
 
        /* Change the SCSI revision number */
+       data_ptr[2] &= 0xf8;
        data_ptr[2] |= 0x2;
+       if (us->unusual_dev && us->unusual_dev->inquiryFixup) {
+               us->unusual_dev->inquiryFixup(us, srb);
+       }
 }
 
 /***********************************************************************
@@ -99,7 +103,7 @@
        usb_stor_invoke_transport(srb, us);
 
        /* fix the INQUIRY data if necessary */
-       fix_inquiry_data(srb);
+       fix_inquiry_data(srb, us);
 }
 
 void usb_stor_ATAPI_command(Scsi_Cmnd *srb, struct us_data *us)
@@ -174,7 +178,7 @@
                usb_stor_scsiSense10to6(srb);
 
        /* fix the INQUIRY data if necessary */
-       fix_inquiry_data(srb);
+       fix_inquiry_data(srb, us);
 }
 
 
@@ -269,7 +273,7 @@
                usb_stor_scsiSense10to6(srb);
 
        /* Fix the data for an INQUIRY, if necessary */
-       fix_inquiry_data(srb);
+       fix_inquiry_data(srb, us);
 }
 
 void usb_stor_transparent_scsi_command(Scsi_Cmnd *srb, struct us_data *us)
@@ -341,6 +345,5 @@
        usb_stor_invoke_transport(srb, us);
 
        /* fix the INQUIRY data if necessary */
-       fix_inquiry_data(srb);
+       fix_inquiry_data(srb, us);
 }
-
diff -ruN linux/drivers/usb/storage/unusual_devs.h 
linux-2.4.2/drivers/usb/storage/unusual_devs.h
--- linux/drivers/usb/storage/unusual_devs.h    Wed Feb 21 18:11:24 2001
+++ linux-2.4.2/drivers/usb/storage/unusual_devs.h      Sat Mar  3 12:53:30 2001
@@ -40,36 +40,40 @@
 UNUSUAL_DEV(  0x03ee, 0x0000, 0x0000, 0x0245, 
                "Mitsumi",
                "CD-R/RW Drive",
-               US_SC_8020, US_PR_CBI, NULL, 0), 
+               US_SC_8020, US_PR_CBI, NULL, NULL, 0), 
 
 UNUSUAL_DEV(  0x03f0, 0x0107, 0x0200, 0x0200, 
                "HP",
                "CD-Writer+",
-               US_SC_8070, US_PR_CB, NULL, 0), 
+               US_SC_8070, US_PR_CB, NULL, NULL, 0), 
 
 #ifdef CONFIG_USB_STORAGE_HP8200e
 UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001, 
                "HP",
                "CD-Writer+ 8200e",
-               US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), 
+               US_SC_8070, US_PR_SCM_ATAPI, init_8200e, NULL, 0), 
 #endif
+UNUSUAL_DEV(  0x04cb, 0x0100, 0x0000, 0x2210,
+               "Fujifilm",
+               "FinePix 1400Zoom",
+               US_SC_8070, US_PR_CBI, NULL, usb_finepix1400_fixup, 0),
 
 UNUSUAL_DEV(  0x04e6, 0x0001, 0x0200, 0x0200, 
                "Matshita",
                "LS-120",
-               US_SC_8020, US_PR_CB, NULL, 0),
+               US_SC_8020, US_PR_CB, NULL, NULL, 0),
 
 UNUSUAL_DEV(  0x04e6, 0x0002, 0x0100, 0x0100, 
                "Shuttle",
                "eUSCSI Bridge",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, 
+               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, NULL, 
                US_FL_SCM_MULT_TARG ), 
 
 #ifdef CONFIG_USB_STORAGE_SDDR09
 UNUSUAL_DEV(  0x04e6, 0x0003, 0x0000, 0x9999, 
                "Sandisk",
                "ImageMate SDDR09",
-               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL,
+               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, NULL, 
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
 #endif
 
@@ -77,156 +81,156 @@
 UNUSUAL_DEV(  0x0436, 0x0005, 0x0100, 0x0100,
                "Microtech",
                "CameraMate (DPCM_USB)",
-               US_SC_SCSI, US_PR_DPCM_USB, NULL,
+               US_SC_SCSI, US_PR_DPCM_USB, NULL, NULL, 
                US_FL_START_STOP ),
 #endif
 
 UNUSUAL_DEV(  0x04e6, 0x0006, 0x0100, 0x0200, 
                "Shuttle",
                "eUSB MMC Adapter",
-               US_SC_SCSI, US_PR_CB, NULL, 
+               US_SC_SCSI, US_PR_CB, NULL, NULL, 
                US_FL_SINGLE_LUN), 
 
 UNUSUAL_DEV(  0x04e6, 0x0007, 0x0100, 0x0200, 
                "Sony",
                "Hifd",
-               US_SC_SCSI, US_PR_CB, NULL, 
+               US_SC_SCSI, US_PR_CB, NULL, NULL, 
                US_FL_SINGLE_LUN), 
 
 UNUSUAL_DEV(  0x04e6, 0x0009, 0x0200, 0x0200, 
                "Shuttle",
                "eUSB ATA/ATAPI Adapter",
-               US_SC_8020, US_PR_CB, NULL, 0),
+               US_SC_8020, US_PR_CB, NULL, NULL, 0),
 
 UNUSUAL_DEV(  0x04e6, 0x000a, 0x0200, 0x0200, 
                "Shuttle",
                "eUSB CompactFlash Adapter",
-               US_SC_8020, US_PR_CB, NULL, 0),
+               US_SC_8020, US_PR_CB, NULL, NULL, 0),
 
 UNUSUAL_DEV(  0x04e6, 0x000B, 0x0100, 0x0100, 
                "Shuttle",
                "eUSCSI Bridge",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, 
+               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, NULL, 
                US_FL_SCM_MULT_TARG ), 
 
 UNUSUAL_DEV(  0x04e6, 0x000C, 0x0100, 0x0100, 
                "Shuttle",
                "eUSCSI Bridge",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, 
+               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, NULL, 
                US_FL_SCM_MULT_TARG ), 
 
 UNUSUAL_DEV(  0x04e6, 0x0101, 0x0200, 0x0200, 
                "Shuttle",
                "CD-RW Device",
-               US_SC_8020, US_PR_CB, NULL, 0),
+               US_SC_8020, US_PR_CB, NULL, NULL, 0),
 
 UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0210, 
                "Sony",
                "DSC-S30/S70/505V/F505", 
-               US_SC_SCSI, US_PR_CB, NULL,
+               US_SC_SCSI, US_PR_CB, NULL, NULL, 
                US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ),
 
 UNUSUAL_DEV(  0x054c, 0x002d, 0x0100, 0x0100, 
                "Sony",
                "Memorystick MSAC-US1",
-               US_SC_UFI, US_PR_CB, NULL,
+               US_SC_UFI, US_PR_CB, NULL, NULL, 
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
 
 UNUSUAL_DEV(  0x057b, 0x0000, 0x0000, 0x0299, 
                "Y-E Data",
                "Flashbuster-U",
-               US_SC_UFI,  US_PR_CB, NULL,
+               US_SC_UFI,  US_PR_CB, NULL, NULL,
                US_FL_SINGLE_LUN),
 
 UNUSUAL_DEV(  0x057b, 0x0000, 0x0300, 0x9999, 
                "Y-E Data",
                "Flashbuster-U",
-               US_SC_UFI,  US_PR_CBI, NULL,
+               US_SC_UFI,  US_PR_CBI, NULL, NULL,
                US_FL_SINGLE_LUN),
 
 UNUSUAL_DEV(  0x059f, 0xa601, 0x0200, 0x0200, 
                "LaCie",
                "USB Hard Disk",
-               US_SC_RBC, US_PR_CB, NULL, 0 ), 
+               US_SC_RBC, US_PR_CB, NULL, NULL, 0 ), 
 
 UNUSUAL_DEV(  0x05ab, 0x0031, 0x0100, 0x0100, 
                "In-System",
                "USB/IDE Bridge (ATAPI ONLY!)",
-               US_SC_8070, US_PR_BULK, NULL, 0 ), 
+               US_SC_8070, US_PR_BULK, NULL, NULL, 0 ), 
 
 UNUSUAL_DEV(  0x0644, 0x0000, 0x0100, 0x0100, 
                "TEAC",
                "Floppy Drive",
-               US_SC_UFI, US_PR_CB, NULL, 0 ), 
+               US_SC_UFI, US_PR_CB, NULL, NULL, 0 ), 
 
 #ifdef CONFIG_USB_STORAGE_SDDR09
 UNUSUAL_DEV(  0x066b, 0x0105, 0x0100, 0x0100, 
                "Olympus",
                "Camedia MAUSB-2",
-               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL,
+               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
 #endif
 
 UNUSUAL_DEV(  0x0693, 0x0002, 0x0100, 0x0100, 
                "Hagiwara",
                "FlashGate SmartMedia",
-               US_SC_SCSI, US_PR_BULK, NULL, 0 ),
+               US_SC_SCSI, US_PR_BULK, NULL, NULL, 0 ),
 
 UNUSUAL_DEV(  0x0693, 0x0005, 0x0100, 0x0100,
                "Hagiwara",
                "Flashgate",
-               US_SC_SCSI, US_PR_BULK, NULL, 0 ), 
+               US_SC_SCSI, US_PR_BULK, NULL, NULL, 0 ), 
 
 UNUSUAL_DEV(  0x0781, 0x0001, 0x0200, 0x0200, 
                "Sandisk",
                "ImageMate SDDR-05a",
-               US_SC_SCSI, US_PR_CB, NULL,
+               US_SC_SCSI, US_PR_CB, NULL, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP),
 
 UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100,
                 "Sandisk",
                 "ImageMate SDDR-12",
-                US_SC_SCSI, US_PR_CB, NULL,
+                US_SC_SCSI, US_PR_CB, NULL, NULL,
                 US_FL_SINGLE_LUN ),
 
 #ifdef CONFIG_USB_STORAGE_SDDR09
 UNUSUAL_DEV(  0x0781, 0x0200, 0x0100, 0x0100, 
                "Sandisk",
                "ImageMate SDDR-09",
-               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL,
+               US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
 #endif
 
 UNUSUAL_DEV(  0x0781, 0x0002, 0x0009, 0x0009, 
                "Sandisk",
                "ImageMate SDDR-31",
-               US_SC_SCSI, US_PR_BULK, NULL,
+               US_SC_SCSI, US_PR_BULK, NULL, NULL,
                US_FL_IGNORE_SER),
 
 UNUSUAL_DEV(  0x07af, 0x0004, 0x0100, 0x0100, 
                "Microtech",
                "USB-SCSI-DB25",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init,
+               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, NULL,
                US_FL_SCM_MULT_TARG ), 
 
 #ifdef CONFIG_USB_STORAGE_FREECOM
 UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
                 "Freecom",
                 "USB-IDE",
-                US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
+                US_SC_QIC, US_PR_FREECOM, freecom_init, NULL, 0),
 #endif
 
 UNUSUAL_DEV(  0x07af, 0x0005, 0x0100, 0x0100, 
                "Microtech",
                "USB-SCSI-HD50",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init,
+               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, NULL,
                US_FL_SCM_MULT_TARG ), 
 
 #ifdef CONFIG_USB_STORAGE_DPCM
 UNUSUAL_DEV(  0x07af, 0x0006, 0x0100, 0x0100,
                "Microtech",
                "CameraMate (DPCM_USB)",
-               US_SC_SCSI, US_PR_DPCM_USB, NULL,
+               US_SC_SCSI, US_PR_DPCM_USB, NULL, NULL,
                US_FL_START_STOP ),
 #endif
 
diff -ruN linux/drivers/usb/storage/usb.c linux-2.4.2/drivers/usb/storage/usb.c
--- linux/drivers/usb/storage/usb.c     Fri Feb  9 13:30:23 2001
+++ linux-2.4.2/drivers/usb/storage/usb.c       Sat Mar  3 12:58:55 2001
@@ -53,6 +53,7 @@
 #include "protocol.h"
 #include "debug.h"
 #include "initializers.h"
+#include "fixups.h"
 #ifdef CONFIG_USB_STORAGE_HP8200e
 #include "shuttle_usbat.h"
 #endif
@@ -110,7 +111,7 @@
 
 #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
                    vendorName, productName,useProtocol, useTransport, \
-                   initFunction, flags) \
+                   initFunction, inquiry_fixup, flags) \
 { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax) }
 
 static struct usb_device_id storage_usb_ids [] = {
@@ -161,13 +162,14 @@
 #undef UNUSUAL_DEV
 #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
                    vendor_name, product_name, use_protocol, use_transport, \
-                   init_function, Flags) \
+                   init_function, inquiry_fixup, Flags) \
 { \
        vendorName: vendor_name,        \
        productName: product_name,      \
        useProtocol: use_protocol,      \
        useTransport: use_transport,    \
        initFunction : init_function,   \
+       inquiryFixup: inquiry_fixup,    \
        flags: Flags, \
 }
 
diff -ruN linux/drivers/usb/storage/usb.h linux-2.4.2/drivers/usb/storage/usb.h
--- linux/drivers/usb/storage/usb.h     Wed Feb 21 18:11:24 2001
+++ linux-2.4.2/drivers/usb/storage/usb.h       Fri Mar  2 20:35:35 2001
@@ -89,6 +89,7 @@
        __u8  useProtocol;
        __u8  useTransport;
        int (*initFunction)(struct us_data *);
+       int (*inquiryFixup)(struct us_data *, Scsi_Cmnd *);
        unsigned int flags;
 };
 

Reply via email to