summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2000-08-14 19:54:24 +0000
committerErik Troan <ewt@redhat.com>2000-08-14 19:54:24 +0000
commit9fd1b20e8e03604c60bf05f47924afb0dda2b4e1 (patch)
tree8c561579dcddb211d22942f50d742c110b3d5936 /isys
parent3b094f177440b777b9bea0a54e4827892c429183 (diff)
downloadanaconda-9fd1b20e8e03604c60bf05f47924afb0dda2b4e1.tar.gz
anaconda-9fd1b20e8e03604c60bf05f47924afb0dda2b4e1.tar.xz
anaconda-9fd1b20e8e03604c60bf05f47924afb0dda2b4e1.zip
probe for ide devices which don't show up in /proc/ide
Diffstat (limited to 'isys')
-rw-r--r--isys/probe.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/isys/probe.c b/isys/probe.c
index c702c2907..61a9219f3 100644
--- a/isys/probe.c
+++ b/isys/probe.c
@@ -2,11 +2,15 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <linux/cdrom.h>
+#include <linux/hdreg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
#include <unistd.h>
+#include "isys.h"
#include "probe.h"
static int dac960GetDevices(struct knownDevices * devices);
@@ -150,6 +154,10 @@ int kdFindIdeList(struct knownDevices * devices, int code) {
int fd, i;
struct dirent * ent;
struct kddevice device;
+ struct hd_driveid hdId;
+ char devChar;
+ char name[10];
+ struct cdrom_volctrl vol;
if (access("/proc/ide", R_OK)) return 0;
@@ -198,6 +206,33 @@ int kdFindIdeList(struct knownDevices * devices, int code) {
closedir(dir);
+ for (devChar = 'a'; devChar <= 'h'; devChar++) {
+ sprintf(name, "hd%c", devChar);
+ if (deviceKnown(devices, name)) continue;
+
+ devMakeInode(name, "/tmp/ideprobe");
+ fd = open("/tmp/ideprobe", O_RDONLY | O_NONBLOCK);
+
+ if (fd < 0) continue;
+
+ device.name = strdup(name);
+
+ ioctl(fd, HDIO_GET_IDENTITY, &hdId);
+ close(fd);
+
+ if (!ioctl(fd, CDROMVOLCTRL, &vol))
+ device.class = CLASS_CDROM;
+ else if (hdId.command_set_1 & 4)
+ device.class = CLASS_FLOPPY;
+ else
+ device.class = CLASS_HD;
+
+ if (*hdId.model)
+ device.model = strdup(hdId.model);
+
+ addDevice(devices, device);
+ }
+
qsort(devices->known, devices->numKnown, sizeof(*devices->known),
sortDevices);