Finish get_MCN for aspi. Use conventions to make look more like

other SCSI passthrough routines.
This commit is contained in:
rocky
2004-07-16 01:25:57 +00:00
parent d78dfc43ac
commit 3747be0b8b
3 changed files with 72 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: aspi32.c,v 1.22 2004/07/15 02:24:29 rocky Exp $ $Id: aspi32.c,v 1.23 2004/07/16 01:25:57 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.22 2004/07/15 02:24:29 rocky Exp $"; static const char _rcsid[] = "$Id: aspi32.c,v 1.23 2004/07/16 01:25:57 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -382,13 +382,12 @@ init_aspi (_img_private_t *env)
return false; return false;
} }
/*!
/*
Issue a SCSI passthrough command. Issue a SCSI passthrough command.
*/ */
static bool static bool
scsi_mmc_command( const _img_private_t *env, scsi_mmc_command( const _img_private_t *env,
void * indata, unsigned int i_indata, void * scsi_cdb, unsigned int i_scsi_cdb,
void * outdata, unsigned int i_outdata ) void * outdata, unsigned int i_outdata )
{ {
HANDLE hEvent; HANDLE hEvent;
@@ -411,7 +410,7 @@ scsi_mmc_command( const _img_private_t *env,
ssc.SRB_SenseLen = SENSE_LEN; ssc.SRB_SenseLen = SENSE_LEN;
ssc.SRB_PostProc = (LPVOID) hEvent; ssc.SRB_PostProc = (LPVOID) hEvent;
ssc.SRB_CDBLen = i_indata; ssc.SRB_CDBLen = i_scsi_cdb;
ssc.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY; ssc.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY;
@@ -419,7 +418,7 @@ scsi_mmc_command( const _img_private_t *env,
ssc.SRB_BufPointer = outdata; ssc.SRB_BufPointer = outdata;
ssc.SRB_BufLen = i_outdata; ssc.SRB_BufLen = i_outdata;
memcpy( ssc.CDBByte, indata, i_indata ); memcpy( ssc.CDBByte, scsi_cdb, i_scsi_cdb );
ResetEvent( hEvent ); ResetEvent( hEvent );
env->lpSendCommand( (void*) &ssc ); env->lpSendCommand( (void*) &ssc );
@@ -721,15 +720,15 @@ wnaspi32_eject_media (void *user_data) {
const cdtext_t * const cdtext_t *
get_cdtext_aspi (_img_private_t *env) get_cdtext_aspi (_img_private_t *env)
{ {
uint8_t bigbuffer[5000] = { 0, }; uint8_t wdata[5000] = { 0, };
uint8_t cmd[10] = { 0, }; uint8_t scsi_cdb[10] = { 0, };
CDIO_MMC_SET_COMMAND(cmd, CDIO_MMC_GPCMD_READ_TOC); CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_READ_TOC);
cmd[1] = 0x02; /* MSF mode */ scsi_cdb[1] = 0x02; /* MSF mode */
cmd[2] = 0x05; /* CD text */ scsi_cdb[2] = 0x05; /* CD text */
CDIO_MMC_SET_READ_LENGTH(cmd, sizeof(bigbuffer)); CDIO_MMC_SET_READ_LENGTH(scsi_cdb, sizeof(wdata));
if (!scsi_mmc_command(env, cmd, sizeof(cmd), bigbuffer, sizeof(bigbuffer))) if (!scsi_mmc_command(env, scsi_cdb, sizeof(scsi_cdb), wdata, sizeof(wdata)))
return NULL; return NULL;
{ {
@@ -743,7 +742,7 @@ get_cdtext_aspi (_img_private_t *env)
memset( buffer, 0x00, sizeof(buffer) ); memset( buffer, 0x00, sizeof(buffer) );
idx = 0; idx = 0;
pdata = (CDText_data_t *) (&bigbuffer[4]); pdata = (CDText_data_t *) (&wdata[4]);
for( i=0; i < CDIO_CDTEXT_MAX_PACK_DATA; i++ ) { for( i=0; i < CDIO_CDTEXT_MAX_PACK_DATA; i++ ) {
if( pdata->seq != i ) if( pdata->seq != i )
break; break;
@@ -802,18 +801,18 @@ get_cdtext_aspi (_img_private_t *env)
cdio_drive_cap_t cdio_drive_cap_t
get_drive_cap_aspi (const _img_private_t *env) get_drive_cap_aspi (const _img_private_t *env)
{ {
uint8_t cmd[10] = { 0, }; uint8_t scsi_cdb[10] = { 0, };
int32_t i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN; int32_t i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN;
uint8_t buf[256] = { 0, }; uint8_t buf[256] = { 0, };
/* Set up passthrough command */ /* Set up passthrough command */
CDIO_MMC_SET_COMMAND(cmd, CDIO_MMC_GPCMD_MODE_SENSE_10); CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_MODE_SENSE_10);
cmd[1] = 0x0; scsi_cdb[1] = 0x0;
cmd[2] = CDIO_MMC_ALL_PAGES; scsi_cdb[2] = CDIO_MMC_ALL_PAGES;
cmd[7] = 0x01; scsi_cdb[7] = 0x01;
cmd[8] = 0x00; scsi_cdb[8] = 0x00;
if (!scsi_mmc_command(env, cmd, sizeof(cmd), buf, sizeof(buf))) { if (!scsi_mmc_command(env, scsi_cdb, sizeof(scsi_cdb), buf, sizeof(buf))) {
return i_drivetype; return i_drivetype;
} else { } else {
BYTE *p; BYTE *p;
@@ -845,6 +844,43 @@ get_drive_cap_aspi (const _img_private_t *env)
return i_drivetype; return i_drivetype;
} }
/*!
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.
*/
char *
get_mcn_aspi (const _img_private_t *env)
{
#if 1
char buf[192] = { 0, };
/* Sizes for commands are set by the SCSI opcode. *
The size for READ SUBCHANNEL is 10. */
unsigned char scsi_cdb[10] = {0, };
CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_READ_SUBCHANNEL);
scsi_cdb[1] = 0x0;
scsi_cdb[2] = 0x40;
scsi_cdb[3] = 02; /* Give media catalog number. */
scsi_cdb[4] = 0; /* Not used */
scsi_cdb[5] = 0; /* Not used */
scsi_cdb[6] = 0; /* Not used */
scsi_cdb[7] = 0; /* Not used */
scsi_cdb[8] = 28;
scsi_cdb[9] = 0; /* Not used */
if (!scsi_mmc_command(env, scsi_cdb, sizeof(scsi_cdb), buf, sizeof(buf)))
return NULL;
return strdup(&buf[9]);
#else
return NULL;
#endif
}
/*! /*!
Get format of track. Get format of track.
*/ */

View File

@@ -1,6 +1,6 @@
/* Win32 aspi specific */ /* Win32 aspi specific */
/* /*
$Id: aspi32.h,v 1.6 2004/07/13 04:33:08 rocky Exp $ $Id: aspi32.h,v 1.7 2004/07/16 01:25:59 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -174,6 +174,15 @@ SRB_HAInquiry;
*/ */
cdio_drive_cap_t get_drive_cap_aspi (const _img_private_t *env); cdio_drive_cap_t get_drive_cap_aspi (const _img_private_t *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.
*/
char * get_mcn_aspi (const _img_private_t *env);
/*! /*!
Get the format (XA, DATA, AUDIO) of a track. Get the format (XA, DATA, AUDIO) of a track.
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.19 2004/07/13 03:59:10 rocky Exp $ $Id: win32.c,v 1.20 2004/07/16 01:26:00 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.19 2004/07/13 03:59:10 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.20 2004/07/16 01:26:00 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -474,8 +474,8 @@ _cdio_get_mcn (const void *env) {
if( ! _env->hASPI ) { if( ! _env->hASPI ) {
return get_mcn_win32ioctl(_env); return get_mcn_win32ioctl(_env);
} } else
return NULL; return get_mcn_aspi(_env);
} }
/*! /*!