DVD RAM patches.

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Wed, 9 Dec 1998 14:18:44 +0100 (MET)


Hi,

Some DVD RAM devices claim to be an CDROM device. The patch below
overrides this to make the kernel think of them as an magneto-optical
device.

This allows me to use my DVD RAM drive as a disk drive. This probably
disallows using the DVD RAM drive to play audio (and other CDROM
specific stuff).

Anybody looking for a project?

I think that the sr CDROM driver should actually disappear and be
merged into the sd driver. An extra "capability flag" should
enable/disable the CDROM specific stuff.

Here is the patch:

--- linux-2.1.130.clean/drivers/scsi/scsi.c Fri Nov 13 19:16:15 1998
+++ linux-2.1.130.sx/drivers/scsi/scsi.c Wed Dec 9 13:53:18 1998
@@ -100,13 +100,14 @@
* lock up.
*/

-#define BLIST_NOLUN 0x01
-#define BLIST_FORCELUN 0x02
-#define BLIST_BORKEN 0x04
-#define BLIST_KEY 0x08
-#define BLIST_SINGLELUN 0x10
-#define BLIST_NOTQ 0x20
-#define BLIST_SPARSELUN 0x40
+#define BLIST_NOLUN 0x01
+#define BLIST_FORCELUN 0x02
+#define BLIST_BORKEN 0x04
+#define BLIST_KEY 0x08
+#define BLIST_SINGLELUN 0x10
+#define BLIST_NOTQ 0x20
+#define BLIST_SPARSELUN 0x40
+#define BLIST_IS_MO_DEVICE 0x80

/*
* Data declarations.
@@ -275,6 +276,8 @@
{"CANON","IPUBJD","*", BLIST_SPARSELUN},
{"nCipher","Fastness Crypto","*", BLIST_FORCELUN},
{"MATSHITA","PD","*", BLIST_FORCELUN | BLIST_SINGLELUN},
+{"MATSHITA","PD-2 LF-D100","*", BLIST_IS_MO_DEVICE},
+{"CREATIVE","DVD-RAM RAM1220S","*", BLIST_IS_MO_DEVICE},
{"YAMAHA","CDR100","1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
{"YAMAHA","CDR102","1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
/*
@@ -763,6 +766,22 @@
SDpnt->random = (type == TYPE_TAPE) ? 0 : 1;
SDpnt->type = (type & 0x1f);

+ /*
+ * Get any flags for this device.
+ */
+ bflags = get_device_flags (scsi_result);
+
+ /*
+ * Some devices (Currently two DVD-RAM devices) claim to be a CDROM drive,
+ * but they work a bit better (i.e. you can write to them) if you tell
+ * the kernel that they are an MO device. -- REW
+ */
+
+ if (bflags & BLIST_IS_MO_DEVICE) {
+ SDpnt->type = TYPE_MOD;
+ SDpnt->writeable = 1;
+ }
+
print_inquiry (scsi_result);

for (sdtpnt = scsi_devicelist; sdtpnt;
@@ -783,10 +802,6 @@
*/
SDpnt->disconnect = 0;

- /*
- * Get any flags for this device.
- */
- bflags = get_device_flags (scsi_result);

/*
* Set the tagged_queue flag for SCSI-II devices that purport to support

Regards,

Roger.

-- 
My pet light bulb is a year old today.   \_________  R.E.Wolff@BitWizard.nl
That's 5.9*10^12 miles. Your mileage will NOT vary.\__Phone: +31-15-2137555
--(time <-> distance can be converted: lightspeed)--  \____ fax: ..-2138217
We write Linux device drivers for any device you may have! \_______________

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/