summaryrefslogtreecommitdiffstats
path: root/loader/pcmcia.c
diff options
context:
space:
mode:
Diffstat (limited to 'loader/pcmcia.c')
-rw-r--r--loader/pcmcia.c183
1 files changed, 0 insertions, 183 deletions
diff --git a/loader/pcmcia.c b/loader/pcmcia.c
deleted file mode 100644
index 4dc2b2309..000000000
--- a/loader/pcmcia.c
+++ /dev/null
@@ -1,183 +0,0 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <kudzu/kudzu.h>
-#include <newt.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include "../isys/imount.h"
-#include "../isys/isys.h"
-#include "../isys/probe.h"
-
-#include "lang.h"
-#include "loader.h"
-#include "log.h"
-#include "devices.h"
-#include "modules.h"
-#include "windows.h"
-
-int probe_main (int argc, char ** argv);
-int cardmgr_main (int argc, char ** argv);
-
-int startPcmcia(char * floppyDevice, moduleList modLoaded, moduleDeps modDeps,
- moduleInfoSet modInfo, char * pcicPtr,
- struct knownDevices * kd, int flags) {
- pid_t child;
- struct device ** devices, ** device;
- char * probeArgs[] = { "/sbin/probe", NULL };
- char * cardmgrArgs[] = { "/sbin/cardmgr", "-o", "-m", "/modules", "-d",
- NULL };
- int p[2];
- char buf[4096];
- int i, status;
- char * pcic = NULL;
- char * line = NULL;
- int rc;
- char * title = _("PC Card");
- char * text = _("Initializing PC Card Devices...");
-
- logMessage("in startPcmcia()");
-
- devices = probeDevices(CLASS_SOCKET, BUS_PCI, PROBE_ALL);
- if (devices) {
- logMessage("found cardbus pci adapter");
- pcic = "yenta_socket";
-
- for (device = devices; *device; device++)
- freeDevice(*device);
-
- free(devices);
- } else {
- pipe(p);
-
- if (!(child = fork())) {
- close(p[0]);
- dup2(p[1], 1);
- close(p[1]);
- exit(probe_main(1, probeArgs));
- }
-
- close(p[1]);
-
- waitpid(child, NULL, 0);
-
- i = read(p[0], buf, sizeof(buf));
- close(p[0]);
- buf[i] = '\0';
-
- logMessage("pcmcia probe returned: |%s|", buf);
-
- /* So this is totally counter-intuitive. Just remember that probe
- stops printing output once it finds a pcic, so this is actually
- correct */
-
- line = strtok(buf, "\r\n");
-
- do {
- if (!strstr(line, "not found"))
- {
- if (strstr(line, "TCIC"))
- pcic = "tcic";
- else
- pcic = "i82365";
- }
- } while((line = strtok(NULL, "\r\n")));
- }
-
- if (!pcic)
- {
- logMessage("no pcic controller found");
- return 0;
- }
-
- logMessage("need to load %s", pcic);
-
- winStatus(40, 3, title, text);
- if (mlLoadModuleSet("pcmcia_core", modLoaded, modDeps, modInfo, flags)) {
- logMessage("failed to load pcmcia_core -- ask for pcmciadd");
- rc = 1;
- newtPopWindow();
- } else {
- rc = 0;
- }
-
- while (rc) {
- rc = newtWinChoice(_("PCMCIA"), _("OK"), _("Cancel"),
- _("Please insert your PCMCIA driver disk "
- "into your floppy drive now."));
- if (rc == 2) return LOADER_BACK;
-
- devMakeInode(floppyDevice, "/tmp/floppy");
-
- rc = 1;
- if (doPwMount("/tmp/floppy", "/modules", "ext2", 1, 0, NULL,
- NULL)) {
- newtWinMessage(_("Error"), _("OK"), _("Failed to mount disk."));
- } else {
- int fd;
-
- fd = open("/modules/rhdd-6.1", O_RDONLY);
- if (fd >= 0) {
- char buf[30];
- int i;
-
- i = read(fd, buf, 30);
- buf[23] = '\0';
- logMessage("read %s", buf);
- if (i == 23 && !strcmp(buf, "PCMCIA Driver Diskette\n")) {
- winStatus(40, 3, title, text);
- if (mlLoadModuleSet("pcmcia_core", modLoaded, modDeps,
- modInfo, flags)) {
- newtPopWindow();
- newtWinMessage(_("Error"), _("OK"),
- _("That floppy does not look like a "
- "Red Hat PCMCIA driver disk."));
- }
-
- rc = 0;
- }
-
- close(fd);
- }
-
- if (rc)
- umount("/modules");
- }
- }
-
- sprintf(buf, "%s:ds", pcic);
-
- if (mlLoadModuleSet(buf, modLoaded, modDeps, modInfo, flags)) {
- logMessage("failed to load pcic.o or ds.o");
- umount("/modules");
- return LOADER_ERROR;
- }
-
- if (!(child = fork())) {
- exit(cardmgr_main(5, cardmgrArgs));
- }
-
- logMessage("cardmgr running as pid %d", child);
-
- waitpid(child, &status, 0);
- logMessage("cardmgr returned 0x%x", status);
-
- busProbe(modInfo, modLoaded, modDeps, 0, kd, flags);
-
- while(1) {
- extern int errno;
- sleep(2);
- rc = umount("/modules");
- if ((rc != -1) || (errno != -EBUSY)) {
- break;
- }
- logMessage("return code of /modules unmount is %d", rc);
- }
-
- newtPopWindow();
- strcpy(pcicPtr, pcic);
-
- return 0;
-}