]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/usb.c
Installer repariert
[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 * $Id: usb.c,v 1.9.2.3 2004/11/16 22:48:43 alanh Exp $
21 *
22 */
23
24 #include "install.h"
25
26 int usbuhci = 0;
27 int usbohci = 0;
28 int ehcihcd = 0;
29
30 int initialize_usb() {
31 mysystem("/sbin/modprobe sd_mod");
32 mysystem("/sbin/modprobe sr_mod");
33 mysystem("/sbin/modprobe usb-storage");
34
35 if (ehcihcd) {
36 mysystem("/sbin/rmmod ehci-hcd");
37 ehcihcd = 0;
38 }
39 if (usbohci) {
40 mysystem("/sbin/rmmod usb-ohci");
41 usbohci = 0;
42 }
43 if (usbuhci) {
44 mysystem("/sbin/rmmod usb-uhci");
45 usbuhci = 0;
46 }
47
48 if (mysystem("/sbin/modprobe ehci-hcd") == 0)
49 ehcihcd = 1;
50 if (mysystem("/sbin/modprobe usb-ohci") == 0)
51 usbohci = 1;
52 if (mysystem("/sbin/modprobe usb-uhci") == 0)
53 usbuhci = 1;
54
55 mysystem("/sbin/modprobe hid");
56 mysystem("/sbin/modprobe keybdev");
57 return 0;
58 }
59
60 int write_usb_modules_conf() {
61 int index;
62 FILE *handle;
63
64 if (!(handle = fopen("/harddisk/etc/modules.conf", "a")))
65 return 0;
66
67 index = 0;
68
69 #if 0 /* we don't do this yet, because one of the drivers has a problem
70 * with it */
71 if (ehcihcd) {
72 if (index)
73 fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
74 else
75 fprintf(handle,"alias usb-controller ehci-hcd\n");
76 index++;
77 }
78 #endif
79
80 if (usbohci) {
81 if (index)
82 fprintf(handle,"alias usb-controller%d usb-ohci\n",index);
83 else
84 fprintf(handle,"alias usb-controller usb-ohci\n");
85 index++;
86 }
87
88 if (usbuhci) {
89 if (index)
90 fprintf(handle,"alias usb-controller%d usb-uhci\n",index);
91 else
92 fprintf(handle,"alias usb-controller usb-uhci\n");
93 index++;
94 }
95 fclose(handle);
96
97 return 0;
98 }