Changeset 9301
- Timestamp:
- 03/12/08 14:04:09 (5 years ago)
- Location:
- src/router/services/sysinit
- Files:
-
- 2 edited
-
switchlib/admtek.c (modified) (2 diffs)
-
sysinit-dir300.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/router/services/sysinit/switchlib/admtek.c
r9263 r9301 46 46 #include <net/if.h> 47 47 48 #include <arpa/inet.h> 49 #include <sys/socket.h> 50 #include <linux/sockios.h> 51 #include <linux/mii.h> 52 48 53 #define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ 49 54 #define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ … … 54 59 #include <cymac.h> 55 60 56 #include <arpa/inet.h>57 #include <sys/socket.h>58 #include <linux/if.h>59 #include <linux/sockios.h>60 #include <linux/mii.h>61 61 62 62 -
src/router/services/sysinit/sysinit-dir300.c
r9282 r9301 55 55 #include <shutils.h> 56 56 #include <utils.h> 57 #include <cymac.h> 57 58 58 59 extern void vlan_init (int num); … … 100 101 101 102 #ifndef HAVE_DIR400 102 FILE *fp = fopen (getMTD ("board_config"), "rb"); 103 int mtd = getMTD ("board_config"); 104 char mtdpath[64]; 105 sprintf(mtdpath,"/dev/mtdblock/%d",mtd); 106 FILE *fp = fopen (mtdpath, "rb"); 103 107 if (fp) 104 108 { … … 106 110 unsigned int test; 107 111 fread (&test, 4, 1, fp); 112 fprintf(stderr,"test pattern is %X\n",test); 108 113 if (test != 0xffffffff) 109 114 { … … 196 201 197 202 } 203 204 void start_fixboard(void) 205 { 206 int mtd = getMTD ("board_config"); 207 char mtdpath[64]; 208 sprintf(mtdpath,"/dev/mtdblock/%d",mtd); 209 fprintf(stderr,"board config path = %s\n",mtdpath); 210 FILE *fp = fopen (mtdpath, "rb"); 211 if (fp) 212 { 213 fseek (fp, 0x1000, SEEK_SET); 214 unsigned int test; 215 fread (&test, 4, 1, fp); 216 fprintf(stderr,"test pattern is %X\n",test); 217 if (test != 0xffffffff) 218 { 219 fprintf (stderr, 220 "radio config fixup is required to clean bad stuff out of memory, otherwise the radio config cannot be detected\n"); 221 fseek (fp, 0, SEEK_SET); 222 char *block = (char *) malloc (65536); 223 fread (block, 65536, 1, fp); 224 fclose (fp); 225 int i; 226 for (i = 0x1000; i < 65536; i++) 227 block[i] = 0xff; 228 fp = fopen ("/tmp/radio", "wb"); 229 fwrite (block, 65536, 1, fp); 230 eval ("mtd", "-f", "write", "/tmp/radio", "board_config"); //writes back new config and reboots 231 eval ("event", "5", "1", "15"); 232 } 233 fclose (fp); 234 } 235 236 237 }
Note: See TracChangeset
for help on using the changeset viewer.
