lkml.org 
[lkml]   [2000]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [unpatch] ide cd-audio broken in 2.2.17preN (N >= 2)
On Mon, Sep 04 2000, Nathan Myers wrote:
> The IDE CD audio driver is broken in the 2.2.17pre series, since 2.2.17pre2.
> I have attached below the patch fragment that causes the problem, and the
> console error messages that appear. Backing out the one change fixes CD
> audio playback in 2.2.17pre20, on this machine.

... which then breaks on some SCSI. Could you try the attached patch
instead? CDROMPLAYTRKIND ought not to be used by players that wish
to work on ATAPI as well as SCSI, but since that has been used before
this patch emulates that particular command using a generic equivalent.
We used to emulate the command with PLAY_AUDIO_MSF on both ATAPI and
SCSI, but that breaks pre SCSI-2 CD-ROM's...

Another solution is to emulate PLAY_AUDIO_TRACK_INDEX with PLAY_AUDIO_10
on both, but that probably breaks some other innocent non-standard
drives (and looses the neat although rarely used index feature).

Against 2.2.18-pre3

--
* Jens Axboe <axboe@suse.de>
* SuSE Labs
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.2.18-pre3/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c
--- /opt/kernel/linux-2.2.18-pre3/drivers/block/ide-cd.c Mon Sep 4 23:03:34 2000
+++ linux/drivers/block/ide-cd.c Tue Sep 5 00:19:01 2000
@@ -1827,6 +1827,20 @@
return cdrom_queue_packet_command(drive, &pc);
}

+static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end)
+{
+ struct request_sense sense;
+ struct packet_command pc;
+
+ memset(&pc, 0, sizeof (pc));
+ pc.sense = &sense;
+
+ pc.c[0] = GPCMD_PLAY_AUDIO_10;
+ put_unaligned(cpu_to_be32(lba_start), (unsigned int *) &pc.c[2]);
+ put_unaligned(cpu_to_be16(lba_end - lba_start), (unsigned int *) &pc.c[7]);
+
+ return cdrom_queue_packet_command(drive, &pc);
+}

static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
struct atapi_toc_entry **ent)
@@ -1932,6 +1946,34 @@
struct cdrom_info *info = drive->driver_data;

switch (cmd) {
+ /*
+ * emulate PLAY_AUDIO_TI command with PLAY_AUDIO_10, since
+ * atapi doesn't support it
+ */
+ case CDROMPLAYTRKIND: {
+ int stat, lba_start, lba_end;
+ struct cdrom_ti *ti = (struct cdrom_ti *)arg;
+ struct atapi_toc_entry *first_toc, *last_toc;
+
+ stat = cdrom_get_toc_entry(drive, ti->cdti_trk0, &first_toc);
+ if (stat)
+ return stat;
+
+ stat = cdrom_get_toc_entry(drive, ti->cdti_trk1, &last_toc);
+ if (stat)
+ return stat;
+
+ if (ti->cdti_trk1 != CDROM_LEADOUT)
+ ++last_toc;
+ lba_start = first_toc->addr.lba;
+ lba_end = last_toc->addr.lba;
+
+ if (lba_end <= lba_start)
+ return -EINVAL;
+
+ return cdrom_play_audio(drive, lba_start, lba_end);
+ }
+
case CDROMREADTOCHDR: {
int stat;
struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg;
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.2.18-pre3/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
--- /opt/kernel/linux-2.2.18-pre3/drivers/cdrom/cdrom.c Mon Sep 4 23:03:34 2000
+++ linux/drivers/cdrom/cdrom.c Tue Sep 5 00:03:36 2000
@@ -1966,19 +1966,6 @@
/* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */
return 0;
}
- case CDROMPLAYTRKIND: {
- struct cdrom_ti ti;
-
- cdinfo(CD_DO_IOCTL, "entering CDROMPLAYTRKIND\n");
- IOCTL_IN(arg, struct cdrom_ti, ti);
-
- cgc.cmd[0] = GPCMD_PLAY_AUDIO_TI;
- cgc.cmd[4] = ti.cdti_trk0;
- cgc.cmd[5] = ti.cdti_ind0;
- cgc.cmd[7] = ti.cdti_trk1;
- cgc.cmd[8] = ti.cdti_ind1;
- return cdo->generic_packet(cdi, &cgc);
- }
case CDROMPLAYMSF: {
struct cdrom_msf msf;
cdinfo(CD_DO_IOCTL, "entering CDROMPLAYMSF\n");
\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.038 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site