summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-08-10 21:13:10 +0000
committerErik Troan <ewt@redhat.com>1999-08-10 21:13:10 +0000
commitef55326a4af2f1e35591c21d7967c4cd780a531c (patch)
tree19cbf7f0582a4664110c5b459d3f4c812d06ec29 /loader
parentcceea1192f9f0039d179988ad0d81562e0076990 (diff)
downloadanaconda-ef55326a4af2f1e35591c21d7967c4cd780a531c.tar.gz
anaconda-ef55326a4af2f1e35591c21d7967c4cd780a531c.tar.xz
anaconda-ef55326a4af2f1e35591c21d7967c4cd780a531c.zip
added ability to manually add device drivers
Diffstat (limited to 'loader')
-rw-r--r--loader/devices.c8
-rw-r--r--loader/loader.c82
-rw-r--r--loader/modules.c8
3 files changed, 78 insertions, 20 deletions
diff --git a/loader/devices.c b/loader/devices.c
index f1c492836..e99160595 100644
--- a/loader/devices.c
+++ b/loader/devices.c
@@ -174,9 +174,11 @@ int devDeviceMenu(enum driverMajor type, moduleInfoSet modInfo,
rc = mlLoadModule(mod->moduleName, modLoaded, modDeps, args,
FL_TESTING(flags));
- for (arg = args; *arg; arg++)
- free(*arg);
- free(args);
+ if (args) {
+ for (arg = args; *arg; arg++)
+ free(*arg);
+ free(args);
+ }
if (!rc && moduleName)
*moduleName = mod->moduleName;
diff --git a/loader/loader.c b/loader/loader.c
index 9f7338870..b2f40f7ad 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -182,29 +182,83 @@ static int detectHardware(moduleInfoSet modInfo,
return LOADER_OK;
}
+int addDeviceManually(moduleInfoSet modInfo, moduleList modLoaded,
+ moduleDeps modDeps, struct knownDevices * kd, int flags) {
+ char * pristineItems[] = { N_("SCSI"), N_("Network"), NULL };
+ char * items[3];
+ int i, rc;
+ int choice = 0;
+ enum deviceClass type;
+
+ for (i = 0; i < 3; i++) {
+ items[i] = _(pristineItems[i]);
+ }
+
+ do {
+ rc = newtWinMenu(_("Devices"),
+ _("What kind of device would you like to add"), 40,
+ 0, 20, 2, items, &choice, _("Ok"), _("Back"), NULL);
+ if (rc == 2) return LOADER_BACK;
+
+ if (choice == 1)
+ type = DRIVER_NET;
+ else
+ type = DRIVER_SCSI;
+
+ rc = devDeviceMenu(type, modInfo, modLoaded, modDeps, flags, NULL);
+ } while (rc);
+
+ return 0;
+}
+
int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps modDeps, struct knownDevices * kd, int flags) {
- int rc, i;
- char buf[2000] = "";
+ int i;
+ char buf[2000];
struct moduleInfo * mi;
+ newtComponent done, add, text, items, form, answer;
+ newtGrid grid, buttons;
+
+ do {
+ text = newtTextboxReflowed(-1, -1,
+ _("I have found the following devices in your system:"),
+ 40, 5, 20, 0);
+ buttons = newtButtonBar(_("Done"), &done, _("Add Device"), &add, NULL);
+ items = newtTextbox(-1, -1, 30, 5, NEWT_FLAG_SCROLL);
- for (i = 0; i < modLoaded->numModules; i++) {
- if (!modLoaded->mods[i].weLoaded) continue;
+ for (i = 0, *buf = '\0'; i < modLoaded->numModules; i++) {
+ if (!modLoaded->mods[i].weLoaded) continue;
- strcat(buf, "\t");
+ strcat(buf, "\t");
- if ((mi = isysFindModuleInfo(modInfo, modLoaded->mods[i].name))) {
- strcat(buf, mi->description);
- } else {
- strcat(buf, modLoaded->mods[i].name);
+ if ((mi = isysFindModuleInfo(modInfo, modLoaded->mods[i].name))) {
+ strcat(buf, mi->description);
+ } else {
+ strcat(buf, modLoaded->mods[i].name);
+ }
+
+ strcat(buf, "\n");
}
- strcat(buf, "\n");
- }
+ newtTextboxSetText(items, buf);
- newtWinMessage(_("Devices"), _("Ok"),
- ("I know about the following devices on your system:\n\n %s"),
- buf);
+ grid = newtGridSimpleWindow(text, items, buttons);
+ newtGridWrappedWindow(grid, _("Devices"));
+
+ form = newtForm(NULL, NULL, 0);
+ newtGridAddComponentsToForm(grid, form, 1);
+
+ answer = newtRunForm(form);
+ newtPopWindow();
+
+ newtGridFree(grid, 1);
+ newtFormDestroy(form);
+
+ addDeviceManually(modInfo, modLoaded, modDeps, kd, flags);
+ } while (answer == add);
+
+
+ return 0;
}
int pciProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
diff --git a/loader/modules.c b/loader/modules.c
index 3ffba7fba..da4d26965 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -185,11 +185,13 @@ int mlLoadModule(char * modName, moduleList modLoaded,
}
}
- if (testing) return 0;
-
sprintf(fileName, "%s.o", modName);
- rc = insmod(fileName, args);
+ if (testing)
+ rc = 0;
+ else
+ rc = insmod(fileName, args);
+
if (!rc) {
modLoaded->mods[modLoaded->numModules].name = strdup(modName);
modLoaded->mods[modLoaded->numModules].weLoaded = 1;