More drive capability fixups. (Not sure about win32 fixes yet though.)

This commit is contained in:
rocky
2004-04-24 11:48:37 +00:00
parent c347347bd9
commit 53bb5de3d6
5 changed files with 46 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/* -*- c -*- /* -*- c -*-
$Id: cdio.h,v 1.40 2004/04/24 04:49:26 rocky Exp $ $Id: cdio.h,v 1.41 2004/04/24 11:48:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -59,19 +59,23 @@
have only partial information or have only partial information or
are not completely certain are not completely certain
*/ */
#define CDIO_DRIVE_FILE 0x1000 /**< drive is really a file, i.e a #define CDIO_DRIVE_CD_AUDIO 0x100 /**< drive can play CD audio */
CD file image */ #define CDIO_DRIVE_CD_R 0x2000 /**< drive can write CD-R */
#define CDIO_DRIVE_CD_R 0x2000 /**< drive is a CD-R */ #define CDIO_DRIVE_CD_RW 0x4000 /**< drive can write CD-RW */
#define CDIO_DRIVE_CD_RW 0x4000 /**< drive is a CD-RW */ #define CDIO_DRIVE_DVD 0x8000 /**< drive can read DVD */
#define CDIO_DRIVE_DVD 0x8000 /**< drive is a DVD */
#define CDIO_DRIVE_DVD_R 0x10000 /**< drive can write DVD-R */ #define CDIO_DRIVE_DVD_R 0x10000 /**< drive can write DVD-R */
#define CDIO_DRIVE_DVD_RAM 0x20000 /**< drive can write DVD-RAM */ #define CDIO_DRIVE_DVD_RAM 0x20000 /**< drive can write DVD-RAM */
#define CDIO_DRIVE_FILE 0x80000 /**< drive is really a file, i.e a
CD file image */
#define CDIO_DRIVE_CD_READER (CDIO_DRIVE_CD_R|CDIO_DRIVE_CD_RW) #define CDIO_DRIVE_CD_WRITER (CDIO_DRIVE_CD_R|CDIO_DRIVE_CD_RW)
#define CDIO_DRIVE_CD_WRITER (CDIO_DRIVE_RW) /**< Has some sort of CD writer ability */
#define CDIO_DRIVE_CD (CDIO_DRIVE_CD_AUDIO|CDIO_DRIVE_CD_WRITER)
/**< Has some sort of CD ability */
#define CDIO_DRIVE_DVD_READER (CDIO_DRIVE_DVD|CDIO_DRIVE_DVD_R|CDIO_DRIVE_DVD_RAM)
#define CDIO_DRIVE_DVD_WRITER (CDIO_DRIVE_DVD_R|CDIO_DRIVE_DVD_RAM) #define CDIO_DRIVE_DVD_WRITER (CDIO_DRIVE_DVD_R|CDIO_DRIVE_DVD_RAM)
/**< Has some sort of DVD writer ability */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@@ -1,5 +1,5 @@
/* /*
$Id: ioctl.c,v 1.6 2004/04/24 04:46:33 rocky Exp $ $Id: ioctl.c,v 1.7 2004/04/24 11:48:37 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: ioctl.c,v 1.6 2004/04/24 04:46:33 rocky Exp $"; static const char _rcsid[] = "$Id: ioctl.c,v 1.7 2004/04/24 11:48:37 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -454,7 +454,7 @@ win32ioctl_get_drive_cap (const void *env) {
memset(&sptwb,0, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS)); memset(&sptwb,0, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
sptwb.Spt.Length = sizeof(SCSI_PASS_THROUGH); sptwb.Spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.Spt.PathId = 0; sptwb.Spt.PathId = 0;
sptwb.Spt.TargetId = 1; sptwb.Spt.TargetId = 1;
sptwb.Spt.Lun = 0; sptwb.Spt.Lun = 0;
@@ -467,10 +467,12 @@ win32ioctl_get_drive_cap (const void *env) {
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf); offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf);
sptwb.Spt.SenseInfoOffset = sptwb.Spt.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,SenseBuf); offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,SenseBuf);
sptwb.Spt.Cdb[0] = SCSIOP_MODE_SENSE; sptwb.Spt.Cdb[0] = CDIO_MMC_MODE_SENSE;
sptwb.Spt.Cdb[1] = 0x08; /* target doesn't return block descriptors */ sptwb.Spt.Cdb[1] = 0x08; /* doesn't return block descriptors */
sptwb.Spt.Cdb[2] = MODE_PAGE_CAPABILITIES; sptwb.Spt.Cdb[2] = 0x2a; /*MODE_PAGE_CAPABILITIES*/;
sptwb.Spt.Cdb[4] = 192; sptwb.Spt.Cdb[3] = 0; /* Not used */
sptwb.Spt.Cdb[4] = 128;
sptwb.Spt.Cdb[5] = 0; /* Not used */
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf) + length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf) +
sptwb.Spt.DataTransferLength; sptwb.Spt.DataTransferLength;
@@ -483,23 +485,19 @@ win32ioctl_get_drive_cap (const void *env) {
&returned, &returned,
FALSE) ) FALSE) )
{ {
/* Reader */ /* Reader? */
if (sptwb.DataBuf[6] & 0x01) i_drivetype |= CDIO_DRIVE_CD_R; i_drivetype |= CDIO_DRIVE_CD_AUDIO;
if (sptwb.DataBuf[6] & 0x02) i_drivetype |= CDIO_DRIVE_CD_RW; if (sptwb.DataBuf[6] & 0x02) i_drivetype |= CDIO_DRIVE_CD_RW;
if (sptwb.DataBuf[6] & 0x08) i_drivetype |= CDIO_DRIVE_DVD; if (sptwb.DataBuf[6] & 0x08) i_drivetype |= CDIO_DRIVE_DVD;
if (sptwb.DataBuf[6] & 0x10) i_drivetype |= CDIO_DRIVE_DVD_R;
if (sptwb.DataBuf[6] & 0x20) i_drivetype |= CDIO_DRIVE_DVD_RAM;
/* Writer */ /* Writer? */
if (sptwb.DataBuf[7] & 0x01) i_drivetype |= CDIO_DRIVE_CD_R; if (sptwb.DataBuf[7] & 0x01) i_drivetype |= CDIO_DRIVE_CD_R;
if (sptwb.DataBuf[7] & 0x02) i_drivetype |= CDIO_DRIVE_CD_RW;
if (sptwb.DataBuf[7] & 0x08) i_drivetype |= CDIO_DRIVE_DVD;
if (sptwb.DataBuf[7] & 0x10) i_drivetype |= CDIO_DRIVE_DVD_R; if (sptwb.DataBuf[7] & 0x10) i_drivetype |= CDIO_DRIVE_DVD_R;
if (sptwb.DataBuf[7] & 0x20) i_drivetype |= CDIO_DRIVE_DVD_RAM; if (sptwb.DataBuf[7] & 0x20) i_drivetype |= CDIO_DRIVE_DVD_RAM;
return i_drivetype; return i_drivetype;
} else { } else {
i_drivetype = CDIO_DRIVE_CD_R | CDIO_DRIVE_UNKNOWN; i_drivetype = CDIO_DRIVE_CD_AUDIO | CDIO_DRIVE_UNKNOWN;
} }
return CDIO_DRIVE_ERROR; return CDIO_DRIVE_ERROR;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.5 2004/04/24 04:46:33 rocky Exp $ $Id: win32.c,v 1.6 2004/04/24 11:48:37 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32.c,v 1.5 2004/04/24 04:46:33 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.6 2004/04/24 11:48:37 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -596,8 +596,9 @@ cdio_get_default_device_win32(void)
bool bool
cdio_is_device_win32(const char *source_name) cdio_is_device_win32(const char *source_name)
{ {
unsigned int len = strlen(source_name); unsigned int len;
len = strlen(source_name);
if (NULL == source_name) return false; if (NULL == source_name) return false;
#ifdef HAVE_WIN32_CDROM #ifdef HAVE_WIN32_CDROM

View File

@@ -1,5 +1,5 @@
/* /*
$Id: scsi_mmc.h,v 1.4 2003/09/20 12:34:02 rocky Exp $ $Id: scsi_mmc.h,v 1.5 2004/04/24 11:48:37 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -36,6 +36,8 @@
/* The generic packet command opcodes for CD/DVD Logical Units, /* The generic packet command opcodes for CD/DVD Logical Units,
* From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
#define CDIO_MMC_MODE_SENSE_10 0x5a
#define CDIO_MMC_MODE_SENSE 0x1a
#define CDIO_MMC_GPCMD_READ_CD 0xbe #define CDIO_MMC_GPCMD_READ_CD 0xbe
#define CDIO_MMC_GPCMD_READ_10 0x28 #define CDIO_MMC_GPCMD_READ_10 0x28
#define CDIO_MMC_GPCMD_READ_12 0xa8 #define CDIO_MMC_GPCMD_READ_12 0xa8

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd-info.c,v 1.55 2004/04/24 04:48:06 rocky Exp $ $Id: cd-info.c,v 1.56 2004/04/24 11:48:37 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org> Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
@@ -837,21 +837,21 @@ main(int argc, const char *argv[])
if (CDIO_DRIVE_FILE == i_drive_cap) { if (CDIO_DRIVE_FILE == i_drive_cap) {
printf("Disc-image file\n"); printf("Disc-image file\n");
} else { } else {
printf("CD Reader : %s\n", printf("Compact Disc : %s\n",
i_drive_cap & CDIO_DRIVE_CD_READER ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_CD ? "Yes" : "No");
printf(" CD-R : %s\n", printf(" Can play audio : %s\n",
i_drive_cap & CDIO_DRIVE_CD_AUDIO ? "Yes" : "No");
printf(" Can write CD-R : %s\n",
i_drive_cap & CDIO_DRIVE_CD_R ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_CD_R ? "Yes" : "No");
printf(" CD-RW : %s\n\n", printf(" Can write CD-RW : %s\n\n",
i_drive_cap & CDIO_DRIVE_CD_RW ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_CD_RW ? "Yes" : "No");
printf("DVD Reader : %s\n", printf("Digital Versital Disc: %s\n",
i_drive_cap & CDIO_DRIVE_DVD_READER ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_DVD ? "Yes" : "No");
printf(" DVD-ROM : %s\n", printf(" Can write DVD-R : %s\n",
i_drive_cap & CDIO_DRIVE_DVD ? "Yes" : "No");
printf(" DVD-R : %s\n",
i_drive_cap & CDIO_DRIVE_DVD_R ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_DVD_R ? "Yes" : "No");
printf(" DVD_RAM : %s\n", printf(" Can write DVD-RAM : %s\n",
i_drive_cap & CDIO_DRIVE_DVD_RAM ? "Yes" : "No"); i_drive_cap & CDIO_DRIVE_DVD_RAM ? "Yes" : "No");
} }
if (CDIO_DRIVE_UNKNOWN == i_drive_cap) { if (CDIO_DRIVE_UNKNOWN == i_drive_cap) {
printf("Not sure about drive properties\n\n"); printf("Not sure about drive properties\n\n");