diff --git a/dmtree/tr181/deviceinfo-iopsyswrt.c b/dmtree/tr181/deviceinfo-iopsyswrt.c index 87a6f423..fc011b5d 100644 --- a/dmtree/tr181/deviceinfo-iopsyswrt.c +++ b/dmtree/tr181/deviceinfo-iopsyswrt.c @@ -44,6 +44,12 @@ int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data return 0; } +int os__get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("hw", "board", "model_name", value); + return 0; +} + char * os__get_deviceid_manufactureroui() { char *v, *mac = NULL, str[16]; diff --git a/dmtree/tr181/deviceinfo-openwrt.c b/dmtree/tr181/deviceinfo-openwrt.c index e53ff02e..585d87d2 100644 --- a/dmtree/tr181/deviceinfo-openwrt.c +++ b/dmtree/tr181/deviceinfo-openwrt.c @@ -38,6 +38,12 @@ int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data return 0; } +int os__get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("ModelName"); + return 0; +} + char * os__get_deviceid_manufactureroui() { return get_uci_deviceinfo("ManufacturerOUI"); diff --git a/dmtree/tr181/deviceinfo.c b/dmtree/tr181/deviceinfo.c index d7b5625b..aeb9ae13 100644 --- a/dmtree/tr181/deviceinfo.c +++ b/dmtree/tr181/deviceinfo.c @@ -82,12 +82,6 @@ static int get_device_softwareversion(char *refparam, struct dmctx *ctx, void *d return 0; } -static int get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("hw", "board", "model_name", value); - return 0; -} - static int get_device_info_uptime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { FILE *fp = NULL; @@ -371,7 +365,7 @@ DMLEAF tDeviceInfoParams[] = { /* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ {"Manufacturer", &DMREAD, DMT_STRING, get_device_manufacturer, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, {"ManufacturerOUI", &DMREAD, DMT_STRING, get_device_manufactureroui, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, -{"ModelName", &DMREAD, DMT_STRING, get_device_routermodel, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, +{"ModelName", &DMREAD, DMT_STRING, os__get_device_routermodel, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, {"ProductClass", &DMREAD, DMT_STRING, get_device_productclass, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, {"SerialNumber", &DMREAD, DMT_STRING, get_device_serialnumber, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, {"HardwareVersion", &DMREAD, DMT_STRING, os__get_device_hardwareversion, NULL, &DMFINFRM, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/os.h b/dmtree/tr181/os.h index 12fe8168..31fdf014 100644 --- a/dmtree/tr181/os.h +++ b/dmtree/tr181/os.h @@ -12,6 +12,7 @@ char * os__get_softwareversion(); char * os__get_deviceid_manufactureroui(); int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int os__get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int os__get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int os__get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);