adb 通过 wifi 连接 Android 设备

1. 需要 root 权限

代码修改点:

/system/extras/su/su.c

60     /* Until we have something better, only root and the shell can use su. */
61     myuid = getuid();
62     if (myuid != AID_ROOT && myuid != AID_SHELL) {
63         fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
64         return 1;
65     }

67   if(setgid(gid) || setuid(uid)) {
68       fprintf(stderr,"su: permission denied\n");
69        return 1;
70    }

把63,64,68,69 行注释掉,编译生成su,然后push到设备。

adb push su /system/xbin/ 
adb shell chmod 6755 /system/xbin/su

2. 安装 adbwireless 软件,一键搞定
在电子市场上搜 adb,前面两个随便选一个都行。
adb-wifi in market

如果电子市场上不了,在 Terminal Emulator 直接输入:

setprop service.adb.tcp.port 8000
stop adbd
start adbd

通过adb 连上设备,下面是我机器上的操作结果:
deli@deli-laptop:~$ adb connect 192.168.1.103:8000
already connected to 192.168.1.103:8000
deli@deli-laptop:~$ adb shell
# busybox sh
/ #

If you enjoyed this post, make sure you subscribe to my RSS feed!

Leave a Reply

Your email address will not be published. Required fields are marked *