1. 查看手机ID号。
charlesxue@THSHIBA:~/setup/cocos2d-x/cocos2d-x-2.1.4/projects/simpleGame/proj.android/bin$ lsusb Bus 001 Device 002: ID 10f1:1a19 Importek Bus 001 Device 003: ID 0bda:0159 Realtek Semiconductor Corp. Digital Media Card Reader Bus 002 Device 005: ID 05c6:9031 Qualcomm, Inc. Bus 002 Device 003: ID 0bda:8197 Realtek Semiconductor Corp. RTL8187B Wireless Adapter Bus 006 Device 002: ID 062a:4101 Creative Labs Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
想知道哪个是手机的usb口,很简单的办法就是插上手机执行一下lusb命令,然后拔掉手机再次执行一下lusb比较一下打印结果。在这里我的手机usb驱动是
Bus 002 Device 005: ID 05c6:9031 Qualcomm, Inc.
在这一步今天碰到一个比较怪的问题是手机的usb显示如下:
Bus 002 Device 005: ID 2171:9031
只显示这些内容。然后执行adb devices 也检测不到任何设备。这时用拨号方法打开usb调试即可解决--在拨号键盘输入*#*#717717#*#*.
2.写驱动配置文件。
创建文件 /etc/udev/rules.d/51-android.rules 并写入
1 SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
更改权限
sudo chmod ax+r /etc/udev/rules.d/51-android.rules
3.重启usb设备
sudo /etc/init.d/udev restart
4.重启adb服务。
adb kill-server
adb start-server
5.查看设备是否检测到
adb devices
List of devices attached 20444975 unauthorized