[OpenWrt-Devel] [PATCH] [RESEND] ar71xx: add qihoo 360 c301 router support

Yousong Zhou yszhou4tech at gmail.com
Thu Sep 11 06:17:32 EDT 2014


Hi, Weijie

On 11 September 2014 17:58, Weijie Gao <hackpascal at gmail.com> wrote:
> Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac.
> Its chipset is AR9344 + AR9882 with two 16MB flashes.
>
> This patch adds its initial support.

Cool,

>
> Signed-off-by: Weijie Gao <hackpascal at gmail.com>
> ---

...

> diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
> index a28932f..66ccb1f 100644
> --- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
> +++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
> @@ -24,6 +24,29 @@ do_load_ath10k_board_bin() {
>                                 bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
>
>                 ;;
> +               qihoo-c301)
> +                       local mac
> +                       local tmp
> +
> +                       dd if=/dev/mtdblock2 of=/tmp/c301-nvram >/dev/null 2>/dev/null
> +
> +                       tmp=$(cat /tmp/c301-nvram | grep 'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)')
> +
> +                       if [ $? == 0 ]; then
> +                               rm -f /tmp/c301-nvram
> +                               mac=$(echo ${tmp} | sed 's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)/\1/g')
> +                       else
> +                               mac=$(macaddr_add $(cat /sys/class/net/eth0/address) -2)
> +                       fi

mac address here can be fetched with "mtd_get_mac_ascii", then test
its existence with [ -n "$mac" ] or [ -z "$mac" ]


Regards.

                yousong

> +
> +                       dd if=/dev/mtdblock10 \
> +                               bs=1 skip=20480 count=6 \
> +                               of=/tmp/ath10k-board.bin
> +                       macaddr_2bin $mac >> /tmp/ath10k-board.bin
> +                       dd if=/dev/mtdblock10 \
> +                               bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
> +
> +               ;;
>         esac
>         [ -f /tmp/ath10k-board.bin ] || {
>                 return
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list