Ignore:
Timestamp:
12/23/09 20:47:05 (3 years ago)
Author:
BrainSlayer
Message:

generic detection method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/sysinit/sysinit-gateworx.c

    r13496 r13509  
    5151#include <linux/sockios.h> 
    5252#include <linux/mii.h> 
    53  
    54 static int detect(char *devicename) 
    55 { 
    56         char devcall[128]; 
    57         int res; 
    58  
    59         sprintf(devcall, "/sbin/lspci|/bin/grep \"%s\"|/bin/wc -l", devicename); 
    60         FILE *in = popen(devcall, "rb"); 
    61  
    62         fscanf(in, "%d", &res); 
    63         pclose(in); 
    64         return res > 0 ? 1 : 0; 
    65 } 
     53#include "devices/ethernet.c" 
     54 
    6655 
    6756#ifndef HAVE_TONZE 
     
    221210        fprintf(stderr, "try modules for ethernet adapters\n"); 
    222211        nvram_set("intel_eth", "0"); 
    223         if (detect("82541"))    // Intel Gigabit 
    224         { 
    225                 nvram_set("intel_eth", "1"); 
    226                 insmod("e1000"); 
    227         } 
    228         if (detect("8139"))     // Intel Gigabit 
    229         { 
    230                 nvram_set("intel_eth", "1"); 
    231                 insmod("8139too"); 
    232         } else if (detect("8139"))      // Realtek 8139 Adapter (various notebooks)  
    233         { 
    234                 nvram_set("intel_eth", "1"); 
    235                 insmod("8139too"); 
    236         } else if (detect("DFE-690TXD"))        // Realtek 8139 Adapter (various 
    237         { 
    238                 // notebooks)  
    239                 nvram_set("intel_eth", "1"); 
    240                 insmod("8139too"); 
    241         } else if (detect("SMC2-1211TX"))       // Realtek 8139 Adapter (various 
    242         {                       // notebooks)  
    243                 nvram_set("intel_eth", "1"); 
    244                 insmod("8139too"); 
    245         } else if (detect("Robotics"))  // Realtek 8139 Adapter (various 
    246         {                       // notebooks)  
    247                 nvram_set("intel_eth", "1"); 
    248                 insmod("8139too"); 
    249         } 
     212        if (detect_ethernet_devices()) 
     213            nvram_set("intel_eth","1"); 
    250214#ifndef HAVE_NOWIFI 
    251215        fprintf(stderr, "load HAL Driver\n"); 
Note: See TracChangeset for help on using the changeset viewer.