Introduced API functions burn_drive_scan_and_grab() burn_drive_get_adr()

This commit is contained in:
2006-08-24 13:30:21 +00:00
parent 377756a52a
commit d6df47920e
2 changed files with 86 additions and 2 deletions

View File

@ -415,9 +415,48 @@ int burn_drive_is_banned(char *device_address)
int burn_drive_is_open(struct burn_drive *d)
{
/* a bit more detailed case distinction than needed */
if(d->fd == -1337)
if (d->fd == -1337)
return 0;
if(d->fd < 0)
if (d->fd < 0)
return 0;
return 1;
}
/* ts A60823 */
/** Aquire a drive with known persistent address.
*/
int burn_drive_scan_and_grab(struct burn_drive_info *drives[], char* adr,
int load)
{
unsigned int n_drives;
int ret;
burn_drive_clear_whitelist();
burn_drive_add_whitelist(adr);
while (!burn_drive_scan(drives, &n_drives));
if (n_drives <= 0)
return 0;
if (load) {
/* RIP-14.5 + LITE-ON 48125S produce a false status
if tray was unloaded */
/* Therefore the first grab is just for loading */
ret= burn_drive_grab(drives[0]->drive, 1);
if (ret != 1)
return -1;
burn_drive_release(drives[0]->drive,0);
}
ret = burn_drive_grab(drives[0]->drive, load);
if (ret != 1)
return -1;
return 1;
}
/* ts A60823 */
/** Inquire the persistent address of the given drive. */
int burn_drive_get_adr(struct burn_drive_info *drive, char adr[])
{
assert(strlen(drive->location) < BURN_DRIVE_ADR_LEN);
strcpy(adr,drive->location);
return 1;
}