本例是解决ffbm模式 adb未授权,无法连接的问,其他情况类似,做个记录做备忘
原理:
如果是ffbm模式启动,则函数 int adb_auth_verify(uint8_t* token, uint8_t* sig, int siglen) 直接返回1
路径:system/core/adb/adb_auth_client.cpp
commit dd9ea32488c4064fd958019de1ae825d5bbfa038
Author: xxx <xxx@localhost>Date: Tue Nov 15 20:23:00 2016 +0800
user版本ffbm模式 adb未授权,无法连接
Change-Id: I1f847ab4bfe76eaef82e10bebf1e3d1dbcbe7848
diff --git a/system/core/adb/adb_auth_client.cpp b/system/core/adb/adb_auth_client.cpp
index 8e7d38be..1ec4339 100644
--- a/system/core/adb/adb_auth_client.cpp
+++ b/system/core/adb/adb_auth_client.cpp
@@ -32,6 +32,8 @@
#include "fdevent.h"
#include "transport.h"
+#include "cutils/properties.h"
+
struct adb_public_key {
struct listnode node;
RSAPublicKey key;
@@ -43,6 +45,13 @@ static const char *key_paths[] = {
NULL
};
+static const char *ffbm_boot_mode_string[] = {
+ "ffbm-00",
+ "ffbm-01",
+ "ffbm-02"
+};
+
+
static fdevent listener_fde;
static int framework_fd = -1;
@@ -143,6 +152,19 @@ int adb_auth_verify(uint8_t* token, uint8_t* sig, int siglen)
struct listnode *item;
struct listnode key_list;
int ret = 0;
+
+//jimbo add start for ffbm adb connect
+ char boot_mode[PROPERTY_VALUE_MAX] = { 0 };
+ unsigned long i = 0;
+
+ /**Get mode from misc boot mode,overwrite the config file mode*/
+ property_get("ro.bootmode", boot_mode, "normal");
+ for(i = 0; i < sizeof(ffbm_boot_mode_string) / sizeof(char *); i++) {
+ if(!strcmp(ffbm_boot_mode_string[i], boot_mode)) {
+ return 1;
+ }
+ }
+//jimbo add end
if (siglen != RSANUMBYTES)
return 0;