freecwmp
[Top] [All Lists]

ubus data model patch [05/27]

To: freecwmp@linux-mips.org, freecwmp@lukaperkov.net
Subject: ubus data model patch [05/27]
From: KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 06 Dec 2012 14:38:51 +0100
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0
Hi Luka

  ubus data model patch [05/27] enclosed

Regards
MOHAMED Kallel

------------------------ubus data model patch [05/27] ---------------------------------


>From b61d8e55d0ef3de480a78fa088b126d5b38db152 Mon Sep 17 00:00:00 2001
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Sat, 1 Dec 2012 21:01:31 +0100
Subject: [PATCH 05/27] Update device_info script to support communicte data of get parameter values to the core via ubus
   Contributed by Inteno Broadband Technology AB


Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
---
ext/openwrt/scripts/functions/device_info | 32 +++++++++++++++++++---------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/ext/openwrt/scripts/functions/device_info b/ext/openwrt/scripts/functions/device_info
index 4423b8b..86ff5c9 100644
--- a/ext/openwrt/scripts/functions/device_info
+++ b/ext/openwrt/scripts/functions/device_info
@@ -3,7 +3,7 @@

 get_device_info_manufacturer() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].manufacturer 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.Manufacturer" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.Manufacturer" "$val"
 }

 set_device_info_manufacturer() {
@@ -12,7 +12,7 @@ set_device_info_manufacturer() {

 get_device_info_oui() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].oui 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.ManufacturerOUI" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.ManufacturerOUI" "$val"
 }

 set_device_info_oui() {
@@ -21,7 +21,7 @@ set_device_info_oui() {

 get_device_info_product_class() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].product_class 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.ProductClass" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.ProductClass" "$val"
 }

 set_device_info_product_class() {
@@ -30,7 +30,7 @@ set_device_info_product_class() {

 get_device_info_serial_number() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].serial_number 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.SerialNumber" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.SerialNumber" "$val"
 }

 set_device_info_serial_number() {
@@ -39,7 +39,7 @@ set_device_info_serial_number() {

 get_device_info_hardware_version() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].hardware_version 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.HardwareVersion" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.HardwareVersion" "$val"
 }

 set_device_info_hardware_version() {
@@ -48,7 +48,7 @@ set_device_info_hardware_version() {

 get_device_info_software_version() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get freecwmp.@device[0].software_version 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val"
 }

 set_device_info_software_version() {
@@ -57,7 +57,7 @@ set_device_info_software_version() {

 get_device_info_uptime() {
 local val=`cat /proc/uptime | awk -F "." '{ print $1 }'`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val"
 }

 get_device_info_device_log() {
@@ -67,7 +67,7 @@ if [ ${FLAGS_last} -eq ${FLAGS_TRUE} ]; then
 else
     val=`dmesg | tail -n10`
 fi
-freecwmp_output "InternetGatewayDevice.DeviceInfo.DeviceLog" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.DeviceInfo.DeviceLog" "$val"
 }

 get_device_info() {
@@ -81,6 +81,7 @@ case "$1" in
     get_device_info_software_version
     get_device_info_uptime
     get_device_info_device_log
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.)
     get_device_info_manufacturer
@@ -91,32 +92,42 @@ case "$1" in
     get_device_info_software_version
     get_device_info_uptime
     get_device_info_device_log
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.Manufacturer)
     get_device_info_manufacturer
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.ManufacturerOUI)
     get_device_info_oui
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.ProductClass)
     get_device_info_product_class
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.SerialNumber)
     get_device_info_serial_number
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.HardwareVersion)
     get_device_info_hardware_version
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.SoftwareVersion)
     get_device_info_software_version
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.UpTime)
     get_device_info_uptime
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.DeviceInfo.DeviceLog)
     get_device_info_device_log
+    return $FAULT_CPE_NO_FAULT
     ;;
 esac
+return $FAULT_CPE_INVALID_PARAMETER_NAME
 }

 set_device_info() {
@@ -161,10 +172,11 @@ return 1
 }

 get_device_info_generic() {
- check_parameter_device_info_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1 ]; then return 0; fi + check_parameter_device_info_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1 ]; then return $FAULT_CPE_INVALID_PARAMETER_NAME; fi

     freecwmp_get_parameter_value "val" "$1"
-    freecwmp_value_output "$1" "$val"
+    ubus_freecwmp_output "$1" "$val"
+    return $FAULT_CPE_NO_FAULT
 }

 set_device_info_generic() {
--
1.7.4.1



<Prev in Thread] Current Thread [Next in Thread>
  • ubus data model patch [05/27], KALLEL Mohamed <=