Changeset 11165


Ignore:
Timestamp:
12/11/08 00:54:45 (4 years ago)
Author:
BrainSlayer
Message:

compex wp54, wp54g, wp54ag, wpp54g, wpp54ag support

Location:
src/router
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/Makefile

    r11096 r11165  
    495495CFLAGS += -DHAVE_STORM 
    496496endif 
     497ifeq ($(CONFIG_WP54G),y) 
     498CFLAGS += -DHAVE_WP54G 
     499endif 
    497500ifeq ($(CONFIG_ADM5120),y) 
    498501CFLAGS += -DHAVE_ADM5120 
  • src/router/httpd/modules/callvalidate.c

    r10750 r11165  
    6161// #include <shutils.h> 
    6262 
    63 #ifdef HAVE_ADM5120 
     63#if defined(HAVE_ADM5120) && !defined(HAVE_WP54G) 
    6464#define SERVICE_MODULE "/lib/validate.so" 
    6565#define VISSERVICE_MODULE "/lib/visuals.so" 
  • src/router/libutils/Makefile

    r11160 r11165  
    195195  CFLAGS += -DHAVE_PS5 
    196196endif 
     197ifeq ($(CONFIG_WP54G),y) 
     198  CFLAGS += -DHAVE_WP54G 
     199endif 
    197200ifeq ($(CONFIG_ADM5120),y) 
    198201  CFLAGS += -DHAVE_ADM5120 
  • src/router/libutils/gpio.c

    r10775 r11165  
    1919#include <errno.h> 
    2020 
    21 #if  defined(HAVE_AR531X) || defined(HAVE_LSX) || defined(HAVE_DANUBE) 
     21#if  defined(HAVE_AR531X) || defined(HAVE_LSX) || defined(HAVE_DANUBE) || defined(HAVE_ADM5120) 
    2222 
    2323void set_gpio( int gpio, int value ) 
  • src/router/libutils/utils.c

    r11160 r11165  
    462462return 0; 
    463463#else 
    464 #ifdef HAVE_ADM5120 
     464#ifdef HAVE_WP54G 
     465    setRouter( "Compex WP54G" ); 
     466    return ROUTER_BOARD_WP54G; 
     467#elif HAVE_ADM5120 
    465468    setRouter( "Tonze AP-120" ); 
    466469    return ROUTER_BOARD_ADM5120; 
     
    25552558            connected_gpio = 0x10; 
    25562559            break; 
     2560        case ROUTER_BOARD_WP54G: 
     2561            diag_gpio = 0x12; 
     2562            connected_gpio = 0x17; 
     2563            break; 
    25572564        case ROUTER_BOARD_GATEWORX: 
    25582565            connected_gpio = 0x3; 
  • src/router/rc/Makefile

    r11137 r11165  
    240240ifeq ($(CONFIG_ADM5120),y) 
    241241CFLAGS += -DHAVE_ADM5120 
     242endif 
     243ifeq ($(CONFIG_WP54G),y) 
     244CFLAGS += -DHAVE_WP54G 
    242245endif 
    243246ifeq ($(CONFIG_TW6600),y) 
  • src/router/rc/resetbutton.c

    r11157 r11165  
    9494#endif 
    9595 
    96 #if defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) 
     96#if defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) || defined(HAVE_WP54G) 
    9797int getbuttonstate(  ) 
    9898{ 
     
    100100    int ret = get_gpio( 5 ); 
    101101    return 1-ret; 
     102#elif HAVE_WP54G 
     103    int ret = get_gpio( 4 ); 
     104    return ret; 
    102105#else 
    103106    int ret = get_gpio( 6 ); 
     
    111114    int ret = get_gpio( 8 ); 
    112115 
    113     /*  
    114      * in = fopen ("/proc/simple_config/push_button", "rb"); if (in == NULL) 
    115      * return 0; fscanf (in, "%d", &ret); fclose (in); 
    116      */ 
     116 
    117117    if( ret == 0 ) 
    118118        return 1; 
     
    342342    // DEBUG("resetbutton: now time=%d\n", t); 
    343343 
    344 #if defined(HAVE_MAGICBOX) || defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_GATEWORX) || defined(HAVE_STORM) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) || defined(HAVE_LSX) 
     344#if defined(HAVE_MAGICBOX) || defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_GATEWORX) || defined(HAVE_STORM) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) || defined(HAVE_LSX) || defined(HAVE_WP54G) 
    345345    val = getbuttonstate(  ); 
    346346#ifdef HAVE_WRK54G 
     
    395395    int state = 0; 
    396396 
    397 #if defined(HAVE_XSCALE) || defined(HAVE_MAGICBOX) || defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_GATEWORX) || defined(HAVE_STORM) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) || defined(HAVE_LSX) 
     397#if defined(HAVE_XSCALE) || defined(HAVE_MAGICBOX) || defined(HAVE_FONERA) || defined(HAVE_WHRAG108) || defined(HAVE_GATEWORX) || defined(HAVE_STORM) || defined(HAVE_LS2) || defined(HAVE_CA8) || defined(HAVE_TW6600)  || defined(HAVE_LS5) || defined(HAVE_LSX) || defined(HAVE_WP54G) 
    398398    state = val; 
    399399#else 
     
    570570        } 
    571571    } 
    572 #if !defined(HAVE_XSCALE) && !defined(HAVE_MAGICBOX) && !defined(HAVE_FONERA) && !defined(HAVE_WHRAG108) && !defined(HAVE_GATEWORX) && !defined(HAVE_STORM) && !defined(HAVE_LS2) && !defined(HAVE_CA8) && !defined(HAVE_TW6600) && !defined(HAVE_LS5) && !defined(HAVE_LSX) 
     572#if !defined(HAVE_XSCALE) && !defined(HAVE_MAGICBOX) && !defined(HAVE_FONERA) && !defined(HAVE_WHRAG108) && !defined(HAVE_GATEWORX) && !defined(HAVE_STORM) && !defined(HAVE_LS2) && !defined(HAVE_CA8) && !defined(HAVE_TW6600) && !defined(HAVE_LS5) && !defined(HAVE_LSX) && !defined(HAVE_WP54G) 
    573573 
    574574    else if( ( sesgpio != 0xff ) 
  • src/router/services/Makefile

    r11158 r11165  
    411411CFLAGS += -DHAVE_ADM5120 
    412412endif 
     413ifeq ($(CONFIG_WP54G),y) 
     414CFLAGS += -DHAVE_WP54G 
     415endif 
    413416ifeq ($(CONFIG_TW6600),y) 
    414417CFLAGS += -DHAVE_TW6600 
  • src/router/services/networking/interface.c

    r11003 r11165  
    557557              nvram_safe_get( "wan_ifnames" ) ); 
    558558#elif HAVE_ADM5120 
    559     snprintf( all_ifnames, 255, "%s %s %s", "eth0", 
     559    snprintf( all_ifnames, 255, "%s %s %s", "eth0 eth1", 
    560560              nvram_safe_get( "lan_ifnames" ), 
    561561              nvram_safe_get( "wan_ifnames" ) ); 
  • src/router/services/networking/network.c

    r11161 r11165  
    997997#endif 
    998998#ifdef HAVE_ADM5120 
     999 
     1000if (getRouterBrand() == ROUTER_BOARD_WP54G) 
     1001{ 
     1002    if( getSTA(  ) || getWET(  ) || nvram_match( "wan_proto", "disabled" ) ) 
     1003    { 
     1004        nvram_set( "lan_ifname", "br0" ); 
     1005        nvram_set( "lan_ifnames", "eth0 eth1 ath0" ); 
     1006        PORTSETUPWAN( "" ); 
     1007    } 
     1008    else 
     1009    { 
     1010        nvram_set( "lan_ifname", "br0" ); 
     1011        nvram_set( "lan_ifnames", "eth0 eth1 ath0" ); 
     1012        PORTSETUPWAN( "eth0" ); 
     1013    } 
     1014}else 
     1015{ 
     1016 
    9991017    if( getSTA(  ) || getWET(  ) || nvram_match( "wan_proto", "disabled" ) ) 
    10001018    { 
     
    10091027        PORTSETUPWAN( "eth0" ); 
    10101028    } 
     1029} 
     1030 
    10111031    strncpy( ifr.ifr_name, "eth0", IFNAMSIZ ); 
    10121032    ioctl( s, SIOCGIFHWADDR, &ifr ); 
     
    28372857        fp = fopen( "/tmp/ppp/options.pppoe", "w" ); 
    28382858        // rp-pppoe kernelmode plugin 
    2839 #ifdef HAVE_ADM5120 
     2859#if defined(HAVE_ADM5120) && !defined(HAVE_WP54G) 
    28402860        fprintf( fp, "plugin /lib/rp-pppoe.so" ); 
    28412861#else 
  • src/router/services/networking/wshaper.c

    r11158 r11165  
    693693#elif HAVE_ADM5120 
    694694    ret = eval( script_name, "stop", "XX", "eth0" ); 
     695    ret = eval( script_name, "stop", "XX", "eth1" ); 
    695696    ret = eval( script_name, "stop", "XX", "ath0" ); 
    696697#elif HAVE_TW6600 
  • src/router/services/sysinit/defaults.c

    r11154 r11165  
    281281#elif HAVE_STORM 
    282282    {"wan_proto", "disabled", 0},       /* [static|dhcp|pppoe|disabled] */ 
     283#elif HAVE_WP54G 
     284    {"wan_proto", "dhcp", 0},   /* [static|dhcp|pppoe|disabled] */ 
    283285#elif HAVE_ADM5120 
    284286    {"wan_proto", "disabled", 0},       /* [static|dhcp|pppoe|disabled] */ 
  • src/router/services/sysinit/sysinit-adm5120.c

    r10736 r11165  
    6767return value; 
    6868} 
     69struct mylo_eth_addr { 
     70        uint8_t mac[6]; 
     71        uint8_t csum[2]; 
     72}; 
     73 
     74struct mylo_board_params { 
     75        uint32_t        magic;  /* must be MYLO_MAGIC_BOARD_PARAMS */ 
     76        uint32_t        res0; 
     77        uint32_t        res1; 
     78        uint32_t        res2; 
     79        struct mylo_eth_addr addr[8]; 
     80}; 
    6981 
    7082void start_change_mac(void) 
     
    174186     * load some netfilter stuff  
    175187     */ 
    176  
     188#ifndef HAVE_WP54G 
    177189    insmod( "nf_conntrack_ftp" ); 
    178190    insmod( "nf_conntrack_irc" ); 
     
    222234    insmod( "pppox" ); 
    223235    insmod( "pppoe" ); 
    224  
     236#endif 
    225237    insmod( "adm5120_wdt" ); 
    226238    insmod( "adm5120sw" ); 
     239 
     240if (getRouterBrand() != ROUTER_BOARD_WP54G) 
     241{ 
     242 
    227243    unsigned char mac[6]; 
    228244    char eabuf[32]; 
     
    324340        fclose( fp ); 
    325341    } 
     342}else 
     343{ 
     344struct mylo_board_params params; 
     345    char mtdpath[32]; 
     346    FILE *fp; 
     347    int mtd = getMTD( "boot" ); 
     348    int foundmac = 0; 
     349    struct ifreq ifr; 
     350    int s; 
     351    char eabuf[32]; 
     352 
     353    sprintf( mtdpath, "/dev/mtdblock/%d", mtd ); 
     354    fp = fopen( mtdpath, "rb" ); 
     355    if( fp != NULL ) 
     356        { 
     357        fseek(fp,0xf800,SEEK_SET); 
     358        fread(&params,sizeof(params),1,fp); 
     359        fclose(fp); 
     360        if (params.magic == 0x20021103) 
     361            { 
     362            fprintf(stderr,"Found compex board magic!\n"); 
     363            if( ( s = socket( AF_INET, SOCK_RAW, IPPROTO_RAW ) ) ) 
     364            { 
     365                strncpy( ifr.ifr_name, "eth0", IFNAMSIZ ); 
     366                ioctl( s, SIOCGIFHWADDR, &ifr ); 
     367                memcpy( ( unsigned char * )ifr.ifr_hwaddr.sa_data, params.addr[0].mac, 6 ); 
     368                ioctl( s, SIOCSIFHWADDR, &ifr ); 
     369                close( s ); 
     370            } 
     371            if( ( s = socket( AF_INET, SOCK_RAW, IPPROTO_RAW ) ) ) 
     372            { 
     373                strncpy( ifr.ifr_name, "eth1", IFNAMSIZ ); 
     374                ioctl( s, SIOCGIFHWADDR, &ifr ); 
     375                memcpy( ( unsigned char * )ifr.ifr_hwaddr.sa_data, params.addr[1].mac, 6 ); 
     376                ioctl( s, SIOCSIFHWADDR, &ifr ); 
     377                close( s ); 
     378            } 
     379            if( ( s = socket( AF_INET, SOCK_RAW, IPPROTO_RAW ) ) ) 
     380            { 
     381                strncpy( ifr.ifr_name, "eth0", IFNAMSIZ ); 
     382                ioctl( s, SIOCGIFHWADDR, &ifr ); 
     383                nvram_set( "et0macaddr_safe", 
     384                           ether_etoa( ( unsigned char * )ifr.ifr_hwaddr. 
     385                                       sa_data, eabuf ) ); 
     386                close( s ); 
     387            } 
     388             
     389            } 
     390        } 
     391} 
    326392    /* 
    327393     * network drivers  
     
    355421{ 
    356422} 
    357 void enable_dtag_vlan( int enable ) 
    358 { 
    359  
    360 } 
     423 
     424char *enable_dtag_vlan( int enable ) 
     425{ 
     426    return "eth2"; 
     427} 
  • src/router/services/sysinit/sysinit-rt2880.c

    r11158 r11165  
    11/* 
    2  * sysinit-adm5120.c 
     2 * sysinit-rt2880.c 
    33 * 
    44 * Copyright (C) 2008 Sebastian Gottschall <gottschall@dd-wrt.com> 
  • src/router/services/sysinit/sysinit.c

    r11162 r11165  
    395395        {"wan_ifnames", "", 0}, 
    396396        {"wan_default", "", 0}, 
     397        {0, 0, 0} 
     398    }; 
     399#elif HAVE_WP54G 
     400    struct nvram_tuple generic[] = { 
     401        {"lan_ifname", "br0", 0}, 
     402        {"lan_ifnames", "eth1 ath0", 0}, 
     403        {"wan_ifname", "eth0", 0}, 
     404        {"wan_ifname2", "eth0", 0}, 
     405        {"wan_ifnames", "eth0", 0}, 
     406        {"wan_default", "eth0", 0}, 
    397407        {0, 0, 0} 
    398408    }; 
  • src/router/shared/utils.h

    r11160 r11165  
    378378#define ROUTER_BOARD_ECB9750 0x6906 
    379379 
    380  
     380// Compex WP54G (and compatible) 
     381#define ROUTER_BOARD_WP54G 0x7004 
    381382 
    382383#define NVROUTER "DD_BOARD" 
Note: See TracChangeset for help on using the changeset viewer.