/***************************************************************************
*
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*
**************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
#include <logger.h>
#include "cdutils.h"
void
{
}
int
{
int ret;
scmd->uscsi_status = 0;
ret = -1;
}
/*
* The drive is not ready to recieve commands but
* may be in the process of becoming ready.
* sleep for a short time then retry command.
* ASCQ = 0 Not Reportable.
* ASCQ = 1 Becoming ready.
* ASCQ = 4 FORMAT in progress.
* ASCQ = 7 Operation in progress.
*/
sleep(1);
continue;
}
/*
* Device is not ready to transmit or a device reset
* has occurred. wait for a short period of time then
* retry the command.
*/
sleep(1);
continue;
}
/*
* Blank Sense, we don't know what the error is or if
* the command succeeded, Hope for the best. Some
* drives return blank sense periodically and will
* fail if this is removed.
*/
ret = 0;
break;
}
HAL_DEBUG (("cmd: 0x%02x ret:%i status:%02x "
" sense: %02x ASC: %02x ASCQ:%02x\n",
}
break;
}
if (retries) {
}
return (ret);
}
int
{
if (dbd) {
}
}
/*
* will get the mode page only i.e. will strip off the header.
*/
int
{
int ret;
/* Ask 254 bytes only to make our IDE driver happy */
return (0);
}
if (plen) {
}
return (1);
}
/* Get information about the Logical Unit's capabilities */
int
{
}
{
size_t i;
/*
* first determine amount of memory needed to hold all profiles.
* The first four bytes of smallbuf concatenated tell us the
* number of bytes of memory we need but do not take themselves
* into account. Therefore, add four to allocate that number
* of bytes.
*/
/* now get all profiles */
}
}
return (ret);
}
void
{
size_t i;
int ret;
/*
* first determine amount of memory needed to hold all profiles.
* The first four bytes of smallbuf concatenated tell us the
* number of bytes of memory we need but do not take themselves
* into account. Therefore, add four to allocate that number
* of bytes.
*/
/* now get all profiles */
if (ret == CDUTIL_WALK_STOP) {
break;
}
}
}
}
}
/* retrieve speed list from the Write Speed Performance Descriptor Blocks
*/
void
{
int i;
*n_speeds = 0;
if (*speeds_mem == NULL) {
return;
}
for (i = 0; i < n; i++, p += 4) {
current = &(*speeds_mem)[i];
/* keep the list sorted */
break;
break;
}
}
if (!skip) {
*n_speeds++;
}
}
}
void
{
int page_len;
uchar_t p[254];
int n; /* number of write speed performance descriptor blocks */
*read_speed = *write_speed = 0;
return;
}
if (page_len > 8) {
}
if (page_len > 18) {
}
if (page_len < 28) {
printf("MMC-2\n");
return;
} else {
printf("MMC-3\n");
}
if (page_len < 30) {
return;
}
/* retrieve speed list */
n = GET16(&p[30]);
}
}
{
return (B_FALSE);
}
/*
* According to MMC-5 6.22.3.2, the Disc Information Length should be
* 32+8*(Number of OPC Tables). Some devices, like U3 sticks, return 0.
* Yet some drives can return less than 32. We only need the first 22.
*/
return (B_FALSE);
}
} else {
}
return (B_TRUE);
}
/*
*/
{
return (B_FALSE);
}
return (B_TRUE);
}
{
}
/*
* given current profile, use the best method for determining
* disc capacity (in bytes)
*/
{
switch (profile) {
case 0x08: /* CD-ROM */
case 0x10: /* DVD-ROM */
}
break;
default:
}
}
}
return (ret);
}
{
return (B_FALSE);
}
return (B_TRUE);
}