freecwmp
[Top] [All Lists]

Re: [PATCH 17/27] update the script lan_device in order to output parame

To: mohamed.kallel@pivasoftware.com
Subject: Re: [PATCH 17/27] update the script lan_device in order to output parameters with ubus Contributed by Inteno Broadband Technology AB
From: Luka Perkov <freecwmp@lukaperkov.net>
Date: Sat, 8 Dec 2012 11:52:13 +0100
Cc: freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, freecwmp@lukaperkov.net, jogo@openwrt.org
In-reply-to: <1354809292-2467-18-git-send-email-mohamed.kallel@pivasoftware.com>
Mail-followup-to: mohamed.kallel@pivasoftware.com, freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, jogo@openwrt.org
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <mohamed.kallel@pivasoftware.com> <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com> <1354809292-2467-18-git-send-email-mohamed.kallel@pivasoftware.com>
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Dec 06, 2012 at 04:54:42PM +0100, Mohamed wrote:
> 
> Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
> Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>

NACK, at least for now. Look at the comments in patch 16.

> ---
>  ext/openwrt/scripts/functions/lan_device |   98 ++++++++++++++++++++++++++++-
>  1 files changed, 94 insertions(+), 4 deletions(-)
> 
> diff --git a/ext/openwrt/scripts/functions/lan_device 
> b/ext/openwrt/scripts/functions/lan_device
> index fa9dda4..712b5e8 100644
> --- a/ext/openwrt/scripts/functions/lan_device
> +++ b/ext/openwrt/scripts/functions/lan_device
> @@ -4,7 +4,10 @@
>  get_wlan_enable() {
>  local num="$1"
>  local type="xsd:boolean"
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
> wireless.@wifi-device[$num].disabled 2> /dev/null`
> +local val=""
> +case "$action" in
> +     get_value)
> +     val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
> wireless.@wifi-device[$num].disabled 2> /dev/null`
>  let num=$num+1
>  if [ "$val" = "1" ]; then
>       val="0"
> @@ -12,6 +15,13 @@ else
>       val="1"
>  fi
>  ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" 
> "$type"
> +     ;;
> +     get_name)
> +     val="1"
> +     let num=$num+1
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val"
> +     ;;
> +esac
>  }
>  
>  set_wlan_enable() {
> @@ -28,9 +38,20 @@ delay_command "wifi" "wifi" "45"
>  
>  get_wlan_ssid() {
>  local num="$1"
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
> wireless.@wifi-iface[$num].ssid 2> /dev/null`
> -let num=$num+1
> -ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val"
> +local val=""
> +case "$action" in
> +     get_value)
> +     val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
> wireless.@wifi-iface[$num].ssid 2> /dev/null`
> +     let num=$num+1
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val"
> +     ;;
> +     get_name)
> +     val="1"
> +     let num=$num+1
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val"
> +     ;;
> +esac
> +
>  }
>  
>  set_wlan_ssid() {
> @@ -79,6 +100,75 @@ esac
>  return $FAULT_CPE_INVALID_PARAMETER_NAME
>  }
>  
> +get_lan_device_name() {
> +case "$1" in
> +     InternetGatewayDevice.)
> +     ubus_freecwmp_output "InternetGatewayDevice.LANDevice." "1"
> +     if [ "$2" = "0" ]; then
> +             ubus_freecwmp_output "InternetGatewayDevice.LANDevice.1." "1"
> +             ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration." "1"
> +             ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> +             get_wlan_enable 0
> +             get_wlan_ssid 0
> +     fi
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.)
> +     ubus_freecwmp_output "InternetGatewayDevice.LANDevice." "1"
> +     ubus_freecwmp_output "InternetGatewayDevice.LANDevice.1." "1"
> +     if [ "$2" = "0" ]; then
> +             ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration." "1"
> +             ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> +             get_wlan_enable 0
> +             get_wlan_ssid 0
> +     fi
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.1.)
> +     ubus_freecwmp_output "InternetGatewayDevice.LANDevice.1." "1"
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration." "1"
> +     if [ "$2" = "0" ]; then
> +             ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> +             get_wlan_enable 0
> +             get_wlan_ssid 0
> +     fi
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.1.WLANConfiguration.)
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration." "1"
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> +     if [ "$2" = "0" ]; then
> +     get_wlan_enable 0
> +     get_wlan_ssid 0
> +     fi
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.)
> +     ubus_freecwmp_output 
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> +     if [ "$2" = "0" ]; then
> +     get_wlan_enable 0
> +     get_wlan_ssid 0
> +     fi
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable)
> +     if [ "$2" = "1" ]; then
> +             return $FAULT_CPE_INVALID_ARGUMENTS
> +     fi
> +     get_wlan_enable 0
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +     InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID)
> +     if [ "$2" = "1" ]; then
> +             return $FAULT_CPE_INVALID_ARGUMENTS
> +     fi
> +     get_wlan_ssid 0
> +     return $FAULT_CPE_NO_FAULT
> +     ;;
> +esac
> +return $FAULT_CPE_INVALID_PARAMETER_NAME
> +}
> +
>  set_lan_device() {
>  case "$1" in
>       InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable)
> -- 
> 1.7.4.1

Luka 

<Prev in Thread] Current Thread [Next in Thread>