]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/install+setup/install/usb.c
Bootvorgang des Installers weitergebracht.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / usb.c
index 90bba2caf20ae5c87940bb8abf1a70f714991c9a..444309e9ab6e55a39175d044ccf427a7c2bf1537 100644 (file)
@@ -17,8 +17,6 @@
  *
  * Copyright 2002: Mark Wormgoor <mark@wormgoor.com>
  * 
- * $Id: usb.c,v 1.9.2.8 2005/12/10 00:18:23 franck78 Exp $
- * 
  */
 
 #include "install.h"
@@ -28,114 +26,70 @@ int usbohci = 0;
 int ehcihcd = 0;
 
 int initialize_usb() {
-    modprobe("sd_mod");
-    modprobe("sr_mod");
-    modprobe("usb-storage");
+    mysystem("/sbin/modprobe sd_mod");
+    mysystem("/sbin/modprobe sr_mod");
+    mysystem("/sbin/modprobe usb-storage");
 
     if (ehcihcd) {
-       rmmod("ehci-hcd");
+       mysystem("/sbin/rmmod ehci-hcd");
        ehcihcd = 0;
     }
     if (usbohci) {
-       rmmod("usb-ohci");
+       mysystem("/sbin/rmmod ohci-hcd");
        usbohci = 0;
     }
     if (usbuhci) {
-       rmmod("usb-uhci");
+       mysystem("/sbin/rmmod uhci-hcd");
        usbuhci = 0;
     }
 
-    if (modprobe("ehci-hcd") == 0) ehcihcd = 1;
-    if (modprobe("usb-ohci") == 0) usbohci = 1;
-    if (modprobe("usb-uhci") == 0) usbuhci = 1;
+    if (mysystem("/sbin/modprobe ehci-hcd") == 0)
+       ehcihcd = 1;
+    if (mysystem("/sbin/modprobe ohci-hcd") == 0)
+       usbohci = 1;
+    if (mysystem("/sbin/modprobe uhci-hcd") == 0)
+       usbuhci = 1;
 
-    modprobe("hid");
-    modprobe("keybdev");
+    mysystem("/sbin/modprobe usbhid");
     return 0;
 }
 
 int write_usb_modules_conf() {
-    int index = 0;
+    int index;
     FILE *handle;
 
     if (!(handle = fopen("/harddisk/etc/modules.conf", "a")))
        return 0;
 
+    index = 0;
+
 #if 0 /* we don't do this yet, because one of the drivers has a problem 
        * with it */
     if (ehcihcd) {
-       fprintf(handle,"alias usb-controller");
        if (index)
-               fprintf(handle,"%d",index);
-       fprintf(handle," ehci-hcd\n");
+               fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
+       else
+               fprintf(handle,"alias usb-controller ehci-hcd\n");
        index++;
     }
 #endif
 
     if (usbohci) {
-       fprintf(handle,"alias usb-controller");
        if (index)
-               fprintf(handle,"%d",index);
-       fprintf(handle," usb-ohci\n");
+               fprintf(handle,"alias usb-controller%d ohci-hcd\n",index);
+       else
+               fprintf(handle,"alias usb-controller ohci-hcd\n");
        index++;
     }
 
     if (usbuhci) {
-       fprintf(handle,"alias usb-controller");
        if (index)
-               fprintf(handle,"%d",index);
-       fprintf(handle," usb-uhci\n");
+               fprintf(handle,"alias usb-controller%d uhci-hcd\n",index);
+       else
+               fprintf(handle,"alias usb-controller uhci-hcd\n");
        index++;
     }
     fclose(handle);
     
     return 0;
 }
-
-/* checkusb().
-    Scans the named partitions and returns true if USB-removable.
-    a bug? in "cat /proc/partitions" with superfloppy scheme device
-    make them appearing always with four 'false' partitions:
-    sda and sda1 sda2 sda3 sda4.
-    No easy way to decide if /dev/sda1 exists or not.
-*/
-int checkusb(char *partition)
-{
-       FILE *f = NULL;
-       char filename[STRING_SIZE];
-       char buffer[STRING_SIZE];
-       char *pchar = &buffer[0];
-       if (!(f = fopen("/proc/partitions", "r")))
-               return 0;
-
-       short int major = 0, minor = 0;                 
-       while (fgets(buffer, STRING_SIZE, f))   {
-           /* look for partition*/     
-           if (strstr (buffer, partition)) {
-               major = atoi (buffer);
-               if (major != 8) break ; /* not scsi */
-               //get minor
-               while (*pchar != '8') pchar++;
-               minor = atoi (++pchar);
-               break;
-           }
-       }
-       fclose(f);
-       if (major != 8) return 0; /* nothing found */
-       
-       //now check for usb-storage-MINOR
-       minor >>= 4; // get index from minor
-       sprintf (filename, "/proc/scsi/usb-storage-%d/%d", minor,minor);
-
-       if (!(f = fopen(filename, "r")))
-               return 0;
-       int count = 0;
-       while (fgets(buffer, STRING_SIZE, f))   {
-           if (strstr(buffer,"usb-storage")) count++;
-           if (strstr(buffer,"SCSI")) count++;
-           if (strstr(buffer,"Attached: Yes")) count++;
-       }
-       fclose(f);
-       
-       return (count==3 ? 1 : 0);
-}