|
|
* loads modules, generates /dev links, no isapnp autoconfiguration (yet) * | * loads modules, generates /dev links, no isapnp autoconfiguration (yet) * |
* needs kudzu-devel (ver. 0.23 and up) * | * needs kudzu-devel (ver. 0.23 and up) * |
* Author: Klaus Knopper <knopper@knopper.net> * | * Author: Klaus Knopper <knopper@knopper.net> * |
|
* Modifications: René Rhéaume <rener@mediom.qc.ca> * |
\****************************************************************************/ | \****************************************************************************/ |
| |
#include <stdio.h> | #include <stdio.h> |
|
|
#endif | #endif |
| |
#define VERSION "HWSETUP 1.0, an automatic hardware configuration tool\n" \ | #define VERSION "HWSETUP 1.0, an automatic hardware configuration tool\n" \ |
"(C) 2002 Klaus Knopper <knoppix@knopper.net>\n\n" |
"(C) 2002 Klaus Knopper <knoppix@knopper.net>\n" \ |
|
"Modifications (C) 2004 René Rhéaume <rener@mediom.qc.ca>\n" |
| |
#define CARDSDB "/usr/share/hwdata/Cards" | #define CARDSDB "/usr/share/hwdata/Cards" |
#define XPATH "/usr/X11R6/bin/" | #define XPATH "/usr/X11R6/bin/" |
|
|
| |
int syntax(char *option) | int syntax(char *option) |
{ | { |
printf(VERSION); |
puts(VERSION); |
if(option) fprintf(stderr,"hwsetup: Unknown option '%s'\n\n",option); | if(option) fprintf(stderr,"hwsetup: Unknown option '%s'\n\n",option); |
printf("Usage: hwsetup\n" |
puts("Usage: hwsetup\n" |
" -v be verbose\n" |
"\t\t-v\tbe verbose\n" |
" -p print rotating prompt\n" |
"\t\t-p\tprint rotating prompt\n" |
" -a ignore audio devices\n" |
"\t\t-a\tignore audio devices\n" |
" -s ignore scsi controllers\n" |
"\t\t-s\tignore scsi controllers\n" |
" -n probe only, don't configure anything.\n"); |
"\t\t-n\tprobe only, don't configure anything\n" |
|
"\t\t-f\trun a fast probe."); |
return option?1:0; | return option?1:0; |
} | } |
| |
|
|
{ | { |
signal(SIGALRM,SIG_IGN); | signal(SIGALRM,SIG_IGN); |
fprintf(stderr,"\nWARNING: Autodetection seems to hang,\n" | fprintf(stderr,"\nWARNING: Autodetection seems to hang,\n" |
"please check your computers BIOS settings.\n"); |
"please check your computer BIOS settings.\n"); |
fflush(stderr); | fflush(stderr); |
if(wpid) { kill(wpid,SIGTERM); usleep(2500000); kill(wpid,SIGKILL); wpid=0; } | if(wpid) { kill(wpid,SIGTERM); usleep(2500000); kill(wpid,SIGKILL); wpid=0; } |
exit(1); /* exit program */ | exit(1); /* exit program */ |
|
|
return 0; | return 0; |
} | } |
| |
int hw_setup(enum deviceClass dc, int verbose, int probeonly, int skip) |
int hw_setup(enum deviceClass dc, int verbose, int probeonly, int skip, int fastprobe) |
{ | { |
int i,mouse=0,cdrom=0,modem=0,scanner=0; | int i,mouse=0,cdrom=0,modem=0,scanner=0; |
|
int probeopt=fastprobe?PROBE_SAFE:PROBE_ALL; |
struct device **currentDevs, *d, *serialmouse=NULL, *usbmouse=NULL; | struct device **currentDevs, *d, *serialmouse=NULL, *usbmouse=NULL; |
if(verbose&VERBOSE_PROMPT) wpid=startwheel(); | if(verbose&VERBOSE_PROMPT) wpid=startwheel(); |
if((currentDevs=probeDevices(dc,BUS_UNSPEC,PROBE_ALL))==NULL) return -1; |
if((currentDevs=probeDevices(dc,BUS_UNSPEC,probeopt))==NULL) return -1; |
if(verbose&VERBOSE_PROMPT&&wpid>0) { kill(wpid,SIGTERM); wpid=0; usleep(160000); write(2,"\033[0m Done.\n",11); } | if(verbose&VERBOSE_PROMPT&&wpid>0) { kill(wpid,SIGTERM); wpid=0; usleep(160000); write(2,"\033[0m Done.\n",11); } |
for(i=0;(d=currentDevs[i]);i++) | for(i=0;(d=currentDevs[i]);i++) |
{ | { |
|
|
| |
int main(int argc, char **argv) | int main(int argc, char **argv) |
{ | { |
int i, verbose=0, probeonly=0, skip=0; |
int i, verbose=0, probeonly=0, skip=0, fast=0; |
enum deviceClass dc=CLASS_UNSPEC; | enum deviceClass dc=CLASS_UNSPEC; |
for(i=1;i<argc;i++) | for(i=1;i<argc;i++) |
{ | { |
|
|
else if(!strcasecmp(argv[i],"-a")) skip|=SKIP_AUDIO; | else if(!strcasecmp(argv[i],"-a")) skip|=SKIP_AUDIO; |
else if(!strcasecmp(argv[i],"-s")) skip|=SKIP_SCSI; | else if(!strcasecmp(argv[i],"-s")) skip|=SKIP_SCSI; |
else if(!strcasecmp(argv[i],"-n")) probeonly=1; | else if(!strcasecmp(argv[i],"-n")) probeonly=1; |
|
else if(!strcasecmp(argv[i],"-f")) fast=1; |
else return syntax(argv[i]); | else return syntax(argv[i]); |
} | } |
/* Allow SIGTERM, SIGINT: rmmod depends on this. */ | /* Allow SIGTERM, SIGINT: rmmod depends on this. */ |
signal(SIGTERM,SIG_DFL); signal(SIGINT,SIG_DFL); | signal(SIGTERM,SIG_DFL); signal(SIGINT,SIG_DFL); |
signal(SIGALRM,alarm_handler); alarm(MAX_TIME); | signal(SIGALRM,alarm_handler); alarm(MAX_TIME); |
return hw_setup(dc,verbose,probeonly,skip); |
return hw_setup(dc,verbose,probeonly,skip,fast); |
} | } |