]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/install+setup/install/usb.c
Die IDE/SCSI/SATA/USB-Erkennung erstellt nun schoene Ramdisks :D
[ipfire-2.x.git] / src / install+setup / install / usb.c
index 444309e9ab6e55a39175d044ccf427a7c2bf1537..57ba56f50effa188b1332bf7bd989b84281ce119 100644 (file)
@@ -29,6 +29,7 @@ int initialize_usb() {
     mysystem("/sbin/modprobe sd_mod");
     mysystem("/sbin/modprobe sr_mod");
     mysystem("/sbin/modprobe usb-storage");
+    mysystem("/sbin/modprobe vfat");
 
     if (ehcihcd) {
        mysystem("/sbin/rmmod ehci-hcd");
@@ -93,3 +94,25 @@ int write_usb_modules_conf() {
     
     return 0;
 }
+
+/* Scans the named partitions and returns true if USB-removable. */
+int checkusb(char *device)
+{
+       FILE *f = NULL;
+       char filename[STRING_SIZE];
+       char command[STRING_SIZE];
+       char buffer[STRING_SIZE];
+       int found = 0;
+       
+       sprintf(command, "udevinfo -a -p /sys/block/%s | grep BUS | sort| uniq >/tmp/usbscan 2>/dev/null", device);
+       system(command);
+       
+       f = fopen("/tmp/usbscan", "r");
+       while (fgets(buffer, STRING_SIZE, f)) {
+               if (strstr(buffer,"usb")) found=1;
+       }
+       fclose(f);
+       
+       if (found) return 0;
+               else return 1;
+}