Hi,
attached the next version of halTest.

halTest does support a more complex test pattern .

>From my point of view the spin problem is not caused by hal as halTest
can trigger the problem without hal and any desktop at all.

Under gnome the cdrom gets automounted, the drive spins down.
I have not tested extesivly under kde since i am not sure if my kde env.
is correctly set up - kde has not automounted the drive.


Regards Jürgen 

#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 <string.h>
#include <time.h>
/* test program for cdrom spinning problem */
/* tested hardware  ibm thinkpad r51        */
/* (dmesg)    hdc:  HL-DS-ST DVDRAM GSA-4080N  */
/* without any intervention,after opening and closing the  */
/* tray, the drive spins up and stops later */
/* author  Juergen Lueters <jlueters intranet-engineering.de > */
/* published under gplv2 and later      */

static void 
pollDrive(short cycles) {
	int i=0;
	int fd=0;
  	for (i=0;i<cycles;i++) {
      	fd=open("/dev/hdc", O_RDONLY|O_NONBLOCK|O_EXCL|00100000);
      	printf("halTest.main open /dev/hdc fd: %d iteration: %d\n",fd,i);
      	close(fd);
      	usleep(1000000);
	}
}

int
main(int argc, char *argv[])
{
  	int i=0;
  	printf("the first iteration shall show that the cdrom remains silent even if it been polled \n");
 	pollDrive(15); 
  
  	printf("please open and close the cdrom tray \n");
  	sleep(8);
  	printf("polling the drive (let the wheel spin)\n");
	pollDrive(50);
  	printf("waiting 20 secs in order to spin down \n");

  	for (i=20; i>0;i--)  {
 	 	printf("halTest.main remainig time to exit %d \n",i);
   		sleep(1);
	}
  	printf("repolling the drive - it shall remain silent \n");
	sleep(1);
	pollDrive(20);
  	printf("Thats it - spin test over \n");

	exit(0);
}

Reply via email to