[BUG] HDIO_DRIVE_RESET ioctl is buggy

From: David Balazic (david.balazic@uni-mb.si)
Date: Thu Aug 16 2001 - 02:46:38 EST


linux-2.4.8-ac2 , hdc is an ACER 1208A CD-RW

it is the same for several latest linux versions :

[root@localhost scsireset]# ./idereset /dev/hdc
hdc: DMA disabled
idereset : ioctl succesful
hdc: ide_set_handler: handler not null; old=c0184340, new=e0887354
bug: kernel timer added twice at c0184251.

source if idereset.c :

/*************************
 * idereset - reset an ide device
 *
 * Usage : idereset /dev/hdX
 *
 *
 * Copyright 2001 David Balazic
 */

#define IDERESET_VERSION "v0.1"

#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/hdreg.h>

void print_usage(FILE * out_file)
{
   fprintf(out_file,"idereset " IDERESET_VERSION "\nArgument error.Usage :\n");
   fprintf(out_file,"idereset /dev/hdX\n");
}

int main (int argc,char ** argv)
{
   int device_fd; /* file descriptor for the device file */
   
   if ( argc !=2 )
     {
        print_usage(stderr);
        return 1;
     }
/* open device */
   device_fd=open(argv[1], O_RDONLY | O_NONBLOCK);
   if ( device_fd == -1 )
     {
        perror(argv[1]);
        return 1;
     }
   /* ioctl */
   if(ioctl( device_fd, HDIO_DRIVE_RESET , NULL))
     perror(argv[1]);
   else
     printf("idereset : ioctl succesful\n");
   
   close(device_fd);
   
   return 0;
}

-- 
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:14 EST