]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/usb.c
Bootvorgang des Installers weitergebracht.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / usb.c
1 /*
2 * This file is part of the IPCop Firewall.
3 *
4 * IPCop is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * IPCop is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with IPCop; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Copyright 2002: Mark Wormgoor <mark@wormgoor.com>
19 *
20 */
21
22 #include "install.h"
23
24 int usbuhci = 0;
25 int usbohci = 0;
26 int ehcihcd = 0;
27
28 int initialize_usb() {
29 mysystem("/sbin/modprobe sd_mod");
30 mysystem("/sbin/modprobe sr_mod");
31 mysystem("/sbin/modprobe usb-storage");
32
33 if (ehcihcd) {
34 mysystem("/sbin/rmmod ehci-hcd");
35 ehcihcd = 0;
36 }
37 if (usbohci) {
38 mysystem("/sbin/rmmod ohci-hcd");
39 usbohci = 0;
40 }
41 if (usbuhci) {
42 mysystem("/sbin/rmmod uhci-hcd");
43 usbuhci = 0;
44 }
45
46 if (mysystem("/sbin/modprobe ehci-hcd") == 0)
47 ehcihcd = 1;
48 if (mysystem("/sbin/modprobe ohci-hcd") == 0)
49 usbohci = 1;
50 if (mysystem("/sbin/modprobe uhci-hcd") == 0)
51 usbuhci = 1;
52
53 mysystem("/sbin/modprobe usbhid");
54 return 0;
55 }
56
57 int write_usb_modules_conf() {
58 int index;
59 FILE *handle;
60
61 if (!(handle = fopen("/harddisk/etc/modules.conf", "a")))
62 return 0;
63
64 index = 0;
65
66 #if 0 /* we don't do this yet, because one of the drivers has a problem
67 * with it */
68 if (ehcihcd) {
69 if (index)
70 fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
71 else
72 fprintf(handle,"alias usb-controller ehci-hcd\n");
73 index++;
74 }
75 #endif
76
77 if (usbohci) {
78 if (index)
79 fprintf(handle,"alias usb-controller%d ohci-hcd\n",index);
80 else
81 fprintf(handle,"alias usb-controller ohci-hcd\n");
82 index++;
83 }
84
85 if (usbuhci) {
86 if (index)
87 fprintf(handle,"alias usb-controller%d uhci-hcd\n",index);
88 else
89 fprintf(handle,"alias usb-controller uhci-hcd\n");
90 index++;
91 }
92 fclose(handle);
93
94 return 0;
95 }