Change mmc_have_interface() to mmc_get_interface() as only one interface can ever be returned.
Change example to the correct behaviour, that the application should do the checking not the library. Added new interfaces defined from MMC >=3 (IEEE1394B, SATA, USB) and the Vendor Unique one (can be important) that was missing.
This commit is contained in:
@@ -188,7 +188,7 @@ main(int argc, const char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mmc_have_interface(p_cdio, CDIO_MMC_FEATURE_INTERFACE_ATAPI))
|
if (mmc_get_interface(p_cdio) == CDIO_MMC_FEATURE_INTERFACE_ATAPI)
|
||||||
printf("CD-ROM is an ATAPI interface.\n");
|
printf("CD-ROM is an ATAPI interface.\n");
|
||||||
else
|
else
|
||||||
printf("CD-ROM is not an ATAPI interface.\n");
|
printf("CD-ROM is not an ATAPI interface.\n");
|
||||||
|
|||||||
@@ -153,14 +153,19 @@ void mmcAudioGetVolume (mmc_audio_volume_t *p_volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report if CD-ROM has a praticular kind of interface (ATAPI, SCSCI, ...)
|
Return interface of device.
|
||||||
Is it possible for an interface to have serveral? If not this
|
As per MMC6, Table 94, Note 7, in the case of a two-interface
|
||||||
routine could probably return the single mmc_feature_interface_t.
|
scheme (USB-ATAPI bridge) the drive may not be aware, so only
|
||||||
@return true if we have the interface and false if not.
|
ATAPI is returned.
|
||||||
|
Also it seems there is no way for the drive to return more than
|
||||||
|
one interface at all.
|
||||||
|
On MMC1 devices, where it is not specified, we will return
|
||||||
|
interface as CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED.
|
||||||
|
@return interface of the device.
|
||||||
*/
|
*/
|
||||||
bool_3way_t mmcHaveInterface( cdio_mmc_feature_interface_t e_interface )
|
cdio_mmc_feature_interface_t mmcGetInterface()
|
||||||
{
|
{
|
||||||
return mmc_have_interface( p_cdio, e_interface );
|
return mmc_get_interface( p_cdio );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -409,7 +409,11 @@ typedef enum {
|
|||||||
CDIO_MMC_FEATURE_INTERFACE_ATAPI = 2,
|
CDIO_MMC_FEATURE_INTERFACE_ATAPI = 2,
|
||||||
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 = 3,
|
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 = 3,
|
||||||
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A = 4,
|
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A = 4,
|
||||||
CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH = 5
|
CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH = 5,
|
||||||
|
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394B = 6,
|
||||||
|
CDIO_MMC_FEATURE_INTERFACE_SATA = 7,
|
||||||
|
CDIO_MMC_FEATURE_INTERFACE_USB = 8,
|
||||||
|
CDIO_MMC_FEATURE_INTERFACE_VENDOR_UNIQ = 0xFFFF
|
||||||
} cdio_mmc_feature_interface_t;
|
} cdio_mmc_feature_interface_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -660,15 +664,18 @@ driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio, /*out*/
|
|||||||
char * mmc_get_mcn(const CdIo_t *p_cdio);
|
char * mmc_get_mcn(const CdIo_t *p_cdio);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report if CD-ROM has a particular kind of interface (ATAPI, SCSCI, ...)
|
Return interface of device.
|
||||||
Is it possible for an interface to have several? If not this
|
As per MMC6, Table 94, Note 7, in the case of a two-interface
|
||||||
routine could probably return the single mmc_feature_interface_t.
|
scheme (USB-ATAPI bridge) the drive may not be aware, so only
|
||||||
|
ATAPI is returned.
|
||||||
|
Also it seems there is no way for the drive to return more than
|
||||||
|
one interface at all.
|
||||||
|
On MMC1 devices, where it is not specified, we will return
|
||||||
|
interface as CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED.
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@param e_interface
|
@return interface of the device.
|
||||||
@return true if we have the interface and false if not.
|
|
||||||
*/
|
*/
|
||||||
bool_3way_t mmc_have_interface(CdIo_t *p_cdio,
|
cdio_mmc_feature_interface_t mmc_get_interface(CdIo_t *p_cdio);
|
||||||
cdio_mmc_feature_interface_t e_interface );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -833,11 +833,14 @@ cdio_get_media_changed(CdIo_t *p_cdio)
|
|||||||
bool_3way_t
|
bool_3way_t
|
||||||
cdio_have_atapi(CdIo_t *p_cdio)
|
cdio_have_atapi(CdIo_t *p_cdio)
|
||||||
{
|
{
|
||||||
bool_3way_t i_status;
|
cdio_mmc_feature_interface_t i_interface;
|
||||||
|
|
||||||
if (!p_cdio) return nope;
|
if (!p_cdio) return nope;
|
||||||
i_status = mmc_have_interface(p_cdio, CDIO_MMC_FEATURE_INTERFACE_ATAPI);
|
i_interface = mmc_get_interface(p_cdio);
|
||||||
if (dunno != i_status) return i_status;
|
if (i_interface == CDIO_MMC_FEATURE_INTERFACE_ATAPI)
|
||||||
|
return yep;
|
||||||
|
if (i_interface != CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED)
|
||||||
|
return nope;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* cdparanoia seems to think that if we have a mode sense command
|
/* cdparanoia seems to think that if we have a mode sense command
|
||||||
|
|||||||
@@ -971,17 +971,18 @@ mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
See if CD-ROM has feature with value value
|
Returns device's interface
|
||||||
@return true if we have the feature and false if not.
|
@return interface of the device.
|
||||||
*/
|
*/
|
||||||
bool_3way_t
|
cdio_mmc_feature_interface_t
|
||||||
mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
|
mmc_get_interface( CdIo_t *p_cdio )
|
||||||
{
|
{
|
||||||
int i_status; /* Result of MMC command */
|
int i_status; /* Result of MMC command */
|
||||||
uint8_t buf[500] = { 0, }; /* Place to hold returned data */
|
uint8_t buf[500] = { 0, }; /* Place to hold returned data */
|
||||||
mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */
|
mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */
|
||||||
|
|
||||||
if (!p_cdio || !p_cdio->op.run_mmc_cmd) return nope;
|
if (!p_cdio || !p_cdio->op.run_mmc_cmd)
|
||||||
|
return CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED;
|
||||||
|
|
||||||
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION);
|
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION);
|
||||||
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
|
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
|
||||||
@@ -1007,13 +1008,13 @@ mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
|
|||||||
if (CDIO_MMC_FEATURE_CORE == i_feature) {
|
if (CDIO_MMC_FEATURE_CORE == i_feature) {
|
||||||
uint8_t *q = p+4;
|
uint8_t *q = p+4;
|
||||||
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
|
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
|
||||||
if (e_interface == i_interface_standard) return yep;
|
return i_interface_standard;
|
||||||
}
|
}
|
||||||
p += i_feature_additional + 4;
|
p += i_feature_additional + 4;
|
||||||
}
|
}
|
||||||
return nope;
|
return CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED;
|
||||||
} else
|
} else // If we can't get the interface, it is unspecified
|
||||||
return dunno;
|
return CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user