diff --git a/lib/MSWindows/aspi32.c b/lib/MSWindows/aspi32.c index 1f9d064a..333511aa 100644 --- a/lib/MSWindows/aspi32.c +++ b/lib/MSWindows/aspi32.c @@ -1,5 +1,5 @@ /* - $Id: aspi32.c,v 1.48 2004/08/10 03:03:27 rocky Exp $ + $Id: aspi32.c,v 1.49 2004/08/27 04:12:29 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: aspi32.c,v 1.48 2004/08/10 03:03:27 rocky Exp $"; +static const char _rcsid[] = "$Id: aspi32.c,v 1.49 2004/08/27 04:12:29 rocky Exp $"; #include #include @@ -762,68 +762,6 @@ wnaspi32_eject_media (void *user_data) { } #endif -/*! - Return the the kind of drive capabilities of device. - - */ -void -get_drive_cap_aspi (const _img_private_t *p_env, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap) -{ - scsi_mmc_cdb_t cdb = {{0, }}; - uint8_t buf[256] = { 0, }; - int i_status; - - /* Set up passthrough command */ - CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_MODE_SENSE_10); - cdb.field[1] = 0x0; - cdb.field[2] = CDIO_MMC_ALL_PAGES; - cdb.field[7] = 0x01; - cdb.field[8] = 0x00; - - i_status = run_scsi_cmd_aspi(p_env, OP_TIMEOUT_MS, - scsi_mmc_get_cmd_len(cdb.field[0]), - &cdb, SCSI_MMC_DATA_READ, - sizeof(buf), buf); - if (0 == i_status) { - uint8_t *p; - int lenData = ((unsigned int)buf[0] << 8) + buf[1]; - uint8_t *pMax = buf + 256; - - *p_read_cap = 0; - *p_write_cap = 0; - *p_misc_cap = 0; - - /* set to first sense mask, and then walk through the masks */ - p = buf + 8; - while( (p < &(buf[2+lenData])) && (p < pMax) ) { - uint8_t which; - - which = p[0] & 0x3F; - switch( which ) - { - case CDIO_MMC_AUDIO_CTL_PAGE: - case CDIO_MMC_R_W_ERROR_PAGE: - case CDIO_MMC_CDR_PARMS_PAGE: - /* Don't handle these yet. */ - break; - case CDIO_MMC_CAPABILITIES_PAGE: - scsi_mmc_get_drive_cap_buf(p, p_read_cap, p_write_cap, p_misc_cap); - break; - default: ; - } - p += (p[1] + 2); - } - } else { - cdio_info("error in aspi USCSICMD MODE_SELECT"); - *p_read_cap = CDIO_DRIVE_CAP_UNKNOWN; - *p_write_cap = CDIO_DRIVE_CAP_UNKNOWN; - *p_misc_cap = CDIO_DRIVE_CAP_UNKNOWN; - } -} - /*! Get format of track. */ diff --git a/lib/MSWindows/aspi32.h b/lib/MSWindows/aspi32.h index 76340c07..d2467847 100644 --- a/lib/MSWindows/aspi32.h +++ b/lib/MSWindows/aspi32.h @@ -1,6 +1,6 @@ /* Win32 aspi specific */ /* - $Id: aspi32.h,v 1.12 2004/07/28 03:17:56 rocky Exp $ + $Id: aspi32.h,v 1.13 2004/08/27 04:12:29 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -170,18 +170,6 @@ SRB_HAInquiry; */ discmode_t get_discmode_aspi (_img_private_t *p_env); -/*! - Return the the kind of drive capabilities of device. - - Note: string is malloc'd so caller should free() then returned - string when done with it. - - */ -void get_drive_cap_aspi (const _img_private_t *env, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); - /*! Return the the kind of drive capabilities of device. diff --git a/lib/MSWindows/win32.c b/lib/MSWindows/win32.c index 19e71c5a..a3efff11 100644 --- a/lib/MSWindows/win32.c +++ b/lib/MSWindows/win32.c @@ -1,5 +1,5 @@ /* - $Id: win32.c,v 1.44 2004/08/10 12:09:20 rocky Exp $ + $Id: win32.c,v 1.45 2004/08/27 04:12:29 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32.c,v 1.44 2004/08/10 12:09:20 rocky Exp $"; +static const char _rcsid[] = "$Id: win32.c,v 1.45 2004/08/27 04:12:29 rocky Exp $"; #include #include @@ -112,35 +112,6 @@ is_cdrom_win32(const char drive_letter) { } } -/*! - Return the the kind of drive capabilities of device. - - Note: string is malloc'd so caller should free() then returned - string when done with it. - - */ -static void -_cdio_get_drive_cap (const void *env, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap) -{ - const _img_private_t *_obj = env; - - *p_read_cap = 0; - *p_write_cap = 0; - *p_misc_cap = 0; - - if (_obj->hASPI) { - /* A safe guess */ - - get_drive_cap_aspi (env, p_read_cap, p_write_cap, p_misc_cap); - } else { - get_drive_cap_win32ioctl (env, p_read_cap, p_write_cap, p_misc_cap); - } -} - - /*! Run a SCSI MMC command. @@ -717,7 +688,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode) .get_default_device = cdio_get_default_device_win32, .get_devices = cdio_get_devices_win32, .get_discmode = get_discmode_win32, - .get_drive_cap = _cdio_get_drive_cap, + .get_drive_cap = scsi_mmc_get_drive_cap_generic, .get_first_track_num= get_first_track_num_generic, .get_mcn = _cdio_get_mcn, .get_num_tracks = get_num_tracks_generic, diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index 4322c80d..0a381ae8 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.35 2004/08/10 03:03:27 rocky Exp $ + $Id: win32_ioctl.c,v 1.36 2004/08/27 04:12:29 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.35 2004/08/10 03:03:27 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.36 2004/08/27 04:12:29 rocky Exp $"; #include #include @@ -554,72 +554,4 @@ get_track_format_win32ioctl(const _img_private_t *env, track_t i_track) return TRACK_FORMAT_AUDIO; } - -/*! - Return the the kind of drive capabilities of device. - - Note: string is malloc'd so caller should free() then returned - string when done with it. - - */ -void -get_drive_cap_win32ioctl (const _img_private_t *p_env, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap) -{ - SCSI_PASS_THROUGH_WITH_BUFFERS sptwb; - ULONG returned = 0; - ULONG length; - - /* If device supports SCSI-3, then we can get the CD drive - capabilities, i.e. ability to read/write to CD-ROM/R/RW - or/and read/write to DVD-ROM/R/RW. */ - - memset(&sptwb,0, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS)); - - sptwb.Spt.Length = sizeof(SCSI_PASS_THROUGH); - sptwb.Spt.PathId = 0; - sptwb.Spt.TargetId = 1; - sptwb.Spt.Lun = 0; - sptwb.Spt.CdbLength = 6; /* CDB6GENERIC_LENGTH; */ - sptwb.Spt.SenseInfoLength = 24; - sptwb.Spt.DataIn = SCSI_IOCTL_DATA_IN; - sptwb.Spt.DataTransferLength = 192; - sptwb.Spt.TimeOutValue = 2; - sptwb.Spt.DataBufferOffset = - offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf); - sptwb.Spt.SenseInfoOffset = - offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,SenseBuf); - - CDIO_MMC_SET_COMMAND(sptwb.Spt.Cdb, CDIO_MMC_GPCMD_MODE_SENSE); - /*sptwb.Spt.Cdb[1] = 0x08; /+ doesn't return block descriptors */ - sptwb.Spt.Cdb[1] = 0x0; - sptwb.Spt.Cdb[2] = CDIO_MMC_CAPABILITIES_PAGE; - 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) + - sptwb.Spt.DataTransferLength; - - if ( DeviceIoControl(p_env->h_device_handle, - IOCTL_SCSI_PASS_THROUGH, - &sptwb, - sizeof(SCSI_PASS_THROUGH), - &sptwb, - length, - &returned, - FALSE) ) { - unsigned int n=sptwb.DataBuf[3]+4; - /* Reader? */ - scsi_mmc_get_drive_cap_buf(&(sptwb.DataBuf[n]), p_read_cap, - p_write_cap, p_misc_cap); - } else { - *p_read_cap = CDIO_DRIVE_CAP_UNKNOWN; - *p_write_cap = CDIO_DRIVE_CAP_UNKNOWN; - *p_misc_cap = CDIO_DRIVE_CAP_UNKNOWN; - } - return; -} - #endif /*HAVE_WIN32_CDROM*/