62 lines
2.2 KiB
C
62 lines
2.2 KiB
C
/* Common MMC routines.
|
|
|
|
$Id: scsi_mmc.c,v 1.5 2004/07/18 03:35:07 rocky Exp $
|
|
|
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#include <cdio/cdio.h>
|
|
#include <cdio/scsi_mmc.h>
|
|
|
|
/*!
|
|
On input A MODE_SENSE command was issued and we have the results
|
|
in p. We interpret this and return a bit mask set according to the
|
|
capabilities.
|
|
*/
|
|
void
|
|
cdio_get_drive_cap_mmc(const uint8_t *p,
|
|
cdio_drive_read_cap_t *p_read_cap,
|
|
cdio_drive_write_cap_t *p_write_cap,
|
|
cdio_drive_misc_cap_t *p_misc_cap)
|
|
{
|
|
/* Reader */
|
|
if (p[2] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_R;
|
|
if (p[2] & 0x02) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_RW;
|
|
if (p[2] & 0x08) *p_read_cap |= CDIO_DRIVE_CAP_READ_DVD_ROM;
|
|
if (p[4] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_AUDIO;
|
|
if (p[5] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_DA;
|
|
if (p[5] & 0x10) *p_read_cap |= CDIO_DRIVE_CAP_READ_C2_ERRS;
|
|
|
|
/* Writer */
|
|
if (p[3] & 0x01) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_CD_R;
|
|
if (p[3] & 0x02) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_CD_RW;
|
|
if (p[3] & 0x10) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_R;
|
|
if (p[3] & 0x20) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_RAM;
|
|
|
|
/* Misc */
|
|
if (p[4] & 0x40) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_MULTI_SESSION;
|
|
|
|
if (p[6] & 0x01) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_LOCK;
|
|
if (p[6] & 0x08) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_EJECT;
|
|
if (p[6] >> 5 != 0)
|
|
*p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY;
|
|
}
|