]>
Commit | Line | Data |
---|---|---|
d6aaa55d MT |
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 | * | |
10bc6f06 | 20 | * $Id: usb.c,v 1.9.2.3 2004/11/16 22:48:43 alanh Exp $ |
d6aaa55d MT |
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() { | |
10bc6f06 MT |
31 | mysystem("/sbin/modprobe sd_mod"); |
32 | mysystem("/sbin/modprobe sr_mod"); | |
33 | mysystem("/sbin/modprobe usb-storage"); | |
d6aaa55d MT |
34 | |
35 | if (ehcihcd) { | |
10bc6f06 | 36 | mysystem("/sbin/rmmod ehci-hcd"); |
d6aaa55d MT |
37 | ehcihcd = 0; |
38 | } | |
39 | if (usbohci) { | |
10bc6f06 | 40 | mysystem("/sbin/rmmod usb-ohci"); |
d6aaa55d MT |
41 | usbohci = 0; |
42 | } | |
43 | if (usbuhci) { | |
10bc6f06 | 44 | mysystem("/sbin/rmmod usb-uhci"); |
d6aaa55d MT |
45 | usbuhci = 0; |
46 | } | |
47 | ||
10bc6f06 MT |
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; | |
d6aaa55d | 54 | |
10bc6f06 MT |
55 | mysystem("/sbin/modprobe hid"); |
56 | mysystem("/sbin/modprobe keybdev"); | |
d6aaa55d MT |
57 | return 0; |
58 | } | |
59 | ||
60 | int write_usb_modules_conf() { | |
10bc6f06 | 61 | int index; |
d6aaa55d MT |
62 | FILE *handle; |
63 | ||
64 | if (!(handle = fopen("/harddisk/etc/modules.conf", "a"))) | |
65 | return 0; | |
66 | ||
10bc6f06 MT |
67 | index = 0; |
68 | ||
d6aaa55d MT |
69 | #if 0 /* we don't do this yet, because one of the drivers has a problem |
70 | * with it */ | |
71 | if (ehcihcd) { | |
d6aaa55d | 72 | if (index) |
10bc6f06 MT |
73 | fprintf(handle,"alias usb-controller%d ehci-hcd\n",index); |
74 | else | |
75 | fprintf(handle,"alias usb-controller ehci-hcd\n"); | |
d6aaa55d MT |
76 | index++; |
77 | } | |
78 | #endif | |
79 | ||
80 | if (usbohci) { | |
d6aaa55d | 81 | if (index) |
10bc6f06 MT |
82 | fprintf(handle,"alias usb-controller%d usb-ohci\n",index); |
83 | else | |
84 | fprintf(handle,"alias usb-controller usb-ohci\n"); | |
d6aaa55d MT |
85 | index++; |
86 | } | |
87 | ||
88 | if (usbuhci) { | |
d6aaa55d | 89 | if (index) |
10bc6f06 MT |
90 | fprintf(handle,"alias usb-controller%d usb-uhci\n",index); |
91 | else | |
92 | fprintf(handle,"alias usb-controller usb-uhci\n"); | |
d6aaa55d MT |
93 | index++; |
94 | } | |
95 | fclose(handle); | |
96 | ||
97 | return 0; | |
98 | } |