2.2.16 breaks audioplay on some cdrom drives

From: Ingo Wilken (Ingo.Wilken@Informatik.Uni-Oldenburg.DE)
Date: Sat Jun 10 2000 - 18:32:26 EST


Hi

After upgrading to 2.2.16, the CDROM drive on one of my systems (an old
Sony CDU-76S SCSI drive) could no longer be used to play audio tracks.
The problem is that .16 no longer supports the play track/index-ioctl
directly, but simulates it with GPCMD_PLAY_AUDIO_MSF. Unfortunately,
the Sony drive only supports the track/index-command for audio playback.

The following patch for 2.2.16 restores the low-level SCSI
track/index-ioctl (from 2.2.15) in sr_ioctl.c and adds a kludge to
cdrom.c to fall back to the low-level ioctl if GPCMD_PLAY_AUDIO_MSF
returns an error. It's not very elegant, but works here.

Regards,
Ingo

===================== cut here ==================
diff -cwr kernel-source-2.2.16-orig/drivers/cdrom/cdrom.c kernel-source-2.2.16/drivers/cdrom/cdrom.c
*** kernel-source-2.2.16-orig/drivers/cdrom/cdrom.c Sat Jun 10 11:49:37 2000
--- kernel-source-2.2.16/drivers/cdrom/cdrom.c Sat Jun 10 11:50:11 2000
***************
*** 1986,1992 ****
                  cgc.cmd[7] = entry.cdte_addr.msf.second;
                  cgc.cmd[8] = entry.cdte_addr.msf.frame;
                  cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
! return cdo->generic_packet(cdi, &cgc);
                  }
          case CDROMPLAYMSF: {
                  struct cdrom_msf msf;
--- 1986,1996 ----
                  cgc.cmd[7] = entry.cdte_addr.msf.second;
                  cgc.cmd[8] = entry.cdte_addr.msf.frame;
                  cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
! ret = cdo->generic_packet(cdi, &cgc);
! /* try CDROMPLAYTRKIND on the low-level driver */
! if (ret != 0)
! ret = cdo->audio_ioctl(cdi, cmd, &ti);
! return ret;
                  }
          case CDROMPLAYMSF: {
                  struct cdrom_msf msf;
diff -cwr kernel-source-2.2.16-orig/drivers/scsi/sr_ioctl.c kernel-source-2.2.16/drivers/scsi/sr_ioctl.c
*** kernel-source-2.2.16-orig/drivers/scsi/sr_ioctl.c Fri Jun 9 23:27:18 2000
--- kernel-source-2.2.16/drivers/scsi/sr_ioctl.c Sat Jun 10 14:27:49 2000
***************
*** 366,371 ****
--- 366,389 ----
          break;
      }
  
+ case CDROMPLAYTRKIND:
+ {
+ struct cdrom_ti* ti = (struct cdrom_ti*)arg;
+
+ sr_cmd[0] = SCMD_PLAYAUDIO_TI;
+ sr_cmd[1] = scsi_CDs[target].device->lun << 5;
+ sr_cmd[2] = 0; sr_cmd[3] = 0;
+ sr_cmd[4] = ti->cdti_trk0;
+ sr_cmd[5] = ti->cdti_ind0;
+ sr_cmd[6] = 0;
+ sr_cmd[7] = ti->cdti_trk1;
+ sr_cmd[8] = ti->cdti_ind1;
+ sr_cmd[9] = 0;
+
+ result = sr_do_ioctl(target, sr_cmd, NULL, 255, 0);
+ break;
+ }
+
      default:
          return -EINVAL;
      }
diff -cwr kernel-source-2.2.16-orig/include/linux/cdrom.h kernel-source-2.2.16/include/linux/cdrom.h
*** kernel-source-2.2.16-orig/include/linux/cdrom.h Fri Jun 9 23:27:41 2000
--- kernel-source-2.2.16/include/linux/cdrom.h Sat Jun 10 13:44:33 2000
***************
*** 365,370 ****
--- 365,373 ----
  #define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */
  #define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */
  
+ /* CD-ROM-specific SCSI command opcodes */
+ #define SCMD_PLAYAUDIO_TI 0x48 /* play data at track/index */
+
  /* capability flags used with the uniform CD-ROM driver */
  #define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */
  #define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */
===================== cut here ==================

-
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/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:22 EST