[OpenWrt-Devel] [PATCH 2/3] ramips: Add base-files for HiWiFi HC5x61 models
Bastian Bittorf
bittorf at bluebottle.com
Mon Sep 28 13:03:15 EDT 2015
* Comman Kang <kangxn at 163.com> [28.09.2015 17:37]:
> Mostly done, except this one
>
> >+ hiwifi-hc5*61)
> >+ __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..'`
> >+ lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr '[A-Z]' '[a-z]'`
>
> Is that really needed?
>
> >+ [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
> >+ wan_mac=$(macaddr_add "$lan_mac" 1)
> >+ ;;
>
>
>
> That is needed, here is the result on my router.
>
>
> root at Hiwifi:~# __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..'`
> root at Hiwifi:~# echo $__fac_mac
> Vfac_mac = D4:EE:07:25:6C:D6
> root at Hiwifi:~# lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr '[A-Z]' '[a-z]'`
> root at Hiwifi:~# echo $lan_mac
> d4:ee:07:25:6c:d6
>
>
> So that line is needed, __fac_mac itself is not a valid mac
can you please use this:
set -- $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' )
lan_mac="$( echo $3 | tr '[A-Z]' '[a-z]' )"
or maybe:
for lan_mac in $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' ); do :; done
lan_mac="$( echo $lan_mac | tr '[A-Z]' '[a-z]' )"
maybe you can even use one of the helpers in /lib/functions/system.sh
bye, bastian
_______________________________________________
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