[package] 6in4: implement metric option
[openwrt.git] / package / uboot-lantiq / patches / 310-fix-httpd.patch
1 --- a/board/infineon/easy50712/danube.c
2 +++ b/board/infineon/easy50712/danube.c
3 @@ -354,7 +354,7 @@ int do_http_upgrade(const unsigned char
4 }
5 /* write the image to the flash */
6 puts("http ugrade ...\n");
7 - sprintf(buf, "era ${kernel_addr} +0x%x; cp.b ${ram_addr} ${kernel_addr} 0x%x", size, size);
8 + sprintf(buf, "era ${kernel_addr} +0x%lx; cp.b ${ram_addr} ${kernel_addr} 0x%lx", size, size);
9 return run_command(buf, 0);
10 }
11
12 --- a/common/main.c
13 +++ b/common/main.c
14 @@ -273,6 +273,10 @@ static __inline__ int abortboot(int boot
15
16 void main_loop (void)
17 {
18 +#ifdef CONFIG_CMD_HTTPD
19 + int ret;
20 +#endif
21 +
22 #ifndef CONFIG_SYS_HUSH_PARSER
23 static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
24 int len;
25 @@ -403,12 +407,22 @@ void main_loop (void)
26 # endif
27
28 # ifndef CONFIG_SYS_HUSH_PARSER
29 - run_command (s, 0);
30 + ret = run_command (s, 0);
31 # else
32 - parse_string_outer(s, FLAG_PARSE_SEMICOLON |
33 + ret = parse_string_outer(s, FLAG_PARSE_SEMICOLON |
34 FLAG_EXIT_FROM_LOOP);
35 # endif
36
37 +# ifdef CONFIG_CMD_HTTPD
38 + if (ret != 0) {
39 + printf("Failed to execute bootcmd "
40 + "(maybe invalid u-boot environment?), "
41 + "starting httpd to update firmware...\n");
42 + NetLoopHttpd();
43 + }
44 +# endif
45 +
46 +
47 # ifdef CONFIG_AUTOBOOT_KEYED
48 disable_ctrlc(prev); /* restore Control C checking */
49 # endif
50 --- a/include/configs/easy50712.h
51 +++ b/include/configs/easy50712.h
52 @@ -114,4 +114,7 @@
53
54 #define CONFIG_CMD_HTTPD /* enable upgrade via HTTPD */
55
56 +#define CONFIG_IPADDR 192.168.0.119
57 +#define CONFIG_ETHADDR 00:01:02:03:04:05
58 +
59 #endif /* __CONFIG_H */
60 --- a/lib_mips/time.c
61 +++ b/lib_mips/time.c
62 @@ -29,6 +29,8 @@ static unsigned long timestamp;
63 /* how many counter cycles in a jiffy */
64 #define CYCLES_PER_JIFFY (CONFIG_SYS_MIPS_TIMER_FREQ + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ
65
66 +unsigned long ifx_get_cpuclk(void);
67 +
68 /*
69 * timer without interrupts
70 */
71 --- a/net/httpd.c
72 +++ b/net/httpd.c
73 @@ -35,12 +35,14 @@ HttpdHandler (void)
74 }
75 }
76
77 +#if 0
78 static void
79 HttpdTimeout (void)
80 {
81 puts ("T ");
82 NetSetTimeout (TIMEOUT * 1000, HttpdTimeout);
83 }
84 +#endif
85
86 void
87 HttpdStart (void)
88 --- a/net/net.c
89 +++ b/net/net.c
90 @@ -1966,7 +1966,7 @@ NetSendHttpd(void)
91 void
92 NetReceiveHttpd(volatile uchar * inpkt, int len)
93 {
94 - memcpy(uip_buf, inpkt, len);
95 + memcpy(uip_buf, (const void *)inpkt, len);
96 uip_len = len;
97 if(BUF->type == htons(UIP_ETHTYPE_IP)) {
98 uip_arp_ipin();
99 @@ -1989,6 +1989,7 @@ NetLoopHttpd(void)
100 unsigned long long tout = 0;
101 bd_t *bd = gd->bd;
102 unsigned short int ip[2];
103 + struct uip_eth_addr eaddr;
104
105 #ifdef CONFIG_NET_MULTI
106 NetRestarted = 0;
107 @@ -2039,6 +2040,15 @@ restart:
108 eth_getenv_enetaddr("ethaddr", NetOurEther);
109 #endif
110
111 + eaddr.addr[0] = NetOurEther[0];
112 + eaddr.addr[1] = NetOurEther[1];
113 + eaddr.addr[2] = NetOurEther[2];
114 + eaddr.addr[3] = NetOurEther[3];
115 + eaddr.addr[4] = NetOurEther[4];
116 + eaddr.addr[5] = NetOurEther[5];
117 +
118 + uip_setethaddr(eaddr);
119 +
120 NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
121 NetOurGatewayIP = getenv_IPaddr ("gatewayip");
122 NetOurSubnetMask= getenv_IPaddr ("netmask");
123 @@ -2072,6 +2082,14 @@ restart:
124 tout = t1;
125 }
126 }
127 +
128 + if (ctrlc()) {
129 + eth_halt();
130 + puts ("\nAbort\n");
131 + return (-1);
132 + }
133 +
134 +
135 if(!httpd_upload_complete)
136 continue;
137 printf("Bytes transferred = %ld (%lx hex)\n",
138 --- a/net/uip-0.9/fsdata.c
139 +++ b/net/uip-0.9/fsdata.c
140 @@ -1,199 +1,108 @@
141 -static const char data_flashing_html[] = {
142 - /* /flashing.html */
143 - 0x2f, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
144 - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
145 - 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
146 - 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
147 - 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
148 - 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
149 - 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
150 - 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
151 - 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
152 - 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
153 - 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x3c, 0x62,
154 - 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3d,
155 - 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x30,
156 - 0x70, 0x74, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x3b, 0x20, 0x68,
157 - 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x31, 0x30, 0x30, 0x25,
158 - 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23,
159 - 0x66, 0x66, 0x66, 0x3b, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x67,
160 - 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, 0x6f,
161 - 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62, 0x62, 0x30, 0x33, 0x34,
162 - 0x3b, 0x22, 0x3e, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72,
163 - 0x3e, 0x3c, 0x68, 0x31, 0x3e, 0x55, 0x70, 0x67, 0x72, 0x61,
164 - 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65,
165 - 0x6d, 0x20, 0x2e, 0x2e, 0x2e, 0x2e, 0x3c, 0x2f, 0x68, 0x31,
166 - 0x3e, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
167 - 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x68,
168 - 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
169 -
170 -static const char data_fail_html[] = {
171 - /* /fail.html */
172 - 0x2f, 0x66, 0x61, 0x69, 0x6c, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
173 - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
174 - 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
175 - 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
176 - 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
177 - 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
178 - 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
179 - 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
180 - 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
181 - 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
182 - 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
183 - 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
184 - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
185 - 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
186 - 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
187 - 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
188 - 0x3e, 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa,
189 - 0x9, 0x9, 0x3c, 0x68, 0x31, 0x3e, 0x46, 0x6c, 0x61, 0x73,
190 - 0x68, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65,
191 - 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x9, 0x9, 0x45,
192 - 0x52, 0x52, 0x4f, 0x52, 0x20, 0x2d, 0x20, 0x74, 0x68, 0x65,
193 - 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x79, 0x6f, 0x75,
194 - 0x20, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x20,
195 - 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20,
196 - 0x70, 0x61, 0x73, 0x73, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66,
197 - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x50,
198 - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x6d, 0x61, 0x6b, 0x65,
199 - 0x20, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x75,
200 - 0x73, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x66, 0x69,
201 - 0x63, 0x69, 0x61, 0x6c, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74,
202 - 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64,
203 - 0x20, 0x62, 0x79, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
204 - 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x2e,
205 - 0x66, 0x6f, 0x6e, 0x6f, 0x73, 0x66, 0x65, 0x72, 0x61, 0x2e,
206 - 0x6f, 0x72, 0x67, 0x2f, 0xa, 0x9, 0x3c, 0x2f, 0x62, 0x6f,
207 - 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c,
208 - 0x3e, 0xa, };
209 -
210 -static const char data_404_html[] = {
211 - /* /404.html */
212 - 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
213 - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34,
214 - 0x30, 0x34, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f,
215 - 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53,
216 - 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50,
217 - 0x2f, 0x30, 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70,
218 - 0x3a, 0x2f, 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73,
219 - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f,
220 - 0x75, 0x69, 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e,
221 - 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a,
222 - 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c,
223 - 0xd, 0xa, 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e,
224 - 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f,
225 - 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65,
226 - 0x22, 0x3e, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
227 - 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, 0x20,
228 - 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66,
229 - 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c,
230 - 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, 0x3c, 0x2f,
231 - 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x68, 0x74, 0x6d,
232 - 0x6c, 0x3e, };
233 -
234 -static const char data_index_html[] = {
235 - /* /index.html */
236 - 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
237 - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
238 - 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
239 - 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
240 - 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
241 - 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
242 - 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
243 - 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
244 - 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
245 - 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
246 - 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
247 - 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
248 - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
249 - 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
250 - 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
251 - 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
252 - 0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e,
253 - 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74,
254 - 0x79, 0x6c, 0x65, 0x3d, 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69,
255 - 0x6e, 0x3a, 0x20, 0x30, 0x70, 0x74, 0x20, 0x61, 0x75, 0x74,
256 - 0x6f, 0x3b, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a,
257 - 0x31, 0x30, 0x30, 0x25, 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f,
258 - 0x72, 0x3a, 0x20, 0x23, 0x30, 0x30, 0x30, 0x3b, 0x20, 0x62,
259 - 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d,
260 - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62,
261 - 0x62, 0x30, 0x33, 0x34, 0x3b, 0x22, 0x3e, 0xa, 0x9, 0x9,
262 - 0x3c, 0x68, 0x31, 0x3e, 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65,
263 - 0x72, 0x61, 0x20, 0x46, 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66,
264 - 0x65, 0x20, 0x55, 0x49, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa,
265 - 0x9, 0x9, 0x3c, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x65,
266 - 0x74, 0x68, 0x6f, 0x64, 0x3d, 0x22, 0x70, 0x6f, 0x73, 0x74,
267 - 0x22, 0x20, 0x65, 0x6e, 0x63, 0x74, 0x79, 0x70, 0x65, 0x3d,
268 - 0x22, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74,
269 - 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x2d, 0x64, 0x61, 0x74, 0x61,
270 - 0x22, 0x3e, 0xa, 0x9, 0x9, 0x9, 0x3c, 0x69, 0x6e, 0x70,
271 - 0x75, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x66, 0x69,
272 - 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x69,
273 - 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x3e, 0xa, 0x9, 0x9,
274 - 0x9, 0x3c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x74, 0x79,
275 - 0x70, 0x65, 0x3d, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x3e,
276 - 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x3e,
277 - 0xa, 0x9, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa,
278 - 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
279 -
280 -static const char data_flash_html[] = {
281 - /* /flash.html */
282 - 0x2f, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
283 - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
284 - 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
285 - 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
286 - 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
287 - 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
288 - 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
289 - 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
290 - 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
291 - 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
292 - 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
293 - 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
294 - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
295 - 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
296 - 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
297 - 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
298 - 0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e,
299 - 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74,
300 - 0x79, 0x6c, 0x65, 0x3d, 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69,
301 - 0x6e, 0x3a, 0x20, 0x30, 0x70, 0x74, 0x20, 0x61, 0x75, 0x74,
302 - 0x6f, 0x3b, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a,
303 - 0x31, 0x30, 0x30, 0x25, 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f,
304 - 0x72, 0x3a, 0x20, 0x23, 0x30, 0x30, 0x30, 0x3b, 0x20, 0x62,
305 - 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d,
306 - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62,
307 - 0x62, 0x30, 0x33, 0x34, 0x3b, 0x22, 0x3e, 0xa, 0x9, 0x9,
308 - 0x3c, 0x68, 0x31, 0x3e, 0x46, 0x6c, 0x61, 0x73, 0x68, 0x69,
309 - 0x6e, 0x67, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x9, 0x9,
310 - 0x54, 0x68, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d,
311 - 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x74, 0x72,
312 - 0x79, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x6c,
313 - 0x61, 0x73, 0x68, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68,
314 - 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x70,
315 - 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2c, 0x20, 0x74, 0x68,
316 - 0x65, 0x20, 0x6c, 0x65, 0x64, 0x73, 0x20, 0x77, 0x69, 0x6c,
317 - 0x6c, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x74, 0x6f,
318 - 0x20, 0x62, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0xa, 0xa, 0x9,
319 - 0x9, 0x41, 0x66, 0x74, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73,
320 - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x6c,
321 - 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68,
322 - 0x65, 0x20, 0x62, 0x6f, 0x78, 0x20, 0x77, 0x69, 0x6c, 0x6c,
323 - 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0xa, 0x9, 0x3c,
324 - 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68,
325 - 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
326 -
327 -const struct fsdata_file file_flashing_html[] = {{NULL, data_flashing_html, data_flashing_html + 15, sizeof(data_flashing_html) - 15}};
328 +static const char data_flashing_html[] =
329 +"HTTP/1.0 200 OK\n"
330 +"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
331 +"Content-type: text/html\n"
332 +"\n"
333 +"<html>\n"
334 +"\t<head>\n"
335 +"\t\t<title>\n"
336 +"\t\t\tFailsafe UI\n"
337 +"\t\t</title>\n"
338 +"\t</head>\n"
339 +"\t<body>\n"
340 +"\t\t<center><h1>Upgrading system...</h1></center>\n"
341 +"\t</body>\n"
342 +"</html>\n";
343 +
344 +static const char data_fail_html[] =
345 +"HTTP/1.0 200 OK\n"
346 +"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
347 +"Content-type: text/html\n"
348 +"\n"
349 +"<html>\n"
350 +"\t<head>\n"
351 +"\t\t<title>\n"
352 +"\t\t\tFailsafe UI\n"
353 +"\t\t</title>\n"
354 +"\t</head>\n"
355 +"\t<body>\n"
356 +"\t\t<h1>Flashing failed</h1>\n"
357 +"\t\tERROR - the image you uploaded failed to pass verification.<br>\n"
358 +"\t\tPlease make sure to use an official update provided by http://lantiq.com/\n"
359 +"\t</body>\n"
360 +"</html>\n";
361 +
362 +static const char data_404_html[] =
363 +"HTTP/1.0 404 File not found\n"
364 +"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
365 +"Content-type: text/html\n"
366 +"\n"
367 +"<html>\n"
368 +"\t<head>\n"
369 +"\t\t<title>\n"
370 +"\t\t\tFailsafe UI\n"
371 +"\t\t</title>\n"
372 +"\t</head>\n"
373 +"\t<body>\n"
374 +"\t\t<center><h1>404 - file not found</h1></center>\n"
375 +"\t</body>\n"
376 +"</html>\n";
377 +
378 +static const char data_index_html[] =
379 +"HTTP/1.0 200 OK\n"
380 +"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
381 +"Content-type: text/html\n"
382 +"\n"
383 +"<html>\n"
384 +"\t<head>\n"
385 +"\t\t<title>\n"
386 +"\t\t\tFailsafe UI\n"
387 +"\t\t</title>\n"
388 +"\t</head>\n"
389 +"\t<body>\n"
390 +"\t\t<h1>Failsafe UI</h1>\n"
391 +"\t\t<form method=\"post\" enctype=\"multipart/form-data\">\n"
392 +"\t\t\t<input type=file name=firmware>\n"
393 +"\t\t\t<input type=submit>\n"
394 +"\t\t</form>\n"
395 +"\t</body>\n"
396 +"</html>\n";
397 +
398 +static const char data_flash_html[] =
399 +"HTTP/1.0 200 OK\n"
400 +"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
401 +"Content-type: text/html\n"
402 +"\n"
403 +"<html>\n"
404 +"\t<head>\n"
405 +"\t\t<title>\n"
406 +"\t\t\tFailsafe UI\n"
407 +"\t\t</title>\n"
408 +"\t</head>\n"
409 +"\t<body>\n"
410 +"\t\t<h1>Flashing...</h1>\n"
411 +"\t\tThe system is now trying to flash. If there is a problem, the LEDs will "
412 +"start to blink.<br>\n"
413 +"\n"
414 +"\t\tAfter a successful update the box will reboot\n"
415 +"\t</body>\n"
416 +"</html>\n";
417 +
418 +const struct fsdata_file file_flashing_html[] =
419 +{{NULL, "/flashing.html", data_flashing_html, sizeof(data_flashing_html)}};
420 +
421 +const struct fsdata_file file_fail_html[] =
422 +{{file_flashing_html, "/fail.html", data_fail_html, sizeof(data_fail_html)}};
423
424 -const struct fsdata_file file_fail_html[] = {{file_flashing_html, data_fail_html, data_fail_html + 11, sizeof(data_fail_html) - 11}};
425 +const struct fsdata_file file_404_html[] =
426 +{{file_fail_html, "/404.html", data_404_html, sizeof(data_404_html)}};
427
428 -const struct fsdata_file file_404_html[] = {{file_fail_html, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};
429 +const struct fsdata_file file_index_html[] =
430 +{{file_404_html, "/index.html", data_index_html, sizeof(data_index_html)}};
431
432 -const struct fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};
433 -
434 -const struct fsdata_file file_flash_html[] = {{file_index_html, data_flash_html, data_flash_html + 12, sizeof(data_flash_html) - 12}};
435 +const struct fsdata_file file_flash_html[] =
436 +{{file_index_html, "/flash.html", data_flash_html, sizeof(data_flash_html)}};
437
438 #define FS_ROOT file_flash_html
439
440 -#define FS_NUMFILES 5
441 \ No newline at end of file
442 +#define FS_NUMFILES 5
443 --- a/net/uip-0.9/httpd.c
444 +++ b/net/uip-0.9/httpd.c
445 @@ -130,7 +130,7 @@ httpd_appcall(void)
446 if(!fs_open((const char *)&uip_appdata[4], &fsfile))
447 {
448 PRINTLN("couldn't open file");
449 - fs_open(file_index_html.name, &fsfile);
450 + fs_open(file_404_html.name, &fsfile);
451 }
452 }
453 hs->script = 0;
454 @@ -141,7 +141,7 @@ httpd_appcall(void)
455 if(hs->state == HTTP_FIRMWARE)
456 {
457 unsigned char *start = (unsigned char*)uip_appdata;
458 - char *clen = strstr(start, "Content-Length:");
459 + char *clen = strstr((char *)start, "Content-Length:");
460 int len = 0;
461 unsigned char *next, *end;
462 unsigned char *boundary_start;
463 @@ -150,14 +150,14 @@ httpd_appcall(void)
464 if(clen)
465 {
466 clen += sizeof("Content-Length:");
467 - next = strstr(clen, eol);
468 + next = (unsigned char *)strstr(clen, eol);
469 if(next)
470 {
471 len = atoi(clen);
472 next++;
473 printf("expecting %d bytes\n", len);
474 upload_data = httpd_upload_data = (unsigned char *)do_http_tmp_address();
475 - printf("received data will be stored at 0x%08X\n", upload_data);
476 + printf("received data will be stored at %p\n", upload_data);
477 if(!upload_data)
478 {
479 printf("failed to allocate memory\n");
480 @@ -174,14 +174,14 @@ httpd_appcall(void)
481 uip_close();
482 return;
483 }
484 - boundary_start = strstr(next, "---");
485 + boundary_start = (unsigned char *)strstr((char *)next, "---");
486 if(!boundary_start)
487 {
488 uip_close();
489 return;
490 }
491 - end = strstr(boundary_start, eol);
492 - if(!eol)
493 + end = (unsigned char *)strstr((char *)boundary_start, eol);
494 + if(!end)
495 {
496 uip_close();
497 return;
498 @@ -189,13 +189,13 @@ httpd_appcall(void)
499 boundary_len = end - boundary_start;
500 memcpy(boundary, boundary_start, boundary_len);
501 boundary[boundary_len] = 0;
502 - next = strstr(boundary_start, "name=\"firmware\";");
503 + next = (unsigned char *)strstr((char *)boundary_start, "name=\"firmware\";");
504 if(!next)
505 {
506 uip_close();
507 return;
508 }
509 - next = strstr(next, eol2);
510 + next = (unsigned char *)strstr((char *)next, eol2);
511 if(!next)
512 {
513 printf("could not find start of data\n");
514 @@ -259,7 +259,6 @@ httpd_appcall(void)
515 {
516 if(upload_running)
517 {
518 - int i;
519 httpd_upload_complete = 1;
520 // for(i = 0; i < hs->upload_total; i++)
521 // printf("%c", httpd_upload_data[i]);
522 @@ -267,7 +266,7 @@ httpd_appcall(void)
523 uip_close();
524 }
525 }
526 - uip_send(hs->dataptr, hs->count);
527 + uip_send((unsigned char *)hs->dataptr, hs->count);
528 }
529 break;
530
This page took 0.067289 seconds and 5 git commands to generate.