Bug#370186: Testprogramm and -procedure to trigger the problem

2006-12-24 Thread Juergen Lueters
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 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

/* 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|0010);
  printf("halTest.main open /dev/hdc fd: %d counter: %d
\n",fd,counter);
  close(fd);

  usleep(100);
  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 
Intranet Engineering GmbH



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



Bug#370186: Improved test program

2006-12-25 Thread Juergen Lueters
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 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
/* 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  */
/* published under gplv2 and later  */

static void 
pollDrive(short cycles) {
	int i=0;
	int fd=0;
  	for (i=0;i0;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);
}



Bug#370186: Problem almost solved ( ? )

2006-12-26 Thread Juergen Lueters
Hi folks,
please find the next version of haltest.c attached, which serves as a
demonstration on how to spin down the drive.


The idea is as follows:

1. Open the drive
2. Check if drive is active (see hdparm -C /dev/hdc)
3. If the drive is active requeuery the drive state, until it gets
not_active and _do not_ close the filedescriptor meanwhile.

Active:the the drive is spinning.
Not_active: the drive has spun down.


4. If the drive is not active close the file descriptor.
5. Wait some time
6. Restart with 1.
 
Can ohter people confirm that this works on other systems as well,
please  ?

Hope that helps.
Regards 

Jürgen
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

/* 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  */
/* published under gplv2 and later  */
#define DRIVE_ACTIVE 1
#define DRIVE_NOT_ACTIVE 0

static int 
isDriveActive(int fd ) 
{
	/* this query has been taken from the  */
	/* hdparm.c sources */
	unsigned char args[4]={WIN_CHECKPOWERMODE1,0,0,0};
	int state=0;
	if (ioctl(fd, HDIO_DRIVE_CMD, &args) 
		&& (args[0] = WIN_CHECKPOWERMODE2) 
		&& ioctl(fd, HDIO_DRIVE_CMD, &args)) 
	{
		if (errno != EIO || args[0] != 0 || args[1] != 0) 
		{
			state = -1; /* "unknown"; */
		} 
		else	
		state = DRIVE_NOT_ACTIVE; /* "sleeping"; */
	} 	
	else 
	{
		if ( args[2] == 255) state=DRIVE_ACTIVE;
		else  state=DRIVE_NOT_ACTIVE;
		}
	printf(" drive state is:  %d\n", state);
	return(state);
}

static void 
pollDrive(short cycles) {
	int i=0;
	int rc=0;
	int fd=0;

  	for (i=0;i

Bug#370186: Is this bug really RC ?

2007-01-07 Thread Juergen Lueters
After all the testing I do ask for downgrading the bug.

Rationale:

1. I could detect the spinning problem in a non-Gui mode, only. 
It is none-Gnome to be more precise.

2. The spinning does appear with a disk inserted only.

2. I run an Thinkpad R51 since 4  years with varying debian versions.
No hardware destruction so far. 

3. If the typical usage pattern is graphical, it is no real problem.

Therfore i ask the maintainer to downgrade the bug to important.  


Regards





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



Bug#370186: hal: HAL keeps CD drive spinning constantly

2007-02-13 Thread Juergen Lueters
info.product = 'HL-DT-ST DVDRAM GSA-4080N'  (string)

Regards

Jürgen

--