Changeset 35596


Ignore:
Timestamp:
2013-02-14T13:36:52+01:00 (5 years ago)
Author:
hauke
Message:

switch: export name of device found via /proc

Location:
trunk/package/switch/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/switch/src/switch-adm.c

    r34992 r35596  
    579579                vlan_handlers: vlan, 
    580580        }; 
     581        snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, DRIVER_NAME); 
    581582 
    582583        if (!detect_adm()) 
  • trunk/package/switch/src/switch-core.c

    r35595 r35596  
    157157} 
    158158 
     159static int handle_driver_dev_name(void *driver, char *buf, int nr) 
     160{ 
     161        char *dev_name = ((switch_driver *) driver)->dev_name; 
     162        return sprintf(buf, "%s\n", dev_name); 
     163} 
     164 
    159165static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr) 
    160166{ 
     
    243249        {"ports", handle_driver_ports, NULL}, 
    244250        {"vlans", handle_driver_vlans, NULL}, 
     251        {"dev_name", handle_driver_dev_name, NULL}, 
    245252        {NULL, NULL, NULL} 
    246253}; 
  • trunk/package/switch/src/switch-core.h

    r34992 r35596  
    55#include <linux/list.h> 
    66#define SWITCH_MAX_BUFSZ        4096 
     7#define SWITCH_NAME_BUFSZ       16 
    78 
    89#define SWITCH_MEDIA_AUTO       1 
     
    2930        void *data; 
    3031        void *priv; 
     32        char dev_name[SWITCH_NAME_BUFSZ]; 
    3133} switch_driver; 
    3234 
  • trunk/package/switch/src/switch-robo.c

    r35586 r35596  
    44 * Copyright (C) 2005 Felix Fietkau <nbd@nbd.name> 
    55 * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de> 
     6 * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de> 
    67 * Based on 'robocfg' by Oleg I. Vdovikin 
    78 * 
     
    4142 
    4243#define DRIVER_NAME             "bcm53xx" 
    43 #define DRIVER_VERSION          "0.02" 
     44#define DRIVER_VERSION          "0.03" 
    4445#define PFX                     "roboswitch: " 
    4546 
     
    863864                        driver.cpuport = 8; 
    864865                } 
     866                if (robo.is_5365) 
     867                        snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, "BCM5365"); 
     868                else 
     869                        snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, "BCM5%s%x", robo.devid & 0xff00 ? "" : "3", robo.devid); 
    865870 
    866871                return switch_register_driver(&driver); 
Note: See TracChangeset for help on using the changeset viewer.