From 54e0e9a52f254ae4047ca206dffd9b7be5c14213 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 28 Apr 2005 01:25:53 +0000 Subject: [PATCH] An ATAPI drive (_NEC , DVD_RW ND-3520A, 1.04, SCSI CD-ROM) was getting set as big endian although it appeared not to, possibly because of SCSI emulation. We now test for SCSIness in addition to ATAPIness as both can occur. Added field in cdrom_device structure for SCSIness and that's tested before unconditionally setting drive bigendian-ness. --- include/cdio/cdda.h | 3 ++- lib/cdda_interface/interface.c | 6 +++--- lib/cdda_interface/scan_devices.c | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/cdio/cdda.h b/include/cdio/cdda.h index 94ea0608..e39ca041 100644 --- a/include/cdio/cdda.h +++ b/include/cdio/cdda.h @@ -1,5 +1,5 @@ /* - $Id: cdda.h,v 1.19 2005/02/05 23:53:06 rocky Exp $ + $Id: cdda.h,v 1.20 2005/04/28 01:25:53 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein Copyright (C) 2001 Xiph.org @@ -113,6 +113,7 @@ struct cdrom_drive_s { int is_atapi; int is_mmc; + int is_scsi; int i_test_flags; /**< Normally set 0. But if we are testing paranoia operation this can be set to one of diff --git a/lib/cdda_interface/interface.c b/lib/cdda_interface/interface.c index c852be25..722707f6 100644 --- a/lib/cdda_interface/interface.c +++ b/lib/cdda_interface/interface.c @@ -1,5 +1,5 @@ /* - $Id: interface.c,v 1.22 2005/02/10 01:59:06 rocky Exp $ + $Id: interface.c,v 1.23 2005/04/28 01:25:53 rocky Exp $ Copyright (C) 2005 Rocky Bernstein Copyright (C) 1998 Monty xiphmont@mit.edu @@ -121,8 +121,8 @@ cdio_cddap_open(cdrom_drive_t *d) /* d->select_speed(d,d->maxspeed); most drives are full speed by default */ if ( -1 == d->bigendianp ) { - if (yep == cdio_have_atapi(d->p_cdio)) - /* Is this right? Might we also have to check for SCSI ATAPI? */ + if (1 != d->is_scsi && yep == cdio_have_atapi(d->p_cdio)) + /* Is this right? */ d->bigendianp = 1; else d->bigendianp = data_bigendianp(d); diff --git a/lib/cdda_interface/scan_devices.c b/lib/cdda_interface/scan_devices.c index 90c3a8ef..6948a3ab 100644 --- a/lib/cdda_interface/scan_devices.c +++ b/lib/cdda_interface/scan_devices.c @@ -1,5 +1,5 @@ /* - $Id: scan_devices.c,v 1.26 2005/02/07 03:36:02 rocky Exp $ + $Id: scan_devices.c,v 1.27 2005/04/28 01:25:53 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein Copyright (C) 1998 Monty xiphmont@mit.edu @@ -211,6 +211,7 @@ cdda_identify_device_cdio(CdIo_t *p_cdio, const char *psz_device, { cdrom_drive_t *d=NULL; int drive_type = 0; + int is_scsi = -1; char *description=NULL; #ifdef HAVE_LINUX_MAJOR_H struct stat st; @@ -232,6 +233,7 @@ cdda_identify_device_cdio(CdIo_t *p_cdio, const char *psz_device, case IDE3_MAJOR: /* Yay, ATAPI... */ description=strdup("ATAPI compatible "); + is_scsi = 0; break; case CDU31A_CDROM_MAJOR: /* major indicates this is a cdrom; no ping necessary. */ @@ -273,6 +275,7 @@ cdda_identify_device_cdio(CdIo_t *p_cdio, const char *psz_device, case SCSI_GENERIC_MAJOR: /* Nope nope nope */ description=strdup("SCSI CD-ROM"); + is_scsi = 1; break; default: /* What the hell is this? */ @@ -291,8 +294,9 @@ cdda_identify_device_cdio(CdIo_t *p_cdio, const char *psz_device, d->p_cdio = p_cdio; d->cdda_device_name = strdup(psz_device); d->drive_type = drive_type; + d->is_scsi = is_scsi; d->bigendianp = -1; /* We don't know yet... */ - d->nsectors = -1; + d->nsectors = -1; /* We don't know yet... */ d->b_swap_bytes = true; {