Package: qpxtool
Version: 0.6.1-3
Tags: patch

qpxtool does not work with the Linux kernel's new IDE/SATA
infrastructure (libata):

------------------------------------------------------------------------
...
** Scaning for MMC compliant devices...
/dev/sr0: PLEXTOR  DVDR   PX-760A   1.07
** Scan complete: 1 device(s) found

Selected: /dev/sr0
:-( unable to MODE_SENSE(10) : Input/output error
:-( unable to MODE_SENSE(10) : Input/output error

** Reading supported mode pages...
:-( unable to MODE_SENSE(10) : Input/output error
:-( unable to GET_CONFIGURATION LENGTH : Input/output error
:-( unable to MODE_SENSE(10) : Input/output error
...
------------------------------------------------------------------------

The kernel included with Debian currently ships with libata disabled for PATA
devices.  However, I built my own kernel since the old IDE drivers don't work
properly with my hardware (JMicron 20363).

Someone else had the same problem and reported it here:
http://lkml.org/lkml/2008/1/11/297
https://bugzilla.redhat.com/show_bug.cgi?id=428281

I'll attach a bugfix that works for me.

The cause of this problem seems to be the overloaded Scsi_Command []
operator in qpx_transport.h - it has a strange implementation which is
easy to use incorrectly, and qpxtool does get it wrong in various places.

Regards,
Mirko


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable'), (30, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-rc7-git-mpa1 (SMP w/2 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages qpxtool depends on:
ii  libc6                   2.7-6            GNU C Library: Shared libraries
ii  libgcc1                 1:4.3-20080116-1 GCC support library
ii  libqt3-mt               3:3.3.7-9        Qt GUI Library (Threaded runtime v
ii  libstdc++6              4.3-20080116-1   The GNU Standard C++ Library v3
ii  libx11-6                2:1.0.3-7        X11 client-side library
ii  libxext6                1:1.0.3-2        X11 miscellaneous extension librar

qpxtool recommends no packages.

-- no debconf information
--- lib/qpxtransport/qpx_transport.cpp.orig	2008-02-03 00:56:14.000000000 +0100
+++ lib/qpxtransport/qpx_transport.cpp	2008-02-03 01:14:09.000000000 +0100
@@ -215,6 +215,21 @@
 #define KERNEL_BROKEN 0
 	if (use_sg_io)
 	{
+		/* see linux-2.6.23/block/scsi_ioctl.c:36 */
+		static const unsigned char scsi_command_size[8] =
+		{
+				6, 10, 10, 12,
+				16, 12, 10, 10
+		};
+		char cmdsize, opcode;
+
+		opcode = cgc.cmd[0];
+		/* see linux-2.6.23/include/scsi/scsi.h:25 */
+		cmdsize = scsi_command_size[((opcode) >> 5) & 7];
+		if ((sg_io.cmd_len > 0) && (sg_io.cmd_len < cmdsize)) {
+			sg_io.cmd_len = cmdsize;
+		}
+
 		sg_io.dxferp		= buf;
 		sg_io.dxfer_len		= sz;
 		sg_io.dxfer_direction	= use_sg_io[dir];

Reply via email to