Hi folks,

i have hacked a small testprogramm which keeps the cdrom spinning under
certain circumstances.

preparations:

1. /etc/init.d/gdm stop
2. pkill hald
3. /etc/init.d/fam stop

Tests

case 1:
Action
1.1 Insert a data CDROM
1.2 start halTest
1.3 wait until program terminates

Expected Results
nothing happens, drive remains silent

case 2:
Action
2.1 start halTest
2.2 while halTest is running:
        open and close the cdrom tray (with data cdrom)
2.3 wait until porgram terminates

Expected Results:
after opening and closing the tray, the drive starts spinning and
continues to do so.
The drive stops spinning aprox. 14 secs after issuing the last close.



##### begin testprogramm


 #include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <signal.h>
#include <syslog.h>
#include <getopt.h>
#include <string.h>
#include <time.h>

/* Testprogramm to trigger the spinning cdrom problem */
/* The drive does stop approx. 14 secs after issuing the last close() */
/* It seems that opening and closing the device in a nanosleep  */
/* loop is not a good idea.     */
int
main(int argc, char *argv[])
{
         int fd=0;
         int rc=0;
         int i=0;
  static int counter=0;
  for (;;)
    {
      fd=open("/dev/hdc", O_RDONLY|O_NONBLOCK|O_EXCL|00100000);
      printf("halTest.main open /dev/hdc fd: %d counter: %d
\n",fd,counter);
      close(fd);

      usleep(1000000);
      counter++;
      if ((counter % 40 ) == 0) break;
    }

    for (i=20; i>0;i--) {
     printf("halTest.main remainig time to exit %d \n",i);
     sleep(1);
    }
}


######## end testprogramm  #####



Merry xmas and a happy new year .
 

-- 
Juergen Lueters <jlueters intranet-engineering.de>
Intranet Engineering GmbH



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to