1.首先需要在Android设备上使能USB方式的ADB功能,不同的Android厂家设备有不同的方法:
以Philips TV为例:
(1).开机时按住SPACE键进入Uboot命令行模式,输入
mt5890 # addboot ssusb_adb=1
(2).确认使能信息已经配置到系统中
mt5890 # pri
... ssusb_adb=1 ...
(3).重启系统
mt5890 # reset
2.使用USB线(公对公)连接 Philips TV 和 Ubuntu,在Ubuntu系统上检查是否识别到PhilipsTV设备:
root@TpvUbuntu:~# lsusb
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 04f2:b2fa Chicony Electronics Co., Ltd
Bus 003 Device 003: ID 147e:1002 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 003: ID 17ef:6019 Lenovo
Bus 001 Device 010: ID 18d1:0d02 Google Inc. Celkon A88
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
NOTE: idVendor=0x18d1, idProduct=0x0d02
3.让Ubuntu支持USB所连接的Android设备.
root@TpvUbuntu:~# echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="0d02", MODE="0600" , OWNER=="jielong.lin" ' > /etc/udev/rules.d/50-android.rules
root@TpvUbuntu:~# chmod 0777 /etc/udev/rules.d/50-android.rules
root@TpvUbuntu:~# mkdir -pv ~/.android
root@TpvUbuntu:~# echo '0x18d1' > ~/.android/adb_usb.ini
4.验证测试
aptitude install android-tools-adb # If failure but android studio has been installed, you can use platform-tools/adb in Android Studio
adb kill-server
adb devices
adb shell
root@QM16XE_U:/ #
以上在root用户环境中验证成功,普通非root用户会失败!
常见的问题是:
no permissions (udev requires plugdev group membership): 原因是当前用户不在plugdev用户组当中,可以通过usermod -a -G plugdev $(whoami)解决!
no permissions (verify udev rules): 原因是/etc/udev/rules.d/50-android.rules 规则可能没有GROUP="plugdev",建议将OWNER=="jielong.lin"改成GROUP="plugdev"