]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/usb.c
GD-Graph fuer Maniac eingebaut
[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 mysystem("/sbin/modprobe vfat");
33
34 if (ehcihcd) {
35 mysystem("/sbin/rmmod ehci-hcd");
36 ehcihcd = 0;
37 }
38 if (usbohci) {
39 mysystem("/sbin/rmmod ohci-hcd");
40 usbohci = 0;
41 }
42 if (usbuhci) {
43 mysystem("/sbin/rmmod uhci-hcd");
44 usbuhci = 0;
45 }
46
47 if (mysystem("/sbin/modprobe ehci-hcd") == 0)
48 ehcihcd = 1;
49 if (mysystem("/sbin/modprobe ohci-hcd") == 0)
50 usbohci = 1;
51 if (mysystem("/sbin/modprobe uhci-hcd") == 0)
52 usbuhci = 1;
53
54 mysystem("/sbin/modprobe usbhid");
55 mysystem("/sbin/udevstart");
56 return 0;
57 }
58
59 int write_usb_modules_conf() {
60 int index;
61 FILE *handle;
62
63 if (!(handle = fopen("/harddisk/etc/modules.conf", "a")))
64 return 0;
65
66 index = 0;
67
68 #if 0 /* we don't do this yet, because one of the drivers has a problem
69 * with it */
70 if (ehcihcd) {
71 if (index)
72 fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
73 else
74 fprintf(handle,"alias usb-controller ehci-hcd\n");
75 index++;
76 }
77 #endif
78
79 if (usbohci) {
80 if (index)
81 fprintf(handle,"alias usb-controller%d ohci-hcd\n",index);
82 else
83 fprintf(handle,"alias usb-controller ohci-hcd\n");
84 index++;
85 }
86
87 if (usbuhci) {
88 if (index)
89 fprintf(handle,"alias usb-controller%d uhci-hcd\n",index);
90 else
91 fprintf(handle,"alias usb-controller uhci-hcd\n");
92 index++;
93 }
94 fclose(handle);
95
96 return 0;
97 }