=== BooyoLiveCD/BerryHwsetup === ÇöÀç °¡Àå ÁÁÀº ¹æ¹ýÀº rc.sysinit ¿Í kmodule À» º¯°æÇÏ´Â ¹æ¹ýÀÌ ÃÖ¼±ÀÎ µíÇÔ. kmodule Àº kudzu ¸¦ º¯°æÇÏ´Â °ÍÀÌ ÁÁÀ» µíÇÔ.(hwconf) ÀÌ°ÍÀÌ ¾Æ´Ï¶ó, ¼­ºñ½ºÁß kudzu ¸¦ ´ëüÇÏ´Â °ÍÀÌ º¸´Ù ÁÁÀ» µíÇÔ. int main(int argc, char **argv) { int i, verbose=0, probeonly=0, skip=0; enum deviceClass dc=CLASS_UNSPEC; /* Check Option */ for (i=1; i0) { kill(wpid,SIGTERM); wpid=0; usleep(160000); write(2,"\033[0m Done.\n",11); } È­¸é¿¡ µð½ºÇ÷¹ÀÌ ¸ØÃã. /* load and config */ for (i=0; (d=currentDevs[i]); i++) { if (verbose&VERBOSE_PRINT) hw_info(d); È­¸é¿¡ µð½ºÇ÷¹ÀÌ. ÀÌ ºÎºÐÀ» hwconf ¿¡ ¾²´Â °ÍÀ¸·Î °íÄ¡´Â °ÍÀÌ ¾î¶³±î? if (!probeonly) { #if defined(_i_wanna_build_this_crap_) if (d->bus==BUS_ISAPNP && configure_isapnp(d, verbose)) continue; ¾ÆÁ÷ ¼³Á¤Àº ¸øÇÏ°í, È­¸é¿¡ Ãâ·Â¸¸ ÇÔ. #endif switch (d->type) { case CLASS_MOUSE: /* Choose serial over PS2/USB mouse IF present */ /* For some reason, PS/2 ALWAYS detects a mouse */ if (d->bus==BUS_SERIAL) { mouse=0; serialmouse=d; } else if (d->bus==BUS_USB) { /* Need usbdevfs for */ mouse=0; usbmouse=d; /* this to work */ load_mod(d->driver, verbose); } else if (d->bus==BUS_PSAUX) { load_mod("psmouse", verbose); } ÀÌ ºÎºÐÀº ¹®Á¦°¡ ÀÖ½¿. FC3 ¸¦ ÂüÁ¶ÇØ¾ß ÇÔ. ¹®Á¦´Â FC3 ÀÇ °æ¿ì, ¾îµð¿¡¼­ ¸ðµâÀ» ·ÎµåÇÏ´ÂÁö ¸ð¸£°Ú½¿. if (!mouse) writeconfig("/etc/sysconfig/mouse", d, verbose); link_dev(d, "mouse", mouse++, verbose); break; ¸¶¿ì½º ¸ðµâÀ» ¿Ã¸®°í, etc/sysconfig/mouse ¿¡ ³»¿ëÀû°í, µð¹ÙÀ̽º¿Í ¸µÅ© ¸¸µë. udev ¸¦ »ç¿ëÇϹǷΠÁ¡°ËÇØ¾ß ÇÔ. ¸¶¿ì½º°¡ ¾È ÀâÈ÷´Â °æ¿ì, ¿Ö ±×·±Áö Á¡°Ë ÇÊ¿ä. serial ÀÎ °æ¿ì¿Í usb ÀÎ °æ¿ì¿¡¸¸ /etc/sysconfig/mouse ¿¡ ÀûÀ½. {{{ if l.device == "sunmouse": self.setMouse("sun", 0) elif l.bus == kudzu.BUS_PSAUX: if l.driver == "synaptics": self.setMouse("synaptics", 0) elif l.driver == "msintellips/2": self.setMouse("genericwheelps/2", 0) else: self.setMouse("generic3ps/2",0) elif l.bus == kudzu.BUS_USB: if l.driver == "generic3usb" or l.driver == "mousedev": self.setMouse("generic3usb", 0) elif l.driver == "genericusb": self.setMouse("genericusb", 1) else: self.setMouse("generic", 1) mouseModels = { # (shortname: make, model, gpm protocol, X protocol, input protocol, device, emulate3) "ascii": (N_("ASCII"), N_("MieMouse (serial)"), "ms3", "IntelliMouse", "ms3", "ttyS", 0), "generic": (N_("Generic"), N_("2 Button Mouse (serial)"), "Microsoft", "Microsoft", "bare", "ttyS", 1), "generic3": (N_("Generic"), N_("3 Button Mouse (serial)"), "Microsoft", "Microsoft", "ms", "ttyS", 0), "genericps/2": (N_("Generic"), N_("2 Button Mouse (PS/2)"), "imps2", "IMPS/2", None, "input/mice", 1), "generic3ps/2": (N_("Generic"), N_("3 Button Mouse (PS/2)"), "imps2", "IMPS/2", None, "input/mice", 0), "genericwheelps/2": (N_("Generic"), N_("Wheel Mouse (PS/2)"), "imps2", "IMPS/2", None, "input/mice", 0), "genericusb": (N_("Generic"), N_("2 Button Mouse (USB)"), "imps2", "IMPS/2", None, "input/mice", 1), "generic3usb": (N_("Generic"), N_("3 Button Mouse (USB)"), "imps2", "IMPS/2", None, "input/mice", 0), "genericwheelusb": (N_("Generic"), N_("Wheel Mouse (USB)"), "imps2", "IMPS/2", None, "input/mice", 0), "geniusnm": (N_("Genius"), N_("NetMouse (serial)"), "ms3", "IntelliMouse", "ms3", "ttyS", 1), "thinking": (N_("Kensington"), N_("Thinking Mouse (serial)"), "Microsoft", "ThinkingMouse", "bare", "ttyS", 1), "logitech": (N_("Logitech"), N_("C7 Mouse (serial, old C7 type)"), "Logitech", "Logitech", "mman", "ttyS", 0), "logitechcc": (N_("Logitech"), N_("CC Series (serial)"), "logim", "MouseMan", "mman", "ttyS", 0), "logimman": (N_("Logitech"), N_("MouseMan/FirstMouse (serial)"), "MouseMan", "MouseMan", "mman", "ttyS", 0), "logimman+": (N_("Logitech"), N_("MouseMan+/FirstMouse+ (serial)"), "pnp", "IntelliMouse", "ms3", "ttyS", 0), "microsoft": (N_("Microsoft"), N_("Compatible Mouse (serial)"), "Microsoft", "Microsoft", "bare", "ttyS", 1), "msnew": (N_("Microsoft"), N_("Rev 2.1A or higher (serial)"), "pnp", "Auto", "ms", "ttyS", 1), "msintelli": (N_("Microsoft"), N_("IntelliMouse (serial)"), "ms3", "IntelliMouse", "ms3", "ttyS", 0), "mousesystems": (N_("Mouse Systems"), N_("Mouse (serial)"), "MouseSystems", "MouseSystems", "msc", "ttyS", 1), "mmseries": (N_("MM"), N_("MM Series (serial)"), "MMSeries", "MMSeries", "bare", "ttyS", 1), "mmhittab": (N_("MM"), N_("MM HitTablet (serial)"), "MMHitTab", "MMHittab", "bare", "ttyS", 1), "none": ("No", "mouse" , "none", "none", None, None, 0), "sun": (N_("Sun"), N_("Mouse"), "sun", "sun", "sun", "sunmouse", 0), "synaptics": (N_("Synaptics"), N_("Synaptics Touchpad"), "imps2", "IMPS/2", None, "input/mice", 1) } }}} case CLASS_CDROM: if (d->bus==BUS_USB) load_mod(d->driver, verbose); link_dev(d, "cdrom", cdrom++, verbose); break; CDROM ÀÌ usb ·Î ¿¬°áµÇ¾î ÀÖÀ¸¸é, °ü·Ã ¸ðµâ ¿Ã¸². ¸µÅ© ¸¸µë. case CLASS_MODEM: if (d->bus==BUS_USB) load_mod(d->driver, verbose); link_dev(d, "modem", modem++, verbose); break; case CLASS_SCANNER: if (d->bus==BUS_USB) load_mod(d->driver, verbose); link_dev(d, "scanner", scanner++, verbose); break; case CLASS_VIDEO: writeconfig("/etc/sysconfig/xserver", d, verbose); break; /etc/sysconfig/xserver ¿¡ ¾²±â¸¸ ÇÔ. xorg ¶Ç´Â xfree86 ÀÌ ¸ðµâÀ» ¿Ã¸®³ª? case CLASS_AUDIO: if (skip&SKIP_AUDIO) break; writeconfig("/etc/sysconfig/sound", d, verbose); load_mod(d->driver, verbose); break; /etc/sysconfig/sound ¿¡ ¾²°í, ¸ðµâ ¿Ã¸². case CLASS_NETWORK: writeconfig("/etc/sysconfig/netcard", d, verbose); load_mod(d->driver, verbose); break; /etc/sysconfig/netcard ¿¡ ¾²°í ¸ðµâ ¿Ã¸². case CLASS_FLOPPY: writeconfig("/etc/sysconfig/floppy", d, verbose); load_mod(d->driver, verbose); break; case CLASS_KEYBOARD: if (d->bus==BUS_USB) load_mod(d->driver, verbose); break; case CLASS_CAPTURE: /* Just load the module for these */ case CLASS_SCSI: if (skip&SKIP_SCSI) break; case CLASS_OTHER: /* Yet unsupported or "guessed" devices in kudzu. Module probe may hang here. */ case CLASS_RAID: load_mod(d->driver, verbose); break; case CLASS_SOCKET: /* yenta_socket or similar is handled by berry-autoconfig */ default: /* do nothing */ break; } } } return 0; } MOUSE: SERIAL ÀÎ °æ¿ì´Â ¸ðµâ ·Îµå ¾ÈÇÔ. usb ¿Í psaux ÀÎ °æ¿ì ¸ðµâ ·Îµå /etc/sysconfig/mouse ¿¡ ³»¿ëÀû°í, link_dev usb ·Î ¿¬°áµÇ¾î ÀÖ´Â °æ¿ì¸¸ , °ü·Ã ¸ðµâ ¿Ã¸². link_dev CDROM, MODEM, SCANNER VIDEO: /etc/sysconfig/xserver ¿¡ ¾²±â¸¸ ÇÔ. AUDIO: skip ¿É¼ÇÀÌ ÀÖÀ¸¸é ¾Æ¹«°Íµµ ¾È ÇÔ. ¾Æ´Ï°æ¿ì /etc/sysconfig/sound ¿¡ ¾²°í, ¸ðµâ ¿Ã¸². NETWORK: /etc/sysconfig/netcard ¿¡ ¾²°í ¸ðµâ ¿Ã¸². FLOPPY: /etc/sysconfig/floppy ¿¡ ¾²°í ¸ðµâ ¿Ã¸². KEYBOARD: usb ·Î ¿¬°áµÇ¾î ÀÖ´Â °æ¿ì¸¸ , ¸ðµâ ¿Ã¸². CAPTURE: bug ·Î º¸ÀÓ. SCSI ¿¡ skip ¿É¼ÇÀÌ ÀÖÀ¸¸é, ¸ðµâÀ» ¿Ã¸®Áö ¸ø ÇÒ °Í °°À½. SCSI: skip ¿É¼ÇÀÌ ÀÖÀ¸¸é ¾Æ¹«°Íµµ ¾È ÇÔ. ¸ðµâ ¿Ã¸². ¸ðµâ¸¸ ¿Ã¸². OTHER, RAID SOCKET: ¾Æ¹«°Íµµ ÇÏÁö ¾ÊÀ½. int load_mod(char *m, int verbose) { int pstatus,i; time_t now; pid_t mpid; if ((m==NULL) || (!strcmp("unknown", m)) || (!strcmp("ignore", m))) return 0; unknown À̰ųª ignore ¸é ¸ðµâ ·Îµå ¸ø ÇÔ. #ifdef BLACKLIST for (i=0; i<(sizeof(blacklist)/sizeof(char*)); i++) { if (!strcmp(blacklist[i], m)) { if (verbose&VERBOSE_PRINT) printf("not loading module %.32s (is in blacklist)\n", m); return 0; } } #endif blacklist ¿¡ ÀÖ´Â °ÍÀÌ¸é ¸ðµâ ·Îµå ¾È ÇÔ. if ((mpid=fork())==0) { /* Child process */ if (verbose&VERBOSE_PRINT) printf("modprobe(%.32s)\n", m); signal(SIGSEGV, segfault_handler); /* Send modprobe errors to /dev/null */ if (!(verbose&VERBOSE_PRINT)) freopen("/dev/null", "w", stderr); //execl("/bin/echo", "echo", m, NULL); if (!strcmp("genericwheelusb", m)) { execl("/sbin/modprobe", "modprobe", "usbhid", NULL); exit(1); } genericwheelusb °¡ ¾Æ´Ï¸é usbhid ¸ðµâ ·Îµå. execl("/sbin/modprobe", "modprobe", m, NULL); ¸ðµâ ·Îµå ¼öÇà. /* Error!! */ exit(1); } now=time(0); do { usleep(125000); /* Delay 1/8s */ /* We SHOULD wait for modprobe to finish! */ if (waitpid(mpid, &pstatus, WNOHANG)) break; } while ((time(0) - now) < MAX_TIME_MODULE); return pstatus; } const char *blacklist[] = { "apm", "agpgart", "yenta_socket", "i82092", "i82365", "tcic", "pcmcia_core", "ds", "ohci1394" }; int link_dev(struct device *d, char *target, int tnum, int verbose) { const char devdir[]="/dev/"; if(d&&d->device) { char devname[64], dstname[64]; sprintf(devname,"%s%.32s",devdir,d->device); sprintf(dstname,"%s%.32s",devdir,target); if(checkmoveup(dstname, tnum)) return -1; /* Read-only FS?! */ if(tnum>0) sprintf(dstname,"%s%.32s%1d",devdir,target,tnum); if(verbose&VERBOSE_PRINT) printf("symlink(%.32s,%.32s)\n",devname,dstname); /* return symlink(devname,dstname);*/ return 0; } return -1; } udev ¿Í °ü°è °ËÅä ÇÊ¿ä. hwconf ¿¡¼­ ¾î¶»°Ô ÇÏ´ÂÁö º¼ °Í. === hwconf.c === hwconf.c °¡ main ÀÌ°í ³ª¸ÓÁö´Â ÀüºÎ libkudzu.a ¸¦ ¸¸µå´Â °ÍÀÓ. quite ¿É¼Ç¸¸ ÇÊ¿äÇÔ. kudzu source package ¿¡ Æ÷ÇԵǾî ÀÖ½¿. int main(int argc, char **argv) { char *confFile; char *debugFile=NULL; int runFirst=0; int ret; int rc; int x; char *bus = NULL, *class = NULL; enum deviceBus probeBus = BUS_UNSPEC; enum deviceClass probeClass = CLASS_UNSPEC; poptContext context; struct device **oldDevs, **newDevs; struct poptOption options[] = { POPT_AUTOHELP { "quiet", 'q', POPT_ARG_NONE, &quiet, 0, _("do configuration that doesn't require user input"), NULL }, { "safe", 's', POPT_ARG_NONE, &safe, 0, _("do only 'safe' probes that won't disturb hardware"), NULL }, { "timeout", 't', POPT_ARG_INT, &timeout, 0, _("set timeout in seconds"), NULL }, { "probe", 'p', POPT_ARG_NONE, &probeonly, 0, _("probe only, print information to stdout"), NULL }, { "bus", 'b', POPT_ARG_STRING, &bus, 0, _("probe only the specified 'bus'"), NULL }, { "class", 'c', POPT_ARG_STRING, &class, 0, _("probe only for the specified 'class'"), NULL }, { "file", 'f', POPT_ARG_STRING, &debugFile, 0, _("read probed hardware from a file"), _("file to read hardware info from") }, { "kernel", 'k', POPT_ARG_STRING, &kernel_ver, 0, _("search for modules for a particular kernel version"), _("kernel version") }, { 0, 0, 0, 0, 0, 0 } }; setlocale(LC_ALL, ""); bindtextdomain("kudzu", "/usr/share/locale"); textdomain("kudzu"); context = poptGetContext("kudzu", argc, (const char **)argv, options, 0); while ((rc = poptGetNextOpt(context)) > 0) { } if (( rc < -1)) { fprintf(stderr, "%s: %s\n", poptBadOption(context, POPT_BADOPTION_NOALIAS), poptStrerror(rc)); exit(-1); } if (getuid() && !probeonly) { fprintf(stderr, _("\nERROR - You must be root to run kudzu.\n")); exit(1); } ·çÆ®°¡ ¾Æ´Ñ °æ¿ì´Â probe ¸¸ ÇÒ ¼ö ÀÖ½¿. setupKernelVersion(); ¾ø¿¡°í ´ÙÀ½À¸·Î ´ëüÇÔ. _module_file = "/etc/modprobe.conf"; if (!(confFile=checkConfFile())) { runFirst=1; } /etc/sysconfig/hwconf °¡ ¾øÀ¸¸é, runFirst=1; ÀÌ ºÎºÐ¸¸ ¼öÇàÇÏ¸é µÉ °Í °°À½. if (bus) { ÇÊ¿ä¾ø½¿. for (x=0; bus[x]; x++) bus[x] = toupper(bus[x]); for (x=0; buses[x].string && strcmp(buses[x].string,bus); x++); if (buses[x].string) probeBus = buses[x].busType; } ¿É¼Ç¿¡ -b °¡ ÀÖ´Â °æ¿ì. bus ¿É¼ÇÀÇ bus ¸íÀ» uppercase ·Î ¹Ù²Ù°í, ¸ÅÄ¡µÇ´Â bus struct ¸¦ ã¾Æ busType ¸¦ ÀúÀå. if (class) { ÇÊ¿ä¾ø½¿. for (x=0; class[x]; x++) class[x] = toupper(class[x]); for (x=0; classes[x].string && strcmp(classes[x].string,class); x++); if (classes[x].string) probeClass = classes[x].classType; } ¿É¼Ç¿¡ -c °¡ ÀÖ´Â °æ¿ì. class ¿É¼ÇÀÇ class ¸íÀ» uppercase ·Î ¹Ù²Ù°í, ¸ÅÄ¡µÇ´Â class struct ¸¦ ã¾Æ classType ¸¦ ÀúÀå. initializeBusDeviceList(probeBus); bus ÀÇ initFunc ¸¦ null ·Î ¸¸µë. if (runFirst || probeonly) { storedDevs = malloc(sizeof(struct device *)); storedDevs[0] = NULL; óÀ½À̰ųª probeonly ¸é storedDevs[0] ¸¦ null ·Î ¸¸µë. } else { ÇÊ¿ä¾ø½¿. storedDevs = readDevices(confFile); if (!storedDevs) { storedDevs = malloc(sizeof(struct device *)); storedDevs[0] = NULL; } /etc/sysconfig/hwconf ¸¦ Àоî storeDevs ¸¦ ä¿ò. hwconf °¡ ºó ÆÄÀÏÀ̸é storedDevs[0] ¸¦ null ·Î ¸¸µë. } while (storedDevs[numStored]) numStored++; if (debugFile) currentDevs = readDevices(debugFile); else { if (safe) currentDevs = probeDevices(probeClass, probeBus, (PROBE_ALL|PROBE_SAFE)); else currentDevs = probeDevices(probeClass, probeBus, PROBE_ALL); } ½ÇÁ¦·Î Çϵå¿þ¾î °Ë»öÇÏ¿© currentDevs ¿¡ ä¿ò. if (!currentDevs) { currentDevs = malloc(sizeof(struct device *)); currentDevs[0] = NULL; } currentDevs °¡ ¾øÀ¸¸é currentDevs[0] ¿¡ null. if (probeonly) { ÇÊ¿ä¾ø½¿. for (x=0; currentDevs[x]; x++) currentDevs[x]->writeDevice(stdout, currentDevs[x]); freeDeviceList(); exit(0); } probeonly ¸é È­¸é¿¡ Ãâ·Â while (currentDevs[numCurrent]) numCurrent++; ÇÊ¿ä¾ø½¿. ret = listCompare(storedDevs, currentDevs, &oldDevs, &newDevs); ÇÊ¿ä¾÷½¿. storedDevs ¿Í currentDevs ºñ±³. freeDeviceList(); ÇÊ¿ä¾ø½¿. if (!ret) { ÇÊ¿ä¾÷½¿. writeDevices(confFile,currentDevs); exit(0); °°Àº °æ¿ìÀÎ °Í °°Àºµ¥, ¿Ö ´Ù½Ã currentDevs ¸¦ confFile ¿¡ ¾²´Â°¡? } else { /* List-ify oldDevs, newDevs */ if (oldDevs[0]) { oldDevs[0]->next=NULL; for (x=1;oldDevs[x];x++) oldDevs[x-1]->next = oldDevs[x]; oldDevs[x-1]->next = NULL; oldDevs[x-1]->next = NULL; } if (newDevs[0]) { newDevs[0]->next = NULL; for (x=1;newDevs[x];x++) newDevs[x-1]->next = newDevs[x]; newDevs[x-1]->next = NULL; } configMenu((*oldDevs),(*newDevs),runFirst); º¯°æµÈ »çÇ׿¡ µû¶ó ¸Þ´º µð½ºÇ÷¹ÀÌ. ÀÌ ºÎºÐÀ» ä¿ö¾ß ÇÔ. } if (!runFirst) writeDevices(confFile,currentDevs); Ãʱâ ÀÛ¾÷ÀÌ ¾Æ´Ï¸é currentDevs ¸¦ confFile ¿¡ ¾¸. else writeDevices("/etc/sysconfig/hwconf",currentDevs); Ãʱâ ÀÛ¾÷À̸é currentDevs ¸¦ /etc/sysconfig/hwconf ¿¡ ¾¸. newtFinished(); if (!access("/usr/bin/rhgb-client",X_OK) && rhgb) { Á¶»çÇÊ¿ä system("/usr/bin/rhgb-client --details=no >/dev/null 2>&1"); } return 0; } configMenu void configMenu(struct device *oldDevs, struct device *newDevs, int runFirst) { int y, z, rc; struct device *dev, *tmpdev; int defaction = -1; int mouseconfigured = 0; /* First, make sure we have work to do... */ dev = oldDevs; for ( ; dev; dev=dev->next) { if (isConfigurable(dev) && !(dev->bus == BUS_PCI && dev->type != CLASS_MODEM && (!strcmp(dev->driver, "ignore") || !strcmp(dev->driver, "disabled") || !strcmp(dev->driver, "unknown")))) { if (!dev->detached) { struct stat sbuf; /* If the device only changed in the driver used, ignore it */ tmpdev = newDevs; for ( ; tmpdev ; tmpdev = tmpdev->next) { if (tmpdev->compareDevice(tmpdev,dev) == 2) { oldDevs = listRemove(oldDevs,dev); newDevs = listRemove(newDevs,tmpdev); continue; } } /* If they have a serial mouse, and GPM or RHGB is running, * it will disappear. */ if (dev->type == CLASS_MOUSE && dev->bus == BUS_SERIAL && (!stat("/dev/gpmctl",&sbuf) || safe || !access("/initrd/rhgb-socket",F_OK))) { currentDevs = realloc(currentDevs,(numCurrent+2)*sizeof(struct device *)); currentDevs[numCurrent] = dev; currentDevs[numCurrent+1] = NULL; numCurrent++; } else continue; } else { /* Add detached devices to current list */ currentDevs = realloc(currentDevs,(numCurrent+2)*sizeof(struct device *)); currentDevs[numCurrent] = dev; currentDevs[numCurrent+1] = NULL; numCurrent++; } } oldDevs = listRemove(oldDevs, dev); } for (y=0; currentDevs[y]; y++) { if (currentDevs[y]->type == CLASS_MOUSE && isConfigured(currentDevs[y])) { mouseconfigured = 1; break; } } /* If a non-serial mouse got removed, ignore it */ dev = oldDevs; for ( ; dev; dev=dev->next) { if (dev->type == CLASS_MOUSE && dev->bus != BUS_SERIAL) { oldDevs = listRemove(oldDevs,dev); } } dev = newDevs; for ( ; dev; dev=dev->next) { if (isConfigurable(dev) && !(dev->bus == BUS_PCI && dev->type != CLASS_MODEM && (!strcmp(dev->driver, "ignore") || !strcmp(dev->driver, "disabled") || !strcmp(dev->driver, "unknown"))) ) { if (!runFirst || !isConfigured(dev)) { switch (dev->type) { case CLASS_NETWORK: case CLASS_SCSI: case CLASS_IDE: case CLASS_RAID: case CLASS_CAPTURE: case CLASS_AUDIO: case CLASS_USB: case CLASS_FIREWIRE: case CLASS_OTHER: if (isAvailable(dev->driver)) continue; break; /* If we are running for the first time, and they * have a mouse that currently exists configured, * ignore any secondary mice. */ case CLASS_MOUSE: if (mouseconfigured) break; continue; default: continue; } } } newDevs = listRemove(newDevs, dev); } if (!oldDevs && !newDevs) return; if (!quiet) { startNewt(); showWelcome(timeout); } dev = oldDevs; for ( ; dev ; dev = dev->next ) { if (!quiet && defaction < 0) rc = newtConfigMenu(_("Hardware Removed"),_("Remove Configuration"), _("Keep Configuration"),_("Do Nothing"), _("The following %s has been removed from " "your system:\n %s\n\n" "You can choose to:\n\n" "1) Remove any existing " "configuration for the device.\n" "2) Keep the existing configuration. " "You will not be prompted " "again if the device seems to be missing.\n" "3) Do nothing. The configuration will " "not be removed, but if the device is found missing on " "subsequent reboots, you will be prompted again."), hwType(dev->type, dev->bus), dev->desc); else rc = defaction >= 0 ? defaction : 0; switch (rc) { case 0: case 3: if (rc == 3) defaction = 0; unconfigure(dev); break; case 1: case 2: case 4: if (rc == 1 || rc == 4) dev->detached = 1; if (rc == 4) defaction = 1; currentDevs = realloc(currentDevs,(numCurrent+2)*sizeof(struct device *)); currentDevs[numCurrent] = dev; currentDevs[numCurrent+1] = NULL; numCurrent++; break; case 5: newtFinished(); exit(0); break; } } dev = newDevs; for ( ; dev ; dev = dev->next) { if (!quiet && defaction < 0) rc = newtConfigMenu(_("Hardware Added"),_("Configure"), _("Ignore"), _("Do Nothing"), _("The following %s has been added to " "your system:\n %s\n\n" "You can choose to:\n\n" "1) Configure the device.\n" "2) Ignore the device. No configuration will " "be added, but you will not be prompted if " "the device is detected on subsequent reboots.\n" "3) Do nothing. No configuration will be " "added, and the device will show up as new if " "it is detected on subsequent reboots."), hwType(dev->type, dev->bus), dev->desc); else rc = defaction >= 0 ? defaction : 0; switch (rc) { case 0: case 3: if (rc == 3) defaction = 0; configure(dev); break; case 1: case 4: if (rc == 4) defaction = 1; break; case 2: y=0; while (currentDevs[y]) { if (currentDevs[y]==dev) { for (z=y;z= 0) { if (configuredX) { close(open("/var/run/Xconfig-failed",O_CREAT|O_EXCL,0644)); } else { close(open("/var/run/Xconfig",O_CREAT|O_EXCL,0644)); } } if (removedMouse) { int i; int fixedmouse = 0; for (i=0; currentDevs[i]; i++) { if (currentDevs[i]->type == CLASS_MOUSE && strcmp(currentDevs[i]->driver,"ignore")) { configure(currentDevs[i]); fixedmouse = 1; break; } } if (!fixedmouse) { close(open("/var/run/Xconfig-failed",O_CREAT|O_EXCL,0644)); } } } isConfigurable isConfigured isAvailable === rc.sysinit and kmodule === rc.sysinit ¿¡¼­ kmodule À» call ÇÑ ÈÄ¿¡ load_module À» »ç¿ëÇÏ¿© ·ÎµåÇÔ. °á±¹ hwconf ¿¡¼­ ¸ðµâÀ» Àß assign ÇÏ¸é µÉ °Í °°À½.