This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit e4e43a1ca01f0f9b27d6722bd2dc90afba0278e8
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sun Jan 7 02:29:59 2024 +0800

    adb: Don't declare variables in the middle of function
    
    and unify the prefix from ADB to ADBD
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 system/adb/Kconfig    |  6 +++---
 system/adb/Makefile   | 14 +++++++-------
 system/adb/adb_main.c | 26 ++++++++++++++------------
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/system/adb/Kconfig b/system/adb/Kconfig
index bf71297df..fdf452520 100644
--- a/system/adb/Kconfig
+++ b/system/adb/Kconfig
@@ -128,17 +128,17 @@ config ADBD_FILE_SERVICE
 
 config ADBD_FILE_SYMLINK
        bool "File service symlink support"
-       default n
        depends on ADBD_FILE_SERVICE
        depends on PSEUDOFS_SOFTLINKS
+       default PSEUDOFS_SOFTLINKS
        ---help---
                Enable fs symlink support.
 
 config ADBD_SHELL_SERVICE
        bool "ADB shell support"
        depends on SYSTEM_NSH
-       select LIBC_EXECFUNCS
-       select PSEUDOTERM
+       depends on LIBC_EXECFUNCS
+       depends on PSEUDOTERM
        default n
        ---help---
                Enable "adb shell" feature.
diff --git a/system/adb/Makefile b/system/adb/Makefile
index 7926dec74..e299250fc 100644
--- a/system/adb/Makefile
+++ b/system/adb/Makefile
@@ -20,8 +20,8 @@
 
 include $(APPDIR)/Make.defs
 
-ADBD_URL ?= "https://github.com/spiriou/microADB/archive";
-ADBD_VERSION ?= b0bc09a7612000186df723f2fe55705b1c2fe873
+ADB_URL ?= "https://github.com/spiriou/microADB/archive";
+ADB_VERSION ?= b0bc09a7612000186df723f2fe55705b1c2fe873
 
 ADB_DIR := $(APPDIR)/system/adb
 ADB_UNPACKNAME := microADB
@@ -29,17 +29,17 @@ ADB_UNPACKDIR := $(ADB_DIR)/$(ADB_UNPACKNAME)
 
 $(ADB_UNPACKDIR):
        @echo "Downloading: $(ADB_UNPACKNAME)"
-       $(Q) curl -O -L $(ADBD_URL)/$(ADBD_VERSION).zip
-       $(Q) unzip -o $(ADBD_VERSION).zip
-       $(call DELFILE, $(ADBD_VERSION).zip)
-       $(call MOVEFILE, $(ADB_UNPACKNAME)-$(ADBD_VERSION), $(ADB_UNPACKDIR))
+       $(Q) curl -O -L $(ADB_URL)/$(ADB_VERSION).zip
+       $(Q) unzip -o $(ADB_VERSION).zip
+       $(call DELFILE, $(ADB_VERSION).zip)
+       $(call MOVEFILE, $(ADB_UNPACKNAME)-$(ADB_VERSION), $(ADB_UNPACKDIR))
 
 # adb server app
 
 PROGNAME  := $(CONFIG_ADBD_PROGNAME)
 PRIORITY  := $(CONFIG_ADBD_PRIORITY)
 STACKSIZE := $(CONFIG_ADBD_STACKSIZE)
-MODULE    := $(CONFIG_ADB_SERVER)
+MODULE    := $(CONFIG_SYSTEM_ADBD)
 
 # Files
 
diff --git a/system/adb/adb_main.c b/system/adb/adb_main.c
index a993fcb2f..080f5324a 100644
--- a/system/adb/adb_main.c
+++ b/system/adb/adb_main.c
@@ -33,7 +33,7 @@
 #endif
 
 #ifdef CONFIG_ADBD_NET_INIT
-#include "netutils/netinit.h"
+#  include "netutils/netinit.h"
 #endif
 
 /****************************************************************************
@@ -70,7 +70,7 @@ void adb_log_impl(int priority, FAR const char *func, int 
line,
   va_end(ap);
 }
 
-void adb_reboot_impl(const char *target)
+void adb_reboot_impl(FAR const char *target)
 {
 #ifdef CONFIG_BOARDCTL_RESET
   if (strcmp(target, "recovery") == 0)
@@ -94,6 +94,17 @@ int main(int argc, FAR char **argv)
 {
   adb_context_t *ctx;
 
+#ifdef CONFIG_ADBD_USB_BOARDCTL
+  struct boardioc_usbdev_ctrl_s ctrl;
+#  ifdef CONFIG_USBDEV_COMPOSITE
+  uint8_t usbdev = BOARDIOC_USBDEV_COMPOSITE;
+#  else
+  uint8_t usbdev = BOARDIOC_USBDEV_ADB;
+#  endif
+  FAR void *handle;
+  int ret;
+#endif
+
 #ifdef CONFIG_ADBD_BOARD_INIT
   boardctl(BOARDIOC_INIT, 0);
 #endif /* CONFIG_ADBD_BOARD_INIT */
@@ -102,15 +113,6 @@ int main(int argc, FAR char **argv)
 
   /* Setup USBADB device */
 
-  struct boardioc_usbdev_ctrl_s ctrl;
-#ifdef CONFIG_USBDEV_COMPOSITE
-  uint8_t usbdev = BOARDIOC_USBDEV_COMPOSITE;
-#else
-  uint8_t usbdev = BOARDIOC_USBDEV_ADB;
-#endif
-  FAR void *handle;
-  int ret;
-
   /* Perform architecture-specific initialization */
 
   ctrl.usbdev   = usbdev;
@@ -151,7 +153,7 @@ int main(int argc, FAR char **argv)
   ctx = adb_hal_create_context();
   if (!ctx)
     {
-      return -1;
+      return 1;
     }
 
   adb_hal_run(ctx);

Reply via email to