mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 10:39:04 +00:00
switch: export name of device found via /proc
SVN-Revision: 35596
This commit is contained in:
parent
60913bbac6
commit
243c582213
@ -578,6 +578,7 @@ static int __init adm_init(void)
|
|||||||
port_handlers: port,
|
port_handlers: port,
|
||||||
vlan_handlers: vlan,
|
vlan_handlers: vlan,
|
||||||
};
|
};
|
||||||
|
snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, DRIVER_NAME);
|
||||||
|
|
||||||
if (!detect_adm())
|
if (!detect_adm())
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -156,6 +156,12 @@ static int handle_driver_vlans(void *driver, char *buf, int nr)
|
|||||||
return sprintf(buf, "%i\n", vlans);
|
return sprintf(buf, "%i\n", vlans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int handle_driver_dev_name(void *driver, char *buf, int nr)
|
||||||
|
{
|
||||||
|
char *dev_name = ((switch_driver *) driver)->dev_name;
|
||||||
|
return sprintf(buf, "%s\n", dev_name);
|
||||||
|
}
|
||||||
|
|
||||||
static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr)
|
static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr)
|
||||||
{
|
{
|
||||||
switch_priv *priv = (switch_priv *) driver->data;
|
switch_priv *priv = (switch_priv *) driver->data;
|
||||||
@ -242,6 +248,7 @@ switch_config global_driver_handlers[] = {
|
|||||||
{"cpuport", handle_driver_cpuport, NULL},
|
{"cpuport", handle_driver_cpuport, NULL},
|
||||||
{"ports", handle_driver_ports, NULL},
|
{"ports", handle_driver_ports, NULL},
|
||||||
{"vlans", handle_driver_vlans, NULL},
|
{"vlans", handle_driver_vlans, NULL},
|
||||||
|
{"dev_name", handle_driver_dev_name, NULL},
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#define SWITCH_MAX_BUFSZ 4096
|
#define SWITCH_MAX_BUFSZ 4096
|
||||||
|
#define SWITCH_NAME_BUFSZ 16
|
||||||
|
|
||||||
#define SWITCH_MEDIA_AUTO 1
|
#define SWITCH_MEDIA_AUTO 1
|
||||||
#define SWITCH_MEDIA_100 2
|
#define SWITCH_MEDIA_100 2
|
||||||
@ -28,6 +29,7 @@ typedef struct {
|
|||||||
const switch_config *driver_handlers, *port_handlers, *vlan_handlers;
|
const switch_config *driver_handlers, *port_handlers, *vlan_handlers;
|
||||||
void *data;
|
void *data;
|
||||||
void *priv;
|
void *priv;
|
||||||
|
char dev_name[SWITCH_NAME_BUFSZ];
|
||||||
} switch_driver;
|
} switch_driver;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2005 Felix Fietkau <nbd@nbd.name>
|
* Copyright (C) 2005 Felix Fietkau <nbd@nbd.name>
|
||||||
* Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
|
* Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
|
||||||
|
* Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
|
||||||
* Based on 'robocfg' by Oleg I. Vdovikin
|
* Based on 'robocfg' by Oleg I. Vdovikin
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
@ -40,7 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DRIVER_NAME "bcm53xx"
|
#define DRIVER_NAME "bcm53xx"
|
||||||
#define DRIVER_VERSION "0.02"
|
#define DRIVER_VERSION "0.03"
|
||||||
#define PFX "roboswitch: "
|
#define PFX "roboswitch: "
|
||||||
|
|
||||||
#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */
|
#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */
|
||||||
@ -862,6 +863,10 @@ static int __init robo_init(void)
|
|||||||
driver.ports = 9;
|
driver.ports = 9;
|
||||||
driver.cpuport = 8;
|
driver.cpuport = 8;
|
||||||
}
|
}
|
||||||
|
if (robo.is_5365)
|
||||||
|
snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, "BCM5365");
|
||||||
|
else
|
||||||
|
snprintf(driver.dev_name, SWITCH_NAME_BUFSZ, "BCM5%s%x", robo.devid & 0xff00 ? "" : "3", robo.devid);
|
||||||
|
|
||||||
return switch_register_driver(&driver);
|
return switch_register_driver(&driver);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user