patch-1.3.76 linux/drivers/scsi/sr_ioctl.c

Next file: linux/drivers/sound/configure.c
Previous file: linux/drivers/scsi/sr.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.75/linux/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
@@ -378,6 +378,44 @@
 	return result;
     }
 	
+    case CDROMVOLREAD:
+    {
+	char * buffer;
+	struct cdrom_volctrl volctrl;
+	
+        err = verify_area (VERIFY_WRITE, (void *) arg, sizeof (struct cdrom_volctrl));
+        if (err) return err;
+	
+	/* Get the current params */
+	
+	sr_cmd[0] = MODE_SENSE;
+	sr_cmd[1] = (scsi_CDs[target].device -> lun) << 5;
+	sr_cmd[2] = 0xe;    /* Want mode page 0xe, CDROM audio params */
+	sr_cmd[3] = 0;
+	sr_cmd[4] = 28;
+	sr_cmd[5] = 0;
+	
+	buffer = (unsigned char *) scsi_malloc(512);
+	if(!buffer) return -ENOMEM;
+	
+	if ((result = do_ioctl (target, sr_cmd, buffer, 28))) {
+	    printk ("(CDROMVOLREAD) Hosed while obtaining audio mode page\n");
+	    scsi_free(buffer, 512);
+	    return result;
+	}
+
+	volctrl.channel0 = buffer[21];
+	volctrl.channel1 = buffer[23];
+	volctrl.channel2 = buffer[25];
+	volctrl.channel3 = buffer[27];
+
+	memcpy_tofs ((void *) arg, &volctrl, sizeof (struct cdrom_volctrl));
+
+	scsi_free(buffer, 512);
+
+	return 0;
+    }
+	
     case CDROMSUBCHNL:
     {
 	struct cdrom_subchnl subchnl;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this