adb: Don't declare variables in the middle of function

and unify the prefix from ADB to ADBD

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-01-07 02:29:59 +08:00 committed by GUIDINGLI
parent db0e0b9bfe
commit e4e43a1ca0
3 changed files with 24 additions and 22 deletions

View File

@ -128,17 +128,17 @@ config ADBD_FILE_SERVICE
config ADBD_FILE_SYMLINK config ADBD_FILE_SYMLINK
bool "File service symlink support" bool "File service symlink support"
default n
depends on ADBD_FILE_SERVICE depends on ADBD_FILE_SERVICE
depends on PSEUDOFS_SOFTLINKS depends on PSEUDOFS_SOFTLINKS
default PSEUDOFS_SOFTLINKS
---help--- ---help---
Enable fs symlink support. Enable fs symlink support.
config ADBD_SHELL_SERVICE config ADBD_SHELL_SERVICE
bool "ADB shell support" bool "ADB shell support"
depends on SYSTEM_NSH depends on SYSTEM_NSH
select LIBC_EXECFUNCS depends on LIBC_EXECFUNCS
select PSEUDOTERM depends on PSEUDOTERM
default n default n
---help--- ---help---
Enable "adb shell" feature. Enable "adb shell" feature.

View File

@ -20,8 +20,8 @@
include $(APPDIR)/Make.defs include $(APPDIR)/Make.defs
ADBD_URL ?= "https://github.com/spiriou/microADB/archive" ADB_URL ?= "https://github.com/spiriou/microADB/archive"
ADBD_VERSION ?= b0bc09a7612000186df723f2fe55705b1c2fe873 ADB_VERSION ?= b0bc09a7612000186df723f2fe55705b1c2fe873
ADB_DIR := $(APPDIR)/system/adb ADB_DIR := $(APPDIR)/system/adb
ADB_UNPACKNAME := microADB ADB_UNPACKNAME := microADB
@ -29,17 +29,17 @@ ADB_UNPACKDIR := $(ADB_DIR)/$(ADB_UNPACKNAME)
$(ADB_UNPACKDIR): $(ADB_UNPACKDIR):
@echo "Downloading: $(ADB_UNPACKNAME)" @echo "Downloading: $(ADB_UNPACKNAME)"
$(Q) curl -O -L $(ADBD_URL)/$(ADBD_VERSION).zip $(Q) curl -O -L $(ADB_URL)/$(ADB_VERSION).zip
$(Q) unzip -o $(ADBD_VERSION).zip $(Q) unzip -o $(ADB_VERSION).zip
$(call DELFILE, $(ADBD_VERSION).zip) $(call DELFILE, $(ADB_VERSION).zip)
$(call MOVEFILE, $(ADB_UNPACKNAME)-$(ADBD_VERSION), $(ADB_UNPACKDIR)) $(call MOVEFILE, $(ADB_UNPACKNAME)-$(ADB_VERSION), $(ADB_UNPACKDIR))
# adb server app # adb server app
PROGNAME := $(CONFIG_ADBD_PROGNAME) PROGNAME := $(CONFIG_ADBD_PROGNAME)
PRIORITY := $(CONFIG_ADBD_PRIORITY) PRIORITY := $(CONFIG_ADBD_PRIORITY)
STACKSIZE := $(CONFIG_ADBD_STACKSIZE) STACKSIZE := $(CONFIG_ADBD_STACKSIZE)
MODULE := $(CONFIG_ADB_SERVER) MODULE := $(CONFIG_SYSTEM_ADBD)
# Files # Files

View File

@ -33,7 +33,7 @@
#endif #endif
#ifdef CONFIG_ADBD_NET_INIT #ifdef CONFIG_ADBD_NET_INIT
#include "netutils/netinit.h" # include "netutils/netinit.h"
#endif #endif
/**************************************************************************** /****************************************************************************
@ -70,7 +70,7 @@ void adb_log_impl(int priority, FAR const char *func, int line,
va_end(ap); va_end(ap);
} }
void adb_reboot_impl(const char *target) void adb_reboot_impl(FAR const char *target)
{ {
#ifdef CONFIG_BOARDCTL_RESET #ifdef CONFIG_BOARDCTL_RESET
if (strcmp(target, "recovery") == 0) if (strcmp(target, "recovery") == 0)
@ -94,6 +94,17 @@ int main(int argc, FAR char **argv)
{ {
adb_context_t *ctx; 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 #ifdef CONFIG_ADBD_BOARD_INIT
boardctl(BOARDIOC_INIT, 0); boardctl(BOARDIOC_INIT, 0);
#endif /* CONFIG_ADBD_BOARD_INIT */ #endif /* CONFIG_ADBD_BOARD_INIT */
@ -102,15 +113,6 @@ int main(int argc, FAR char **argv)
/* Setup USBADB device */ /* 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 */ /* Perform architecture-specific initialization */
ctrl.usbdev = usbdev; ctrl.usbdev = usbdev;
@ -151,7 +153,7 @@ int main(int argc, FAR char **argv)
ctx = adb_hal_create_context(); ctx = adb_hal_create_context();
if (!ctx) if (!ctx)
{ {
return -1; return 1;
} }
adb_hal_run(ctx); adb_hal_run(ctx);