cubieboard3的android系统用adb shell链接
2015-07-11 14:15
399 查看
cubieboard3的android系统用adb shell链接
环境 ubuntu 12.4
安装
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb
一、工具介绍
android-sdk-linux_x86/tools下有一堆工具,今天要用的是:Android Debug Bridge,在android开发过程中,这个工具是使用得最多的。(缩写adb,有点像gcc的gdb似的)
adb就是连接Android与PC端的桥梁,可以让用户在电脑上对手机进行全面的操作。
adb start-server – 实际上它会启动一个 adb fork-server server #
adb kill-server – kill掉
adb devices – 列出所有的设备
而且我们输入adb devices显示:
xxnan@xxnan-pt:~$ adb devices
List of devices attached
???????????? device
说明没有取得usb权限
二、设置usb权限
因为ubuntu这样的系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port #TTL
Bus 005 Device 010: ID 18d1:0003 Google Inc.
Bus 005 Device 007: ID 0e8f:0016 GreenAsia Inc. 4 port USB 1.1 hub UH-174
Bus 005 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 003 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse #鼠标
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
列表中,Bus 005 Device 007: ID 0e8f:0016 GreenAsia Inc. 4 port USB 1.1 hub UH-174 这一行为cubieboard3使用端口,记录一下,id为0e8f。
(I)
以普通用户链接
$cd /etc/udev/rules.d
/etc/udev/rules.d$ ls
70-persistent-net.rules 70-persistent-net.rules~ README
那么我们新建一个70-android.rules文件(sudo vim 70-android.rules),在这个文件中写上:
# USB adb
SUBSYSTEM=="usb",ATTRS{idVendor}=="0e8f",ATTRS{idProduct}=="0016",MODE="0666"
保存,再为70-android.rules加上权限(sudo chmod a+x 70-android.rules).
运行命令,重启udev:
$sudo chmod a+rx /etc/udev/rules.d/70-android.rules
$sudo service udev restart
三、重新启动adb server
(很重要)拔掉usb重新连上再执行:
sudo adb kill-server
adb devices
adb root (这一步很重要 )
完成,现在可以用adb shell 进入cubieboard3了进行开发了
(II)
进入 cd ~/.android
ls -la
adb_usb.ini
编辑 adb_usb.ini
把ATTRS{idVendor}=="0e8f" 即VID 0x0e8f
四、android ADB命令的使用
1. 查看设备
adb devices
这个命令是查看当前连接的设备, 连接到计算机的android设备或者模拟器将会列出显示
2. 安装软件
adb install
这个命令将指定的apk文件安装到设备上
3. 卸载软件
adb uninstall <软件名>
adb uninstall -k <软件名>
如果加 -k 参数,为卸载软件但是保留配置和缓存文件.
4. 登录设备shell
adb shell
adb shell
这个命令将登录设备的shell.
后面加将是直接运行设备命令, 相当于执行远程命令
5. 从电脑上发送文件到设备
adb push <本地路径> <远程路径>
用push命令可以把本机电脑上的文件或者文件夹复制到设备(手机)
6. 从设备上下载文件到电脑
adb pull <远程路径> <本地路径>
用pull命令可以把设备(手机)上的文件或者文件夹复制到本机电脑
7. 显示帮助信息
adb help
这个命令将显示帮助信息
脚本
adb wait-for-device - block until device is online 等待期设备知道设备在线时
adb start-server - ensure that there is a server running 启动其服务
adb kill-server - kill the server if it is running 对其运行了的服务通过此命令对其杀死
adb get-state - prints: offline | bootloader | device 获得其设备的状态
adb get-serialno - prints: <serial-number> 获得一系列的序列号信息
adb status-window - continuously print device status for a specified device连续打印指定的设备状态
adb remount - remounts the /system partition on the device read-write 对其设备读写进行重新安装
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program 重新加载或者是去恢复程序等
adb reboot-bootloader - reboots the device into the bootloader 对其重新启动的设备进行加载
adb root - restarts the adbd daemon with root permissions 重新启动后获得ROOT权限
adb usb - restarts the adbd daemon listening on USB 重新启动来监听器USB
adb logcat | more 显示日志:
adb_usb.ini
环境 ubuntu 12.4
安装
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb
一、工具介绍
android-sdk-linux_x86/tools下有一堆工具,今天要用的是:Android Debug Bridge,在android开发过程中,这个工具是使用得最多的。(缩写adb,有点像gcc的gdb似的)
adb就是连接Android与PC端的桥梁,可以让用户在电脑上对手机进行全面的操作。
adb start-server – 实际上它会启动一个 adb fork-server server #
adb kill-server – kill掉
adb devices – 列出所有的设备
而且我们输入adb devices显示:
xxnan@xxnan-pt:~$ adb devices
List of devices attached
???????????? device
说明没有取得usb权限
二、设置usb权限
因为ubuntu这样的系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port #TTL
Bus 005 Device 010: ID 18d1:0003 Google Inc.
Bus 005 Device 007: ID 0e8f:0016 GreenAsia Inc. 4 port USB 1.1 hub UH-174
Bus 005 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 003 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse #鼠标
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
列表中,Bus 005 Device 007: ID 0e8f:0016 GreenAsia Inc. 4 port USB 1.1 hub UH-174 这一行为cubieboard3使用端口,记录一下,id为0e8f。
(I)
以普通用户链接
$cd /etc/udev/rules.d
/etc/udev/rules.d$ ls
70-persistent-net.rules 70-persistent-net.rules~ README
那么我们新建一个70-android.rules文件(sudo vim 70-android.rules),在这个文件中写上:
# USB adb
SUBSYSTEM=="usb",ATTRS{idVendor}=="0e8f",ATTRS{idProduct}=="0016",MODE="0666"
保存,再为70-android.rules加上权限(sudo chmod a+x 70-android.rules).
运行命令,重启udev:
$sudo chmod a+rx /etc/udev/rules.d/70-android.rules
$sudo service udev restart
三、重新启动adb server
(很重要)拔掉usb重新连上再执行:
sudo adb kill-server
adb devices
adb root (这一步很重要 )
完成,现在可以用adb shell 进入cubieboard3了进行开发了
(II)
进入 cd ~/.android
ls -la
adb_usb.ini
编辑 adb_usb.ini
把ATTRS{idVendor}=="0e8f" 即VID 0x0e8f
四、android ADB命令的使用
1. 查看设备
adb devices
这个命令是查看当前连接的设备, 连接到计算机的android设备或者模拟器将会列出显示
2. 安装软件
adb install
这个命令将指定的apk文件安装到设备上
3. 卸载软件
adb uninstall <软件名>
adb uninstall -k <软件名>
如果加 -k 参数,为卸载软件但是保留配置和缓存文件.
4. 登录设备shell
adb shell
adb shell
这个命令将登录设备的shell.
后面加将是直接运行设备命令, 相当于执行远程命令
5. 从电脑上发送文件到设备
adb push <本地路径> <远程路径>
用push命令可以把本机电脑上的文件或者文件夹复制到设备(手机)
6. 从设备上下载文件到电脑
adb pull <远程路径> <本地路径>
用pull命令可以把设备(手机)上的文件或者文件夹复制到本机电脑
7. 显示帮助信息
adb help
这个命令将显示帮助信息
脚本
adb wait-for-device - block until device is online 等待期设备知道设备在线时
adb start-server - ensure that there is a server running 启动其服务
adb kill-server - kill the server if it is running 对其运行了的服务通过此命令对其杀死
adb get-state - prints: offline | bootloader | device 获得其设备的状态
adb get-serialno - prints: <serial-number> 获得一系列的序列号信息
adb status-window - continuously print device status for a specified device连续打印指定的设备状态
adb remount - remounts the /system partition on the device read-write 对其设备读写进行重新安装
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program 重新加载或者是去恢复程序等
adb reboot-bootloader - reboots the device into the bootloader 对其重新启动的设备进行加载
adb root - restarts the adbd daemon with root permissions 重新启动后获得ROOT权限
adb usb - restarts the adbd daemon listening on USB 重新启动来监听器USB
adb logcat | more 显示日志:
adb_usb.ini
相关文章推荐
- Linux Shell 数字计算与比较
- .bash_profile和.bashrc的什么区别
- xshell 配色方案 ubuntu solarized-Dark isayme
- bash之流程控制for循环及bash命令退出和退出状态码
- Linux下为可执行shell脚本文件(.sh),制作桌面启动快捷方式
- shell编程技术之-基础知识
- [Ubuntu--Shell]yum和apt-get的用法与区别
- [Ubuntu--Shell]ubuntu下一些压缩文件格式的解压与压缩
- shell排序
- shell入门之函数应用
- shell入门之函数应用
- shell入门之函数应用
- shell入门之函数应用 分类: 学习笔记 linux ubuntu 2015-07-10 21:48 77人阅读 评论(0) 收藏
- Bash 快捷键
- shell下进行文本编辑
- shell 编译和运行java文件
- Shell script之How to write
- QS之shell script
- Matlab使用新发现1(小技巧:shell 命令、工程工作目录设置相关)
- HDFS Shell基本操作总结