日期:2014-05-16 浏览次数:20955 次
#include <stdio.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h>
#include <sys/fcntl.h>
int main()
{
struct hd_driveid id;
int fd = open("/dev/hda", O_RDONLY|O_NONBLOCK);
if (fd < 0) {
perror("/dev/hda");
return 1; }
if(!ioctl(fd, HDIO_GET_IDENTITY, &id))
{
printf("Serial Number=%s\n",id.serial_no);
}
return 0;
}
------解决方案--------------------
cat /proc/scsi/usb-storage
Host scsi1: usb-storage
Vendor: Kingston
Product: DataTraveler 2.0
Serial Number: 001478081A5A5C8719160437
Protocol: Transparent SCSI
Transport: Bulk
Quirks:
------解决方案--------------------
mark
------解决方案--------------------
cat /proc/scsi/usb-storage/(usb口在主板上定义ID)