Hack to not step on vendor commands for some devices

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

 



Hi all,

I'm trying to support an usb-storage device that uses vendor-specific
SCSI commands for some functions; I'm using the sg interface from user
space.

The problem is, the linux kernel will replace some bits in the
vendor-specific command with the LUN number, making it unintelligible
to the device. I wrote the included patch that works around this
problem.

cmd->device->scsi_level is SCSI_2 for this device.

Is there any other user-space solution to this problem? If not, what
are the next steps to have a solution appear in the mainline kernel?

Best Regards,

Pontus

-- 
Pontus Lidman, pontus@xxxxxxxxxxxxxx, Software Engineer

diff --recursive -u linux-2.6.24.5/drivers/scsi/scsi.c linux-2.6.24.5.pl/drivers/scsi/scsi.c
--- linux-2.6.24.5/drivers/scsi/scsi.c	2008-04-19 03:53:39.000000000 +0200
+++ linux-2.6.24.5.pl/drivers/scsi/scsi.c	2008-04-27 17:17:35.000000000 +0200
@@ -501,9 +501,12 @@
 
 	/* 
 	 * If SCSI-2 or lower, store the LUN value in cmnd.
+	 * However, don't modify the contents of vendor specific
+	 * commands (0xf0-0xff).
 	 */
 	if (cmd->device->scsi_level <= SCSI_2 &&
-	    cmd->device->scsi_level != SCSI_UNKNOWN) {
+	    cmd->device->scsi_level != SCSI_UNKNOWN &&
+	    cmd->cmnd[0] < 0xf0) {
 		cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
 			       (cmd->device->lun << 5 & 0xe0);
 	}


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux