Line
Link Here
|
0 |
-- eject.c |
0 |
++ eject.c |
Lines 471-478
Link Here
|
471 |
{ |
471 |
{ |
472 |
struct timeval time_start, time_stop; |
472 |
struct timeval time_start, time_stop; |
473 |
int time_elapsed; |
473 |
int time_elapsed; |
|
|
474 |
int status; |
474 |
|
475 |
|
475 |
#ifdef CDROMCLOSETRAY |
476 |
#ifdef CDROMCLOSETRAY |
|
|
477 |
|
478 |
status = ioctl(fd, CDROM_DRIVE_STATUS); |
479 |
|
480 |
if (status == CDS_TRAY_OPEN){ |
481 |
CloseTray(fd); |
482 |
return; |
483 |
} |
484 |
else if (status == CDS_NO_DISC || status == CDS_DISC_OK){ |
485 |
if (ioctl(fd, CDROMEJECT, 0) < 0) { |
486 |
perror("ioctl"); |
487 |
exit(1); |
488 |
} |
489 |
return; |
490 |
} |
476 |
|
491 |
|
477 |
/* Try to open the CDROM tray and measure the time therefor |
492 |
/* Try to open the CDROM tray and measure the time therefor |
478 |
* needed. In my experience the function needs less than 0.05 |
493 |
* needed. In my experience the function needs less than 0.05 |