SCSI Hard Disk Number

S

Shonty

Can any body know how to get the Hard Disk serial number of SCSI HDD.I
will be very thankful to you if you give the code or Control code to
get that.

Thanks
Shonty
 
S

SnaiL

Generally it depends on operating system. I know how you can do it with
Linux:

#include <stdio.h>
#include <fcntl.h>
#include <linux/hdreg.h>

int main()
{
struct hd_driveid hd;
int ide;
ide=open("/dev/hda",O_RDONLY);
(void)ioctl(ide,HDIO_GET_IDENTITY,&hd);
(void)printf("Serial number - %s\n",hd.serial_no);
return (0);
}

P.S.: this code is sample only, profesional program will contain error
checking and some more .. :)
 
S

Shonty

SnaiL said:
Generally it depends on operating system. I know how you can do it with
Linux:

#include <stdio.h>
#include <fcntl.h>
#include <linux/hdreg.h>

int main()
{
struct hd_driveid hd;
int ide;
ide=open("/dev/hda",O_RDONLY);
(void)ioctl(ide,HDIO_GET_IDENTITY,&hd);
(void)printf("Serial number - %s\n",hd.serial_no);
return (0);
}

P.S.: this code is sample only, profesional program will contain error
checking and some more .. :)


hi Snail,
thanks for your responce , i will try it and then can give my remark on
that.
Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top