|
|
@@ -1,6 +1,13 @@
|
|
|
#include "comm.h"
|
|
|
#include <cstdarg>
|
|
|
#define MAX_PATH_SIZE 256
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+#else
|
|
|
+#include <sys/ioctl.h>
|
|
|
+#include <sys/stat.h>
|
|
|
+#include <linux/hdreg.h>
|
|
|
+#include <sys/fcntl.h>
|
|
|
+#endif //RVC_OS_WIN
|
|
|
void GetNewForm(const char* form, char* newForm) {
|
|
|
int indexNum = 0;
|
|
|
int acount = 0;
|
|
|
@@ -448,15 +455,23 @@ char* Str2Hex(const char* src, int srcLen)
|
|
|
strcpy(lshw_result, save_path.c_str());
|
|
|
strcat(lshw_result, "/.lshw_result.txt");
|
|
|
|
|
|
- char command[512] = { 0 };
|
|
|
- snprintf(command, sizeof(command), "lshw -class disk | grep serial > %s", lshw_result);
|
|
|
-
|
|
|
- if (0 == system(command))
|
|
|
- {
|
|
|
- get_disk_serial(lshw_result, "serial:", serial_no);
|
|
|
- }
|
|
|
- else {
|
|
|
+ //char command[512] = { 0 };
|
|
|
+ //snprintf(command, sizeof(command), "lshw -class disk | grep serial > %s", lshw_result);
|
|
|
+
|
|
|
+ //if (0 == system(command))
|
|
|
+ //{
|
|
|
+ // get_disk_serial(lshw_result, "serial:", serial_no);
|
|
|
+ //}
|
|
|
+ //else {
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+ struct hd_driveid id;
|
|
|
+ int fd = open("/dev/hda", O_RDONLY|O_NONBLOCK);
|
|
|
+ if (fd < 0)
|
|
|
return false;
|
|
|
+ if (!ioctl(fd, HDIO_GET_IDENTITY, &id))
|
|
|
+ {
|
|
|
+ serial_no.push_back((const char*)(id.serial_no));
|
|
|
}
|
|
|
unlink(lshw_result);
|
|
|
|