cubieboard3的android系统用adb shell链接

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值