If there is a more official channel through which to submit patches, I am not 
aware of it, so I hope nobody will mind if I post this patch here.

This patch adds support for the Freecom FS-1 slimline external CD-RW drive.

Ralf Rösch hinted at an unusual_dev entry using the US_FL_FIX_INQUIRY flag, 
since another external Freecom device apparently needs that flag. However, 
the faked INQUIRY response always returns a SCSI peripheral type of 0x00, 
indicating a direct-access disk. This new device is apparently the first 
CD-ROM device to require the inquiry fix, so I have simply added a 
US_FL_FIX_INQUIRY_CD flag and corresponding code alongside the 
US_FL_FIX_INQUIRY code.

Very best wishes,

-Steve


-- 
Steve Purcell
http://advogato.org/person/purcell
diff -Naur kernel-source-2.4.21-pre3/drivers/usb/storage/unusual_devs.h kernel-source-2.4.21-pre3.patched/drivers/usb/storage/unusual_devs.h
--- kernel-source-2.4.21-pre3/drivers/usb/storage/unusual_devs.h	2003-01-24 13:53:31.000000000 +0100
+++ kernel-source-2.4.21-pre3.patched/drivers/usb/storage/unusual_devs.h	2003-01-24 13:01:09.000000000 +0100
@@ -411,6 +411,11 @@
                 US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
 #endif
 
+UNUSUAL_DEV(  0x07ab, 0xfc03, 0x0000, 0x9999,
+		"Freecom",
+		"USB FS-1 CD-RW",
+		US_SC_8020, US_PR_BULK, NULL, US_FL_FIX_INQUIRY_CD),
+
 UNUSUAL_DEV(  0x07af, 0x0004, 0x0100, 0x0133, 
 		"Microtech",
 		"USB-SCSI-DB25",
diff -Naur kernel-source-2.4.21-pre3/drivers/usb/storage/usb.c kernel-source-2.4.21-pre3.patched/drivers/usb/storage/usb.c
--- kernel-source-2.4.21-pre3/drivers/usb/storage/usb.c	2002-11-29 17:31:59.000000000 +0100
+++ kernel-source-2.4.21-pre3.patched/drivers/usb/storage/usb.c	2003-01-24 12:48:51.000000000 +0100
@@ -453,6 +453,15 @@
 					US_DEBUGP("Faking INQUIRY command\n");
 					fill_inquiry_response(us, data_ptr, 36);
 					us->srb->result = GOOD << 1;
+                                } else if ((us->srb->cmnd[0] == INQUIRY) &&
+                                    (us->flags & US_FL_FIX_INQUIRY_CD)) {
+                                        unsigned char data_ptr[36] = {
+                                            0x05, 0x80, 0x02, 0x02,
+                                            0x1F, 0x00, 0x00, 0x00};
+
+                                        US_DEBUGP("Faking INQUIRY command for CD-ROM\n");
+                                        fill_inquiry_response(us, data_ptr, 36);
+                                        us->srb->result = GOOD << 1;
 				} else {
 					/* we've got a command, let's do it! */
 					US_DEBUG(usb_stor_show_command(us->srb));
diff -Naur kernel-source-2.4.21-pre3/drivers/usb/storage/usb.h kernel-source-2.4.21-pre3.patched/drivers/usb/storage/usb.h
--- kernel-source-2.4.21-pre3/drivers/usb/storage/usb.h	2002-11-29 17:32:19.000000000 +0100
+++ kernel-source-2.4.21-pre3.patched/drivers/usb/storage/usb.h	2003-01-24 13:01:07.000000000 +0100
@@ -101,6 +101,8 @@
 #define US_FL_IGNORE_SER      0x00000010 /* Ignore the serial number given  */
 #define US_FL_SCM_MULT_TARG   0x00000020 /* supports multiple targets */
 #define US_FL_FIX_INQUIRY     0x00000040 /* INQUIRY response needs fixing */
+#define US_FL_FIX_INQUIRY_CD  0x00000080 /* INQUIRY response needs fixing for CD
+ROM */
 
 #define USB_STOR_STRING_LEN 32
 

Reply via email to