New API call burn_drive_snooze()

This commit is contained in:
Thomas Schmitt 2009-08-24 13:10:53 +00:00
parent 111322daaf
commit 8b5eeb6b33
5 changed files with 53 additions and 8 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2009.08.23.130326"
#define Cdrskin_timestamP "2009.08.24.131146"

View File

@ -533,6 +533,20 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
}
/* API */
/* ts A90824
@param flag bit0= wake up (else start snoozing)
*/
int burn_drive_snooze(struct burn_drive *d, int flag)
{
if (flag & 1)
d->start_unit(d);
else
d->stop_unit(d);
return 1;
}
/* API */
void burn_drive_release(struct burn_drive *d, int le)
{

View File

@ -1029,6 +1029,22 @@ int burn_drive_obtain_scsi_adr(char *path, int *bus_no, int *host_no,
int burn_drive_grab(struct burn_drive *drive, int load);
/* ts A90824 */
/** Calm down or alert a drive. Some drives stay alert after reading for
quite some time. This saves time with the startup for the next read
operation but also causes noise and consumes extra energy. It makes
sense to calm down the drive if no read operation is expected for the
next few seconds. The drive will get alert automatically if operations
are required.
@param drive The drive to influence.
@param flag Bitfield for control purposes
bit0= become alert (else start snoozing)
This is not mandatory to allow further drive operations
@since 0.7.0
*/
int burn_drive_snooze(struct burn_drive *d, int flag);
/** Release a drive. This should not be done until the drive is no longer
busy (see burn_drive_get_status).
Linux: The drive device file is not reserved afterwards. (O_EXCL, F_SETLK).

View File

@ -21,6 +21,7 @@ int mmc_function_spy(struct burn_drive *d, char * text);
static unsigned char SBC_LOAD[] = { 0x1b, 0, 0, 0, 3, 0 };
static unsigned char SBC_UNLOAD[] = { 0x1b, 0, 0, 0, 2, 0 };
static unsigned char SBC_START_UNIT[] = { 0x1b, 0, 0, 0, 1, 0 };
static unsigned char SBC_STOP_UNIT[] = { 0x1b, 0, 0, 0, 0, 0 };
void sbc_load(struct burn_drive *d)
{
@ -84,15 +85,8 @@ int sbc_start_unit(struct burn_drive *d)
return 0;
scsi_init_command(&c, SBC_START_UNIT, sizeof(SBC_START_UNIT));
/*
memcpy(c.opcode, SBC_START_UNIT, sizeof(SBC_START_UNIT));
c.oplen = sizeof(SBC_START_UNIT);
c.page = NULL;
*/
c.retry = 1;
c.opcode[1] |= 1; /* ts A70918 : Immed */
c.dir = NO_TRANSFER;
d->issue_command(d, &c);
if (c.error)
@ -101,6 +95,25 @@ int sbc_start_unit(struct burn_drive *d)
return spc_wait_unit_attention(d, 1800, "START UNIT", 0);
}
/* ts A90824 : Trying to reduce drive noise */
int sbc_stop_unit(struct burn_drive *d)
{
struct command c;
if (mmc_function_spy(d, "stop_unit") <= 0)
return 0;
scsi_init_command(&c, SBC_STOP_UNIT, sizeof(SBC_STOP_UNIT));
c.retry = 1;
c.opcode[1] |= 1; /* Immed */
c.dir = NO_TRANSFER;
d->issue_command(d, &c);
if (c.error)
return 0;
return spc_wait_unit_attention(d, 1800, "STOP UNIT", 0);
}
/* ts A61021 : the sbc specific part of sg.c:enumerate_common()
*/
@ -109,6 +122,7 @@ int sbc_setup_drive(struct burn_drive *d)
d->eject = sbc_eject;
d->load = sbc_load;
d->start_unit = sbc_start_unit;
d->stop_unit = sbc_stop_unit;
return 1;
}

View File

@ -317,6 +317,7 @@ struct burn_drive
void (*eject) (struct burn_drive *);
void (*load) (struct burn_drive *);
int (*start_unit) (struct burn_drive *);
int (*stop_unit) (struct burn_drive *);
void (*read_disc_info) (struct burn_drive *);
void (*read_sectors) (struct burn_drive *,
int start,