Re: [LEDE-DEV] Automated shell code debugging

2016-10-04 Thread Jan-Tarek Butt


On 10/02/16 18:10, Bastian Bittorf wrote:
> * Jan-Tarek Butt  [02.10.2016 17:48]:
>> As a part of code quallity enhancemend and prevenition. We can do an 
>> ondemand daemon as engine to
>> check all shell scrips. We can use the opensource Project shellcheck [0].
>>
>> My idea is to do an insatnce on a server:
>> This insatnce can pull the lede repo daily and run some thing like:
>>
>> find . -type f -name "*.sh" | xargs shellcheck
>>
>> if something news pulled and shellcheck detecs some misstating we can send 
>> via bsd-mailx
>> on our ML the shellceck output.
>>
>> Sould I build something for that?
> 
> it's not *that* easy. for now the shell-codebase has *thousands* of
> errors. we need something that checks small parts (e.g. functions)
> and compares the error-count before and after. the output of this
> approach should maybe be included in the commit-message.
> 
> also we must "mute" some "errors", e.g. the usage of 
> 'local' in functions, which is not POSIX (but is in the
> process of inclusion)

shellcheck is able to do that.

for mutin just add the comment

# shellcheck disable=

@Lars: please could you setup a shellcheck instance just for testing first? :)

cheers
Tarek



signature.asc
Description: OpenPGP digital signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v2 2/2] ar71xx: add support for the Airtight C-60

2016-10-04 Thread Piotr Dymacz
Hello Christian,

Small comments below, inline.

2016-10-04 22:55 GMT+02:00 Christian Lamparter :

[snip]

> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..5f2056e 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -76,6 +76,9 @@ get_status_led() {
> c-55)
> status_led="$board:green:pwr"
> ;;
> +   c-60)
> +   status_led="c-60:green:pwr"
> +   ;;

Please, use $board variable here and combine c-60 with c55 as both
boards use same LED name.

[snip]

> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 559f97d..e89cc24 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -484,6 +484,7 @@ platform_check_image() {
>
> return 0
> ;;
> +   c-60|\
> nbg6716|\
> r6100|\
> wndr3700v4|\
> @@ -540,6 +541,7 @@ platform_pre_upgrade() {
> z1)
> merakinand_do_upgrade "$1"
> ;;
> +   c-60|\
> nbg6716|\
> r6100|\
> wndr3700v4|\

This breaks alphabetical order.
Boards are ordered in two steps: within every case block and then
whole case blocks are ordered, based on first board.

Please reorder case blocks here too.

[snip]

> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c 
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c
> new file mode 100644
> index 000..26930a9
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c

[snip]

> +/* can be used to "lock" the console port  */
> +#define C60_GPIO_LOCK_CONSOLE_PORT  9

I'm not sure why did you define it here as it's not used.
Plus, GPIO9 is by default configured as UART0 RX signal on AR934x.

[snip]

Thanks for your contribution!

Cheers,
Piotr

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [LEDE DEV][wiki] Template switcher / mobile version added

2016-10-04 Thread Thomas Endt
I added a template switcher which allows you to switch between two templates
or themes.
You find a dropdown list in the upper left of the page.

Full version = monobook
Mobile Version = bootstrap3

This is just for tryout. Please let me know if you think it's useful to
provide this dropdown list. 

Regards,
Thomas
<>___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/3] nvram: fix globbing, word splitting and arithmetic variables

2016-10-04 Thread Jan-Tarek Butt


On 10/04/16 14:51, John Crispin wrote:
> 
> 
> On 04/10/2016 14:47, Jan-Tarek Butt wrote:
>> Double quote to prevent globbing and word splitting.
>> $/${} is unnecessary on arithmetic variables.
>> Remove unused variables
> 
> SoB missing here aswell
> 
Ok, Sorry I'll read the patch howto and send it reasonable.

Sorry for that noise ..

cheers
Tarek



signature.asc
Description: OpenPGP digital signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 2/3] ct-bugcheck: fix globbing, word splitting and formatting

2016-10-04 Thread John Crispin


On 04/10/2016 14:50, Jan-Tarek Butt wrote:
> Double quote to prevent globbing and word splitting.
> { cmd1; cmd2; } >> file instead of individual redirects.

Hi,

apart from the SoB missing, this seems to be a resend of a patch sent
previously, yet i dont see a list of things that you changed between
this and the previous version. please make sure to add this info.

John

> ---
>  package/utils/ct-bugcheck/src/bugcheck.sh | 154 
> +++---
>  1 file changed, 77 insertions(+), 77 deletions(-)
> 
> diff --git a/package/utils/ct-bugcheck/src/bugcheck.sh 
> b/package/utils/ct-bugcheck/src/bugcheck.sh
> index 85f70c5..a930440 100755
> --- a/package/utils/ct-bugcheck/src/bugcheck.sh
> +++ b/package/utils/ct-bugcheck/src/bugcheck.sh
> @@ -9,49 +9,51 @@ FOUND_BUG=0
>  
>  # set -x
>  
> -bugcheck_generic()
> -{
> -echo "LEDE crashlog report" > $CRASHDIR/info.txt
> -date >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "uname" >> $CRASHDIR/info.txt
> -uname -a >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "os-release" >> $CRASHDIR/info.txt
> -cat /etc/os-release >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "os-release" >> $CRASHDIR/info.txt
> -cat /etc/os-release >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "dmesg output" >> $CRASHDIR/info.txt
> -dmesg >> $CRASHDIR/info.txt
> -if [ -x /usr/bin/lspci ]
> - then
> - echo >> $CRASHDIR/info.txt
> - echo "lspci" >> $CRASHDIR/info.txt
> - lspci >> $CRASHDIR/info.txt
> +bugcheck_generic() {
> +{
> +echo "LEDE crashlog report"
> + date
> + echo
> + echo "uname"
> + uname -a
> + echo
> + echo "os-release"
> + cat /etc/os-release
> + echo
> + echo "os-release"
> + cat /etc/os-release
> + echo
> + echo "dmesg output"
> + dmesg
> +} > $CRASHDIR/info.txt
> +if [ -x /usr/bin/lspci ]; then
> +{
> + echo
> + echo "lspci"
> + lspci
> + } >> $CRASHDIR/info.txt
>  fi
> -echo >> $CRASHDIR/info.txt
> -echo "cpuinfo" >> $CRASHDIR/info.txt
> -cat /proc/cpuinfo >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "meminfo" >> $CRASHDIR/info.txt
> -cat /proc/cpuinfo >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "cmdline" >> $CRASHDIR/info.txt
> -cat /proc/cmdline >> $CRASHDIR/info.txt
> -echo >> $CRASHDIR/info.txt
> -echo "lsmod" >> $CRASHDIR/info.txt
> -lsmod >> $CRASHDIR/info.txt
> +{
> +echo
> +echo "cpuinfo"
> +cat /proc/cpuinfo
> +echo
> +echo "meminfo"
> +cat /proc/cpuinfo
> +echo
> +echo "cmdline"
> +cat /proc/cmdline
> +echo
> +echo "lsmod"
> +lsmod
> +} >> $CRASHDIR/info.txt
>  }
>  
>  roll_crashes()
>  {
>  # Roll any existing crashes
> -if [ -d $CRASHDIR ]
> - then
> - if [ -d $CRASHDIR.1 ]
> - then
> +if [ -d $CRASHDIR ]; then
> + if [ -d $CRASHDIR.1 ]; then
>   rm -fr $CRASHDIR.1
>   fi
>   mv $CRASHDIR $CRASHDIR.1
> @@ -62,48 +64,46 @@ roll_crashes()
>  }
>  
>  # ath10k, check debugfs entries.
> -for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump
> -do
> -  #echo "Checking $i"
> -  if cat $i > $TMPLOC/ath10k_crash.bin 2>&1
> -  then
> -  FOUND_BUG=1
> -
> -  #echo "Found ath10k crash data in $i"
> -  roll_crashes
> -
> -  ADIR=${i/fw_crash_dump/}
> -
> -  CTFW=0
> -  if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1
> -   then
> -   CTFW=1
> -  fi
> -
> -  echo "Send bug reports to:" > $CRASHDIR/report_to.txt
> -  if [ -f $ADIR/ct_special -o $CTFW == "1" ]
> -   then
> -   # Looks like this is CT firmware or driver...
> -   echo "gree...@candelatech.com" >> $CRASHDIR/report_to.txt
> -   echo "and/or report or check for duplicates here:" >> 
> $CRASHDIR/report_to.txt
> -   echo "https://github.com/greearb/ath10k-ct/issues; >> 
> $CRASHDIR/report_to.txt
> -  else
> -   # Not sure who would want these bug reports for upstream...
> -   echo "https://www.lede-project.org/; >> $CRASHDIR/report_to.txt
> -  fi
> -  echo >> $CRASHDIR/report_to.txt
> -  echo "Please attach all files in this directory to bug reports." >> 
> $CRASHDIR/report_to.txt
> -
> -  mv $TMPLOC/ath10k_crash.bin $CRASHDIR
> -
> -  # Add any more ath10k specific stuff here.
> -
> -  # And call generic bug reporting logic
> -  bugcheck_generic
> -  fi
> +for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump; do
> +#echo "Checking $i"
> +if cat "$i" > $TMPLOC/ath10k_crash.bin 2>&1; then
> +FOUND_BUG=1
> +
> + #echo "Found ath10k crash data in $i"
> + roll_crashes
> +
> + ADIR=${i/fw_crash_dump/}
> +
> + CTFW=0
> + if grep -- -ct- $TMPLOC/ath10k_crash.bin > 

[LEDE-DEV] [PATCH 2/3] ct-bugcheck: fix globbing, word splitting and formatting

2016-10-04 Thread Jan-Tarek Butt
Double quote to prevent globbing and word splitting.
{ cmd1; cmd2; } >> file instead of individual redirects.
---
 package/utils/ct-bugcheck/src/bugcheck.sh | 154 +++---
 1 file changed, 77 insertions(+), 77 deletions(-)

diff --git a/package/utils/ct-bugcheck/src/bugcheck.sh 
b/package/utils/ct-bugcheck/src/bugcheck.sh
index 85f70c5..a930440 100755
--- a/package/utils/ct-bugcheck/src/bugcheck.sh
+++ b/package/utils/ct-bugcheck/src/bugcheck.sh
@@ -9,49 +9,51 @@ FOUND_BUG=0
 
 # set -x
 
-bugcheck_generic()
-{
-echo "LEDE crashlog report" > $CRASHDIR/info.txt
-date >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "uname" >> $CRASHDIR/info.txt
-uname -a >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "os-release" >> $CRASHDIR/info.txt
-cat /etc/os-release >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "os-release" >> $CRASHDIR/info.txt
-cat /etc/os-release >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "dmesg output" >> $CRASHDIR/info.txt
-dmesg >> $CRASHDIR/info.txt
-if [ -x /usr/bin/lspci ]
-   then
-   echo >> $CRASHDIR/info.txt
-   echo "lspci" >> $CRASHDIR/info.txt
-   lspci >> $CRASHDIR/info.txt
+bugcheck_generic() {
+{
+echo "LEDE crashlog report"
+   date
+   echo
+   echo "uname"
+   uname -a
+   echo
+   echo "os-release"
+   cat /etc/os-release
+   echo
+   echo "os-release"
+   cat /etc/os-release
+   echo
+   echo "dmesg output"
+   dmesg
+} > $CRASHDIR/info.txt
+if [ -x /usr/bin/lspci ]; then
+{
+   echo
+   echo "lspci"
+   lspci
+   } >> $CRASHDIR/info.txt
 fi
-echo >> $CRASHDIR/info.txt
-echo "cpuinfo" >> $CRASHDIR/info.txt
-cat /proc/cpuinfo >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "meminfo" >> $CRASHDIR/info.txt
-cat /proc/cpuinfo >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "cmdline" >> $CRASHDIR/info.txt
-cat /proc/cmdline >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "lsmod" >> $CRASHDIR/info.txt
-lsmod >> $CRASHDIR/info.txt
+{
+echo
+echo "cpuinfo"
+cat /proc/cpuinfo
+echo
+echo "meminfo"
+cat /proc/cpuinfo
+echo
+echo "cmdline"
+cat /proc/cmdline
+echo
+echo "lsmod"
+lsmod
+} >> $CRASHDIR/info.txt
 }
 
 roll_crashes()
 {
 # Roll any existing crashes
-if [ -d $CRASHDIR ]
-   then
-   if [ -d $CRASHDIR.1 ]
-   then
+if [ -d $CRASHDIR ]; then
+   if [ -d $CRASHDIR.1 ]; then
rm -fr $CRASHDIR.1
fi
mv $CRASHDIR $CRASHDIR.1
@@ -62,48 +64,46 @@ roll_crashes()
 }
 
 # ath10k, check debugfs entries.
-for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump
-do
-  #echo "Checking $i"
-  if cat $i > $TMPLOC/ath10k_crash.bin 2>&1
-  then
-  FOUND_BUG=1
-
-  #echo "Found ath10k crash data in $i"
-  roll_crashes
-
-  ADIR=${i/fw_crash_dump/}
-
-  CTFW=0
-  if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1
- then
- CTFW=1
-  fi
-
-  echo "Send bug reports to:" > $CRASHDIR/report_to.txt
-  if [ -f $ADIR/ct_special -o $CTFW == "1" ]
- then
- # Looks like this is CT firmware or driver...
- echo "gree...@candelatech.com" >> $CRASHDIR/report_to.txt
- echo "and/or report or check for duplicates here:" >> 
$CRASHDIR/report_to.txt
- echo "https://github.com/greearb/ath10k-ct/issues; >> 
$CRASHDIR/report_to.txt
-  else
- # Not sure who would want these bug reports for upstream...
- echo "https://www.lede-project.org/; >> $CRASHDIR/report_to.txt
-  fi
-  echo >> $CRASHDIR/report_to.txt
-  echo "Please attach all files in this directory to bug reports." >> 
$CRASHDIR/report_to.txt
-
-  mv $TMPLOC/ath10k_crash.bin $CRASHDIR
-
-  # Add any more ath10k specific stuff here.
-
-  # And call generic bug reporting logic
-  bugcheck_generic
-  fi
+for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump; do
+#echo "Checking $i"
+if cat "$i" > $TMPLOC/ath10k_crash.bin 2>&1; then
+FOUND_BUG=1
+
+   #echo "Found ath10k crash data in $i"
+   roll_crashes
+
+   ADIR=${i/fw_crash_dump/}
+
+   CTFW=0
+   if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1; then
+   CTFW=1
+   fi
+
+   echo "Send bug reports to:" > $CRASHDIR/report_to.txt
+   if [ -f "$ADIR"/ct_special ] || [ $CTFW = "1" ]; then
+   # Looks like this is CT firmware or driver...
+   {
+   echo "gree...@candelatech.com"
+   echo "and/or report or check for duplicates here:"
+   echo "https://github.com/greearb/ath10k-ct/issues;
+   } >> $CRASHDIR/report_to.txt
+else
+   # Not sure who 

Re: [LEDE-DEV] [PATCH 1/3] nvram: fix globbing, word splitting and arithmetic variables

2016-10-04 Thread John Crispin


On 04/10/2016 14:47, Jan-Tarek Butt wrote:
> Double quote to prevent globbing and word splitting.
> $/${} is unnecessary on arithmetic variables.
> Remove unused variables

SoB missing here aswell

John

> ---
>  package/utils/nvram/files/nvram.init | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/package/utils/nvram/files/nvram.init 
> b/package/utils/nvram/files/nvram.init
> index 467ab28..ec06e7a 100755
> --- a/package/utils/nvram/files/nvram.init
> +++ b/package/utils/nvram/files/nvram.init
> @@ -4,10 +4,10 @@
>  # This file handles the NVRAM quirks of various hardware.
>  
>  START=02
> -alias debug=${DEBUG:-:}
> +alias debug="${DEBUG:-:}"
>  
>  nvram_default() {
> - [ -z "$(nvram get $1)" ] && nvram set "$1=$2"
> + [ -z "$(nvram get "$1")" ] && nvram set "$1=$2"
>  }
>  
>  nvram_set() { # for the linksys fixup part
> @@ -20,12 +20,11 @@ nvram_set() { # for the linksys fixup part
>  fixup_linksys() {
>   # work around braindead CFE defaults in linksys routers
>   boardtype=$(nvram get boardtype)
> - boardnum=$(nvram get boardnum)
>   boardflags=$(($(nvram get boardflags)))
> - adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
> + adm_switch="$(( (boardflags & 0x80) >> 7 ))"
>  
>   [ -n "$(nvram get vxkilled)" ] && boardtype=0 # don't mess with the ram 
> settings on the hacked cfe
> - case "$(( $boardtype ))" in
> + case "$(( boardtype ))" in
>   "1800") #0x708
>   if [ "$adm_switch" = 0 ]; then
>   nvram_set sdram_init "$(printf 0x%04x $(( 
> $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
> @@ -53,10 +52,10 @@ fixup_linksys() {
>   ;;
>   "1071") #0x042f
>   # do sanity check first! max 0x0011 = 128mb
> - SDRAM_INIT=$(printf %d $(/usr/sbin/nvram get 
> sdram_init))
> - [ "$SDRAM_INIT" -lt "9" -o "$SDRAM_INIT" -gt "17" ] && {
> + SDRAM_INIT=$(printf %d "$(/usr/sbin/nvram get 
> sdram_init)")
> + [ "$SDRAM_INIT" -lt "9" ] || [ "$SDRAM_INIT" -gt "17" ] 
> && {
>   # set this to default: 0x09 only if value is 
> invaild like 16MB on Asus WL-500GP
> - echo "sdram_init is invaild: $(printf 0x%04x 
> $SDRAM_INIT), force to default!"
> + echo "sdram_init is invaild: $(printf 0x%04x 
> "$SDRAM_INIT"), force to default!"
>   nvram_set sdram_init 0x0009
>   }
>   # on WRT54G3GV2 set flag, so checksum errors of 
> firmware image 2 don't stop the boot process
> @@ -83,16 +82,16 @@ start() {
>  
>   [ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
>   # if default wifi mac, set two higher than the lan mac
> - nvram set il0macaddr=$(nvram get et0macaddr|
> - awk 
> '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
> + nvram set il0macaddr="$(nvram get et0macaddr|
> + awk 
> '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
>   }
>  
>   [ "$(nvram get et0macaddr)" = "00:90:4c:c0:00:08" ] && {
>   # OvisLink WL-1600GL mac workaround
> - nvram set et0macaddr=$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
> "%02x" ' /dev/mtd/0)
> - nvram set il0macaddr=$(nvram get et0macaddr|
> - awk 
> '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
> + nvram set et0macaddr="$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
> "%02x" ' /dev/mtd/0)"
> + nvram set il0macaddr="$(nvram get et0macaddr|
> + awk 
> '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
>   }
>  
>   [ "$COMMIT" = "1" ] && nvram commit
> -}
> +  }
> 

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/3] nvram: fix globbing, word splitting and arithmetic variables

2016-10-04 Thread Jan-Tarek Butt
Double quote to prevent globbing and word splitting.
$/${} is unnecessary on arithmetic variables.
Remove unused variables
---
 package/utils/nvram/files/nvram.init | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/package/utils/nvram/files/nvram.init 
b/package/utils/nvram/files/nvram.init
index 467ab28..ec06e7a 100755
--- a/package/utils/nvram/files/nvram.init
+++ b/package/utils/nvram/files/nvram.init
@@ -4,10 +4,10 @@
 # This file handles the NVRAM quirks of various hardware.
 
 START=02
-alias debug=${DEBUG:-:}
+alias debug="${DEBUG:-:}"
 
 nvram_default() {
-   [ -z "$(nvram get $1)" ] && nvram set "$1=$2"
+   [ -z "$(nvram get "$1")" ] && nvram set "$1=$2"
 }
 
 nvram_set() { # for the linksys fixup part
@@ -20,12 +20,11 @@ nvram_set() { # for the linksys fixup part
 fixup_linksys() {
# work around braindead CFE defaults in linksys routers
boardtype=$(nvram get boardtype)
-   boardnum=$(nvram get boardnum)
boardflags=$(($(nvram get boardflags)))
-   adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
+   adm_switch="$(( (boardflags & 0x80) >> 7 ))"
 
[ -n "$(nvram get vxkilled)" ] && boardtype=0 # don't mess with the ram 
settings on the hacked cfe
-   case "$(( $boardtype ))" in
+   case "$(( boardtype ))" in
"1800") #0x708
if [ "$adm_switch" = 0 ]; then
nvram_set sdram_init "$(printf 0x%04x $(( 
$(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
@@ -53,10 +52,10 @@ fixup_linksys() {
;;
"1071") #0x042f
# do sanity check first! max 0x0011 = 128mb
-   SDRAM_INIT=$(printf %d $(/usr/sbin/nvram get 
sdram_init))
-   [ "$SDRAM_INIT" -lt "9" -o "$SDRAM_INIT" -gt "17" ] && {
+   SDRAM_INIT=$(printf %d "$(/usr/sbin/nvram get 
sdram_init)")
+   [ "$SDRAM_INIT" -lt "9" ] || [ "$SDRAM_INIT" -gt "17" ] 
&& {
# set this to default: 0x09 only if value is 
invaild like 16MB on Asus WL-500GP
-   echo "sdram_init is invaild: $(printf 0x%04x 
$SDRAM_INIT), force to default!"
+   echo "sdram_init is invaild: $(printf 0x%04x 
"$SDRAM_INIT"), force to default!"
nvram_set sdram_init 0x0009
}
# on WRT54G3GV2 set flag, so checksum errors of 
firmware image 2 don't stop the boot process
@@ -83,16 +82,16 @@ start() {
 
[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
# if default wifi mac, set two higher than the lan mac
-   nvram set il0macaddr=$(nvram get et0macaddr|
-   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
+   nvram set il0macaddr="$(nvram get et0macaddr|
+   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
}
 
[ "$(nvram get et0macaddr)" = "00:90:4c:c0:00:08" ] && {
# OvisLink WL-1600GL mac workaround
-   nvram set et0macaddr=$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
"%02x" ' /dev/mtd/0)
-   nvram set il0macaddr=$(nvram get et0macaddr|
-   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
+   nvram set et0macaddr="$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
"%02x" ' /dev/mtd/0)"
+   nvram set il0macaddr="$(nvram get et0macaddr|
+   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
}
 
[ "$COMMIT" = "1" ] && nvram commit
-}
+  }
-- 
2.10.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] package/boot/uboot-envtools/files/uboot-envtools.sh

2016-10-04 Thread John Crispin


On 04/10/2016 14:35, John Crispin wrote:
> 
> 
> On 04/10/2016 14:31, Jan-Tarek Butt wrote:
>>
>>
>> On 10/04/16 07:35, Mathias Kresin wrote:
>>> 04.10.2016 01:49, Jan-Tarek Butt:
 Hi,

 Does anyone understand what this "variables" in line 24 to 28 are use [0]?

 [0] 
 https://git.lede-project.org/?p=source.git;a=blob;f=package/boot/uboot-envtools/files/uboot-envtools.sh;h=e21b28367751fdd86897f3a47911f3a3ffbdbdfb;hb=HEAD
>>>
>>> They are used by config_get to store the value of the requested option[0]:
>>>
>>>   config_get   
>>
>> Ah I see. Seems probably too late last night :D
>>
>> Thanks
>> Tarek
> 
> do you runtime test your changes or are these late night hacks ?
> 
>   John
> 

i just had a look, there are 15+ patches from you in patchwork. all are
badly formatted, missing the SoB line, missing the versioning info,
subject and descriptions don't exist and the patch prefixes is missing.

i will close the whole lot as "Changes requested" please resend them all
in the expected format. if you are not sure how to do this, the please
read the submitting patches howto.

John

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] package/boot/uboot-envtools/files/uboot-envtools.sh

2016-10-04 Thread John Crispin


On 04/10/2016 14:31, Jan-Tarek Butt wrote:
> 
> 
> On 10/04/16 07:35, Mathias Kresin wrote:
>> 04.10.2016 01:49, Jan-Tarek Butt:
>>> Hi,
>>>
>>> Does anyone understand what this "variables" in line 24 to 28 are use [0]?
>>>
>>> [0] 
>>> https://git.lede-project.org/?p=source.git;a=blob;f=package/boot/uboot-envtools/files/uboot-envtools.sh;h=e21b28367751fdd86897f3a47911f3a3ffbdbdfb;hb=HEAD
>>
>> They are used by config_get to store the value of the requested option[0]:
>>
>>   config_get   
> 
> Ah I see. Seems probably too late last night :D
> 
> Thanks
> Tarek

do you runtime test your changes or are these late night hacks ?

John

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] package/boot/uboot-envtools/files/uboot-envtools.sh

2016-10-04 Thread Jan-Tarek Butt


On 10/04/16 07:35, Mathias Kresin wrote:
> 04.10.2016 01:49, Jan-Tarek Butt:
>> Hi,
>>
>> Does anyone understand what this "variables" in line 24 to 28 are use [0]?
>>
>> [0] 
>> https://git.lede-project.org/?p=source.git;a=blob;f=package/boot/uboot-envtools/files/uboot-envtools.sh;h=e21b28367751fdd86897f3a47911f3a3ffbdbdfb;hb=HEAD
> 
> They are used by config_get to store the value of the requested option[0]:
> 
>   config_get   

Ah I see. Seems probably too late last night :D

Thanks
Tarek



signature.asc
Description: OpenPGP digital signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] New device: Two USB ports, only one USB activity LED

2016-10-04 Thread Rafał Miłecki
On 2 September 2016 at 13:42, J Mo  wrote:
> I have a new device I am working on and it has two USB ports but only one
> USB activity LED.
>
> Right now the LED works the way I like with one of the USB ports, but not
> the other port. I would like for the LED to go active and/or blink when
> there is activity from either port.
>
> Anyone know how to do this? Example devices? I think I'm just overlooking
> something.
>
>
>
> My DTS looks like this:
>
> gpio-leds {
> compatible = "gpio-leds";
>
> usb {
> label = "tew827dru:blue:usb";
> gpios = <_pinmux 7 1>;
> default-state = "off";
> };
>
>
>
>
> And I have the following in my /etc/board.d/01_leds file:
>
> case "$board" in
> tew827dru)
> ucidef_set_led_usbdev "usb2" "USB2" "tew827dru:blue:usb" "2-1"
> ucidef_set_led_usbdev "usb4" "USB4" "tew827dru:blue:usb" "4-1"
> ;;

It took me a while to get usbport trigged accepted upstream, but there
it is. Take a look at:

a69e19d18ac ("kernel: backport usbport LED trigger from 4.9") and two
pending patches:
https://patchwork.ozlabs.org/patch/678015/
https://patchwork.ozlabs.org/patch/678014/

I'm also going to work on DT support for usbport trigger, so you won't
need user space setup it with ucidef_set_led_usbdev or
ucidef_set_led_usbport.

-- 
Rafał

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/2] base-files: support usbport LED trigger

2016-10-04 Thread Rafał Miłecki
From: Rafał Miłecki 

This adds ucidef_set_led_usbport function that can be called by target
board.d files. Example usage:
ucidef_set_led_usbport "usb" "bcm53xx:blue:usb" "usb1-port1" "usb2-port1"

List of available ports can be fetched using:
ls -d /sys/bus/usb/devices/*/*-port*
or
echo usbport > trigger
ls ports/

Signed-off-by: Rafał Miłecki 
---
 package/base-files/files/bin/config_generate|  9 +
 package/base-files/files/etc/init.d/led | 10 ++
 .../base-files/files/lib/functions/uci-defaults.sh  | 21 +
 3 files changed, 40 insertions(+)

diff --git a/package/base-files/files/bin/config_generate 
b/package/base-files/files/bin/config_generate
index 80ed61b..785be48 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -335,6 +335,15 @@ generate_led() {
EOF
;;
 
+   usbport)
+   local ports port
+   json_get_values ports ports
+   uci set system.$cfg.trigger='usbport'
+   for port in $ports; do
+   uci add_list system.$cfg.port=$port
+   done
+   ;;
+
rssi)
local iface minq maxq offset factor
json_get_vars iface minq maxq offset factor
diff --git a/package/base-files/files/etc/init.d/led 
b/package/base-files/files/etc/init.d/led
index 79f2904..ad050f7 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -18,6 +18,7 @@ load_led() {
config_get name $1 name "$sysfs"
config_get trigger $1 trigger "none"
config_get dev $1 dev
+   config_get port $1 port
config_get mode $1 mode "link"
config_get_bool default $1 default "nil"
config_get delayon $1 delayon
@@ -78,6 +79,15 @@ load_led() {
}
;;
 
+   "usbport")
+   [ -n "$port" ] && {
+   local p
+   for p in $port; do
+   echo 1 > 
/sys/class/leds/${sysfs}/ports/$p
+   done
+   }
+   ;;
+
"port_state")
[ -n "$port_state" ] && \
echo $port_state > 
/sys/class/leds/${sysfs}/port_state
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh 
b/package/base-files/files/lib/functions/uci-defaults.sh
index a88308b..a86cb04 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -390,6 +390,27 @@ ucidef_set_led_usbdev() {
json_select ..
 }
 
+ucidef_set_led_usbport() {
+   local obj="$1"
+   local sysfs="$2"
+   shift
+   shift
+
+   json_select_object led
+
+   json_select_object "$obj"
+   json_add_string type usbport
+   json_add_string sysfs "$sysfs"
+   json_select_array ports
+   for port in "$@"; do
+   json_add_string port "$port"
+   done
+   json_select ..
+   json_select ..
+
+   json_select ..
+}
+
 ucidef_set_led_wlan() {
local cfg="led_$1"
local name="$2"
-- 
2.9.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/2] kernel: add package for usbport LED trigger

2016-10-04 Thread Rafał Miłecki
From: Rafał Miłecki 

This is upstream alternative for LEDE's ledtrig-usbdev. It's main
advantages are:
1) Support for assigning more than 1 USB port to the LED
2) Setting proper state when activating with device already connected
3) FWIW it's an upstream driver

Signed-off-by: Rafał Miłecki 
---
 package/kernel/linux/modules/usb.mk | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index d25f7c1..5f90e86 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -36,6 +36,25 @@ define AddDepends/usb
 endef
 
 
+define KernelPackage/usb-ledtrig-usbport
+  TITLE:=LED trigger for USB ports
+  KCONFIG:=CONFIG_USB_LEDS_TRIGGER_USBPORT
+  DEPENDS:=@!LINUX_3_18
+  FILES:=$(LINUX_DIR)/drivers/usb/core/ledtrig-usbport.ko
+  AUTOLOAD:=$(call AutoLoad,50,ledtrig-usbport)
+  $(call AddDepends/usb)
+endef
+
+define KernelPackage/usb-ledtrig-usbport/description
+  This driver allows LEDs to be controlled by USB events. Enabling this
+  trigger allows specifying list of USB ports that should turn on LED
+  when some USB device gets connected.
+  If possible it should be prefered over similar ledtrig-usbdev.
+endef
+
+$(eval $(call KernelPackage,usb-ledtrig-usbport))
+
+
 define KernelPackage/usb-musb-hdrc
   TITLE:=Support for Mentor Graphics silicon dual role USB
   KCONFIG:= \
-- 
2.9.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] Call defines for minifying scripting languages

2016-10-04 Thread Zefir Kurtisi
On 10/03/2016 01:00 PM, Jan-Tarek Butt wrote:
> Hi,
> 
> My Idea ist to create calldefs to minify all scriptes there are 
> interpreted by run time.
> 
> As example see the mail "[PATCH] LuaSrcDiet call define for lua 
> code Minifying".
> 
> I plan to write also calldefs for shellscripts, python and perl.
> 
> [...]
> 
When it comes to shell-scripts, I'd start at a prior step: why does an embedded
system need to run and interpret so many shell-scripts at all?

OWRT has been shell-script heavy from the very beginning, but luckily over the
last few years started to move more and more of that scripted functionality into
binaries (e.g. procd, netifd). This transition only started, and imho the goal 
to
reach is to get rid of all shell-scripts on target (beside init-scripts, maybe).

Therefore, instead of optimizing them, I'd opt to treat them as technical debt
which needs to be resolved by replacing scripts with binaries - personally, I
won't spend too much time on something to-become-legacy mid-term.



Cheers,
Zefir


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] o2 box 6431 / VGV7510KW22 - SIP with FXS/TAE Ports | owsip or alternative ?

2016-10-04 Thread Daniel Golle
On Mon, Oct 03, 2016 at 01:56:06AM +0200, Hauke Mehrtens wrote:
> On 09/23/2016 09:02 PM, Daniel Golle wrote:
> > On Fri, Sep 23, 2016 at 08:14:24PM +0200, Dennis Schneck wrote:
> >>
> >>
> >>  
> >> Hello,
> >> i use the o2 box 6431 / VGV7510KW22 with LEDE r1640.
> >> Like to use my SIP Accout with the 3x FXS Ports (Analog Phone / TAE Ports)
> >>  
> >> I read about owsip but can not find a package.
> >> Is there a simular package for lede ?
> > 
> > No. owsip disappeared a while ago, asterisk-chan-lantiq was dropped
> > with asterisk-1.8.x being moved to packages-abandoned, but it may
> > possible to still build it. If you want to give asterisk-1.8.x with
> > chan-lantiq a shot, I'd be happy to assist and maybe even forward-
> > port things to asterisk-13.x -- on this box having plenty of RAM
> > and flash, this might actually be a quite nice option.
> 
> Hi Daniel,
> 
> I looked into it and was unable to find any documentation on how to
> write a asterisk channel driver. Do you know some documentation or
> should I look into the code of the other channel drivers? My plan was to
> port the lantiq channel driver to asterisk 1.13.x.

Hi Hauke,

asterisk-chan-dongle turned out to be the most useful piece of
documentation I could find...
Great to hear you are making plans to revive VoIP support!
Do they include porting the VMMC driver to the XRX200?


Cheers


Daniel

> 
> Hauke
> 
> 
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] replacing files in base system from a package?

2016-10-04 Thread Russell Senior
> "Karl" == Karl Palsson  writes:


Karl> What's the "new" way of doing this? In the past, in OpenWrt CC and
Karl> before, a package could install files like /etc/banner and
Karl> /etc/inittab that were provided by the base-files package. It was
Karl> always listed as "unreliable" as apparently you couldn't rely on
Karl> the order. In practice it actually worked just fine.

Fwiw, I ran into trouble with things busybox provides by default, but
where I've add packages with fuller versions.  In my case it is
procps-ng from the packages feed.  In order to stop it complaining, I
need to de-select the conflicting busybox options.  What I've done
instead, locally, is just revert this commit:

  021b96d7c5c668fbcb5375c65cee90832bb2854f

Hopefully, nothing significant breaks as a result.


-- 
Russell Senior, President
russ...@personaltelco.net

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] Call defines for minifying scripting languages

2016-10-04 Thread Bastian Bittorf
* Karl Palsson  [04.10.2016 08:38]:

[...]

> about the scripts _at all_ right up until they try and look in
> one to debug something behaving oddly. At _that_ point they will
> care _very much_ that it's all minified garbage, with some
> presumption that they could "just get the source somewhere else"

I have the same impression. But making it a non-default option
for advanced users/self-builders is ok. Lets see what he can
reach in the end...

bye, bastian

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] package/utils/nvram/files/nvram.init * Double quote to prevent globbing and word splitting. * $/${} is unnecessary on arithmetic variables. * remove unused variables

2016-10-04 Thread Mathias Kresin

04.10.2016 02:35, Jan-Tarek Butt:

Signed-off-by: Jan-Tarek Butt 


Some problem with the commit title and message as with your ct-bugcheck 
patch.




---
 package/utils/nvram/files/nvram.init | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/package/utils/nvram/files/nvram.init 
b/package/utils/nvram/files/nvram.init
index 467ab28..ec06e7a 100755
--- a/package/utils/nvram/files/nvram.init
+++ b/package/utils/nvram/files/nvram.init
@@ -4,10 +4,10 @@
 # This file handles the NVRAM quirks of various hardware.

 START=02
-alias debug=${DEBUG:-:}
+alias debug="${DEBUG:-:}"

 nvram_default() {
-   [ -z "$(nvram get $1)" ] && nvram set "$1=$2"
+   [ -z "$(nvram get "$1")" ] && nvram set "$1=$2"
 }

 nvram_set() { # for the linksys fixup part
@@ -20,12 +20,11 @@ nvram_set() { # for the linksys fixup part
 fixup_linksys() {
# work around braindead CFE defaults in linksys routers
boardtype=$(nvram get boardtype)
-   boardnum=$(nvram get boardnum)
boardflags=$(($(nvram get boardflags)))
-   adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
+   adm_switch="$(( (boardflags & 0x80) >> 7 ))"

[ -n "$(nvram get vxkilled)" ] && boardtype=0 # don't mess with the ram 
settings on the hacked cfe
-   case "$(( $boardtype ))" in
+   case "$(( boardtype ))" in
"1800") #0x708
if [ "$adm_switch" = 0 ]; then
nvram_set sdram_init "$(printf 0x%04x $(( 
$(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
@@ -53,10 +52,10 @@ fixup_linksys() {
;;
"1071") #0x042f
# do sanity check first! max 0x0011 = 128mb
-   SDRAM_INIT=$(printf %d $(/usr/sbin/nvram get 
sdram_init))
-   [ "$SDRAM_INIT" -lt "9" -o "$SDRAM_INIT" -gt "17" ] && {
+   SDRAM_INIT=$(printf %d "$(/usr/sbin/nvram get 
sdram_init)")
+   [ "$SDRAM_INIT" -lt "9" ] || [ "$SDRAM_INIT" -gt "17" ] 
&& {
# set this to default: 0x09 only if value is 
invaild like 16MB on Asus WL-500GP
-   echo "sdram_init is invaild: $(printf 0x%04x 
$SDRAM_INIT), force to default!"
+   echo "sdram_init is invaild: $(printf 0x%04x 
"$SDRAM_INIT"), force to default!"
nvram_set sdram_init 0x0009
}
# on WRT54G3GV2 set flag, so checksum errors of 
firmware image 2 don't stop the boot process
@@ -83,16 +82,16 @@ start() {

[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
# if default wifi mac, set two higher than the lan mac
-   nvram set il0macaddr=$(nvram get et0macaddr|
-   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
+   nvram set il0macaddr="$(nvram get et0macaddr|
+   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
}

[ "$(nvram get et0macaddr)" = "00:90:4c:c0:00:08" ] && {
# OvisLink WL-1600GL mac workaround
-   nvram set et0macaddr=$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
"%02x" ' /dev/mtd/0)
-   nvram set il0macaddr=$(nvram get et0macaddr|
-   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
+   nvram set et0macaddr="$(hexdump -n 6 -s 130976 -e '5/1 "%02x:" 
"%02x" ' /dev/mtd/0)"
+   nvram set il0macaddr="$(nvram get et0macaddr|
+   awk 
'{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')"
}

[ "$COMMIT" = "1" ] && nvram commit
-}
+  }




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] package/utils/ct-bugcheck/src/bugcheck.sh * Double quote to prevent globbing and word splitting. * { cmd1; cmd2; } >> file instead of individual redirects. * fix formating

2016-10-04 Thread Mathias Kresin

04.10.2016 03:23, Jan-Tarek Butt:

Hey Jan-Tarek please use a proper commit title and message. Something like:

ct-bugcheck: fix globbing, word splitting and formatting

Double quote to prevent globbing and word splitting. Use { cmd1; cmd2; } 
>> file instead of individual redirects because of X.


Find more comments inline.


Signed-off-by: Jan-Tarek Butt 
---
 package/utils/ct-bugcheck/src/bugcheck.sh | 154 +++---
 1 file changed, 77 insertions(+), 77 deletions(-)

diff --git a/package/utils/ct-bugcheck/src/bugcheck.sh 
b/package/utils/ct-bugcheck/src/bugcheck.sh
index 85f70c5..a930440 100755
--- a/package/utils/ct-bugcheck/src/bugcheck.sh
+++ b/package/utils/ct-bugcheck/src/bugcheck.sh
@@ -9,49 +9,51 @@ FOUND_BUG=0

 # set -x

-bugcheck_generic()
-{
-echo "LEDE crashlog report" > $CRASHDIR/info.txt
-date >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "uname" >> $CRASHDIR/info.txt
-uname -a >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "os-release" >> $CRASHDIR/info.txt
-cat /etc/os-release >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "os-release" >> $CRASHDIR/info.txt
-cat /etc/os-release >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "dmesg output" >> $CRASHDIR/info.txt
-dmesg >> $CRASHDIR/info.txt
-if [ -x /usr/bin/lspci ]
-   then
-   echo >> $CRASHDIR/info.txt
-   echo "lspci" >> $CRASHDIR/info.txt
-   lspci >> $CRASHDIR/info.txt
+bugcheck_generic() {
+{
+echo "LEDE crashlog report"


Space vs tab. I know the script heavily mixes spaces and tabs. If not 
already done, would you please take care of this as well?



+   date
+   echo
+   echo "uname"
+   uname -a
+   echo
+   echo "os-release"
+   cat /etc/os-release
+   echo
+   echo "os-release"
+   cat /etc/os-release
+   echo
+   echo "dmesg output"
+   dmesg
+} > $CRASHDIR/info.txt
+if [ -x /usr/bin/lspci ]; then
+{
+   echo
+   echo "lspci"
+   lspci
+   } >> $CRASHDIR/info.txt
 fi


What about using the short syntax here:

[ -x /usr/bin/lspci ] && {
echo
echo "lspci"
lspci
} > test.txt

I would prefer to have all conditions in the script using the the short 
syntax as it seam to be the standard in the LEDE shell scripts.



-echo >> $CRASHDIR/info.txt
-echo "cpuinfo" >> $CRASHDIR/info.txt
-cat /proc/cpuinfo >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "meminfo" >> $CRASHDIR/info.txt
-cat /proc/cpuinfo >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "cmdline" >> $CRASHDIR/info.txt
-cat /proc/cmdline >> $CRASHDIR/info.txt
-echo >> $CRASHDIR/info.txt
-echo "lsmod" >> $CRASHDIR/info.txt
-lsmod >> $CRASHDIR/info.txt
+{
+echo
+echo "cpuinfo"
+cat /proc/cpuinfo
+echo
+echo "meminfo"
+cat /proc/cpuinfo
+echo
+echo "cmdline"
+cat /proc/cmdline
+echo
+echo "lsmod"
+lsmod
+} >> $CRASHDIR/info.txt
 }

 roll_crashes()
 {
 # Roll any existing crashes
-if [ -d $CRASHDIR ]
-   then
-   if [ -d $CRASHDIR.1 ]
-   then
+if [ -d $CRASHDIR ]; then
+   if [ -d $CRASHDIR.1 ]; then


Can't this simplified by using:

[ -d $CRASHDIR.1 ] && rm -fr $CRASHDIR.1
[ -d $CRASHDIR ] && mv $CRASHDIR $CRASHDIR.1

IMHO way better to read.


rm -fr $CRASHDIR.1
fi
mv $CRASHDIR $CRASHDIR.1
@@ -62,48 +64,46 @@ roll_crashes()
 }

 # ath10k, check debugfs entries.
-for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump
-do
-  #echo "Checking $i"
-  if cat $i > $TMPLOC/ath10k_crash.bin 2>&1
-  then
-  FOUND_BUG=1
-
-  #echo "Found ath10k crash data in $i"
-  roll_crashes
-
-  ADIR=${i/fw_crash_dump/}
-
-  CTFW=0
-  if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1
- then
- CTFW=1
-  fi
-
-  echo "Send bug reports to:" > $CRASHDIR/report_to.txt
-  if [ -f $ADIR/ct_special -o $CTFW == "1" ]
- then
- # Looks like this is CT firmware or driver...
- echo "gree...@candelatech.com" >> $CRASHDIR/report_to.txt
- echo "and/or report or check for duplicates here:" >> 
$CRASHDIR/report_to.txt
- echo "https://github.com/greearb/ath10k-ct/issues; >> 
$CRASHDIR/report_to.txt
-  else
- # Not sure who would want these bug reports for upstream...
- echo "https://www.lede-project.org/; >> $CRASHDIR/report_to.txt
-  fi
-  echo >> $CRASHDIR/report_to.txt
-  echo "Please attach all files in this directory to bug reports." >> 
$CRASHDIR/report_to.txt
-
-  mv $TMPLOC/ath10k_crash.bin $CRASHDIR
-
-  # Add any more ath10k specific stuff here.
-
-  # And call generic bug reporting logic
-  bugcheck_generic
-  fi
+for i in