[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#279889: kernel-source-2.6.9: Konica REVIO camera still not working with usb-storage



On Fri, Nov 05, 2004 at 07:06:09PM +0100, Ramses Rodriguez wrote:
> Package: kernel-source-2.6.9
> Version: 2.6.9-1
> Severity: normal
> 
> 
> Hi,
> 
> I think the patch for Konica-Minolta DIMAGE cameras (bug #276134) was applied
> to 2.6.9, but my camera (Konica REVIO KD-3300) still refuses to work. I
> don't know if that patch is supposed to work with REVIO too, so i post
> the bug.
> 
> The camera works fine with 2.6.5, but not with 2.6.8 and 2.6.9 (i
> dont know about .6 or .7). The camera's light blinks when i try to mount /dev/sda1, but than it gives an error.

Hi,

The Konica-Minolta DIMAGE A2 fix was included in 2.6.9 by Linus
and thus kernel-source-2.6.9. However I notice two other fixes in
this area which appear to effect both 2.6.8 and 2.6.9.

Is it possible for you to test the attached patches and
see if they make any difference?

As an asside, the patch for #276134 is in SVN but there has
not been a release of kernel-source-2.6.8 that includes it yet.

-- 
Horms
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: USB Storage: ignore bogus residue values
## DP: Patch author: Matthew Dharm
## DP: Upstream status: included

. $(dirname $0)/DPATCH

@DPATCH@
# origin: mdharm-usb (BitKeeper)
# cset: 1.1939.1.51 (2.6) key=415b022fporD8taxknvj32O-ZXJNNw
# inclusion: upstream
# descrition: [PATCH] USB Storage: ignore bogus residue values
# revision date: Mon, 08 Nov 2004 12:56:12 +0900
#
# rset: ChangeSet|1.1939.1.50..1.1939.1.51
# rset: drivers/usb/storage/transport.c|1.108..1.109
# rset: drivers/usb/storage/usb.h|1.45..1.46
# rset: drivers/usb/storage/unusual_devs.h|1.118..1.119
#
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/29 11:42:55-07:00 mdharm-usb@one-eyed-alien.net 
#   [PATCH] USB Storage: ignore bogus residue values
#   
#   This patch allows usb-storage to ignore the reported residue values when
#   required by some devices.  A few devices are included... I know more are
#   waiting to be merged into unusual_devs.h
#   
#   In case anyone is curious... yes, these are broken devices.
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/usb.h
#   2004/09/26 05:59:06-07:00 mdharm-usb@one-eyed-alien.net +1 -0
#   USB Storage: ignore bogus residue values
# 
# drivers/usb/storage/unusual_devs.h
#   2004/09/26 05:59:06-07:00 mdharm-usb@one-eyed-alien.net +22 -1
#   USB Storage: ignore bogus residue values
# 
# drivers/usb/storage/transport.c
#   2004/09/26 05:59:06-07:00 mdharm-usb@one-eyed-alien.net +7 -2
#   USB Storage: ignore bogus residue values
# 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	2004-11-08 12:56:12 +09:00
+++ b/drivers/usb/storage/transport.c	2004-11-08 12:56:12 +09:00
@@ -1055,8 +1055,13 @@
 
 	/* try to compute the actual residue, based on how much data
 	 * was really transferred and what the device tells us */
-	residue = min(residue, transfer_length);
-	srb->resid = max(srb->resid, (int) residue);
+	if (residue) {
+		if (!(us->flags & US_FL_IGNORE_RESIDUE) ||
+				srb->sc_data_direction == DMA_TO_DEVICE) {
+			residue = min(residue, transfer_length);
+			srb->resid = max(srb->resid, (int) residue);
+		}
+	}
 
 	/* based on the status code, we report good or bad */
 	switch (bcs->Status) {
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h	2004-11-08 12:56:12 +09:00
+++ b/drivers/usb/storage/unusual_devs.h	2004-11-08 12:56:12 +09:00
@@ -268,6 +268,13 @@
 		US_SC_8070, US_PR_BULK, NULL,
 		US_FL_FIX_INQUIRY ),
 
+/* Reported by Iacopo Spalletti <avvisi@spalletti.it> */
+UNUSUAL_DEV(  0x052b, 0x1807, 0x0100, 0x0100,
+		"Tekom Technologies, Inc",
+		"300_CAMERA",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_IGNORE_RESIDUE ),
+
 /* This entry is needed because the device reports Sub=ff */
 UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0450, 
 		"Sony",
@@ -811,7 +818,14 @@
 		"Solid state disk",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_FIX_INQUIRY ),
-		
+
+/* Reported by Rastislav Stanik <rs_kernel@yahoo.com> */
+UNUSUAL_DEV(  0x0ea0, 0x6828, 0x0110, 0x0110,
+		"USB",
+		"Flash Disk",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_IGNORE_RESIDUE ),
+
 /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
  * Tested on hardware version 1.10.
  * Entry is needed only for the initializer function override.
@@ -832,6 +846,13 @@
 		"EasyDisk Portable Device",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_MODE_XLATE ),
+
+/* Reported by Kotrla Vitezslav <kotrla@ceb.cz> */
+UNUSUAL_DEV(  0x1370, 0x6828, 0x0110, 0x0110,
+		"SWISSBIT",
+		"Black Silver",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_IGNORE_RESIDUE ),
 
 #ifdef CONFIG_USB_STORAGE_SDDR55
 UNUSUAL_DEV(  0x55aa, 0xa103, 0x0000, 0x9999, 
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h	2004-11-08 12:56:12 +09:00
+++ b/drivers/usb/storage/usb.h	2004-11-08 12:56:12 +09:00
@@ -73,6 +73,7 @@
 #define US_FL_SCM_MULT_TARG   0x00000020 /* supports multiple targets	    */
 #define US_FL_FIX_INQUIRY     0x00000040 /* INQUIRY response needs faking   */
 #define US_FL_FIX_CAPACITY    0x00000080 /* READ CAPACITY response too big  */
+#define US_FL_IGNORE_RESIDUE  0x00000100 /* reported residue is wrong	    */
 
 /* Dynamic flag definitions: used in set_bit() etc. */
 #define US_FLIDX_URB_ACTIVE	18  /* 0x00040000  current_urb is in use  */
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: USB Storage: revert GetMaxLUN strictness
## DP: Patch author: Matthew Dharm
## DP: Upstream status: included

. $(dirname $0)/DPATCH

@DPATCH@
# origin: mdharm-usb (BitKeeper)
# cset: 1.1939.1.52 (2.6) key=415b02497EnNJinuYxLfmOEWKsUNdw
# inclusion: upstream
# descrition: [PATCH] USB Storage: revert GetMaxLUN strictness
# revision date: Mon, 08 Nov 2004 12:56:29 +0900
#
# rset: ChangeSet|1.1939.1.51..1.1939.1.52
# rset: drivers/usb/storage/transport.c|1.109..1.110
#
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/29 11:43:21-07:00 mdharm-usb@one-eyed-alien.net 
#   [PATCH] USB Storage: revert GetMaxLUN strictness
#   
#   This is patch as384.  It reverts some of our sanity checks on the GetMaxLUN
#   part of the Bulk-only protocol.  Apparently, this is one area where vendors
#   can't even get close to correct.  So, in the face of any sort of error, we
#   assume a single LUN.
#   
#   We also include some comments so we don't make this mistake again.
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/transport.c
#   2004/09/26 06:06:12-07:00 mdharm-usb@one-eyed-alien.net +9 -7
#   USB Storage: revert GetMaxLUN strictness
# 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	2004-11-08 12:56:29 +09:00
+++ b/drivers/usb/storage/transport.c	2004-11-08 12:56:29 +09:00
@@ -911,7 +911,6 @@
 	int result;
 
 	/* issue the command */
-	us->iobuf[0] = 0;
 	result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
 				 US_BULK_GET_MAX_LUN, 
 				 USB_DIR_IN | USB_TYPE_CLASS | 
@@ -922,7 +921,7 @@
 		  result, us->iobuf[0]);
 
 	/* if we have a successful request, return the result */
-	if (result >= 0)
+	if (result > 0)
 		return us->iobuf[0];
 
 	/* 
@@ -934,13 +933,16 @@
 	if (result == -EPIPE) {
 		usb_stor_clear_halt(us, us->recv_bulk_pipe);
 		usb_stor_clear_halt(us, us->send_bulk_pipe);
-		/* return the default -- no LUNs */
-		return 0;
 	}
 
-	/* An answer or a STALL are the only valid responses.  If we get
-	 * something else, return an indication of error */
-	return -1;
+	/*
+	 * Some devices don't like GetMaxLUN.  They may STALL the control
+	 * pipe, they may return a zero-length result, they may do nothing at
+	 * all and timeout, or they may fail in even more bizarrely creative
+	 * ways.  In these cases the best approach is to use the default
+	 * value: only one LUN.
+	 */
+	return 0;
 }
 
 int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)

Reply to: