crosh: add network_logging wifi and reset

Improve the `wifi` subcommand to include driver debugging, and add a
`reset` subcommand.

Wifi driver debugging is currently only supported for Marvell mwifiex,
but it should be possible to add other Wifi driver interfaces where they
exist. The DBus API will print out 'true' or 'false' depending on
whether the debugging feature is supported (and successfully
enabled/disabled).

BUG=chrome-os-partner:59342
TEST=crosh `network_logging wifi` and `network_logging reset`

Change-Id: Ia6581c67aefa219cec2bbfbb03888f50a34f82d7
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/423193
Reviewed-by: Kirtika Ruchandani <kirtika@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit 0cf423ae89b331bb272059b8f3225c742bbd06fe)
Reviewed-on: https://chromium-review.googlesource.com/431417
diff --git a/crosh/crosh b/crosh/crosh
index a83e7b0..2e4d64a 100755
--- a/crosh/crosh
+++ b/crosh/crosh
@@ -498,28 +498,32 @@
   esac
 )
 
-USAGE_network_logging='<wifi | cellular | ethernet>'
+USAGE_network_logging='<wifi | cellular | ethernet | reset>'
 HELP_network_logging='
   A function that enables a predefined set of tags useful for
-  debugging the specified device.
+  debugging the specified device. Can be used incrementally, then
+  reset to default with the "reset" subcommand.
 '
 cmd_network_logging() (
   if [ -n "$1" ]; then
     case "$1" in
       "wifi")
-        echo; /usr/bin/ff_debug service+wifi+inet+device+manager
+        echo; /usr/bin/ff_debug +service+wifi+inet+device+manager
         echo; /usr/bin/wpa_debug msgdump
-        echo; /usr/bin/modem set-logging info
+        echo; printf "Enable wifi debugging: "; debugd SetWifiDriverDebug int32:1
         ;;
       "cellular")
-        echo; /usr/bin/ff_debug service+cellular+modem+device+manager
-        echo; /usr/bin/wpa_debug info
+        echo; /usr/bin/ff_debug +service+cellular+modem+device+manager
         echo; /usr/bin/modem set-logging debug
         ;;
       "ethernet")
-        echo; /usr/bin/ff_debug service+ethernet+device+manager
-        echo; /usr/bin/wpa_debug info
+        echo; /usr/bin/ff_debug +service+ethernet+device+manager
+        ;;
+      "reset")
+        echo; /usr/bin/ff_debug --reset
+        echo; /usr/bin/wpa_debug --reset
         echo; /usr/bin/modem set-logging info
+        echo; printf "Disable wifi debugging: "; debugd SetWifiDriverDebug int32:0
         ;;
       *)
         help "unknown option: $1"