背景


在 Linux-3.8 以后,Android 的内核分支,便去掉了 f_adb,改使用 USB function FS,在用户空间实现 USB adb 功能。这篇文章依据原作者的 Google+ 文章,在 Atmel sama5 开发板上做了測试,将步骤记录例如以下,供须要使用的读者參考,你也能够查看作者原文:https://plus.google.com/111524780435806926688/posts/AaEccFjKNHE


在 Linux-3.10 上使能 USB ADB

编译内核时使能 USB FunctionFS


When building your kernel, make sure to configure in FunctionFS:

    Device Drivers -> USB Support -> USB Gadget Support

        -> USB Gadget Driver -> Function Filesystem

设置正确的 USB vendor ID 和 Product ID


这个设置能够放在 bootcmd 或者载入内核模块的时候通过參数传递:
Modify your boot parameters to set the vendor and product ids so adb on your host recognizes the device.

    g_ffs.idVendor=0x18d1 g_ffs.idProduct=0x4e26

Alternatively this can also be done if you built the gadget driver as a module at load time:

    insmod g_ffs.ko idVendor=0x18d1 idProduct=0x4e26



启动 Android 并挂载 functionFS, 使能 USB adb

Now here I'm assuming you've got a serial port working. Boot your target device with your new kernel (and insmod the g_ffs driver if necessary), and setup the functionfs directory:

    # mkdir /dev/usb-ffs
# mkdir /dev/usb-ffs/adb
# mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb


重新启动 adbd 守护进程

If everything is working, you can kill adbd and when it restarts it should find the functionfs mount and make use of it.

    # ps adbd
# kill <pid for adbd>

然后进入 cmd 或者 Linux Host 就能够成功连接 usb adb 获得 Android shell 了

On your host system, connect to the target using the adb program:

    $ ./adb shell
root@android:/#

Hooray there's your shell!



Android 4.4 Kitkat 使能 USB adb 功能的更多相关文章

  1. Android 4.4 KitKat 支持 u 盘功能

    Android U 盘功能实现和分析 u 盘功能实现结果: u 盘会当成 usb storage 在 Settings Storage 里面显示. 准备工作 内核需支持 usb host,需支持 FU ...

  2. android usb adb流程[转]

    android adb 概述 android adb的代码分为两部分: kernel层的代码在如下路径: drivers/usb/gadget/f_adb.c drivers/usb/gadget/a ...

  3. Android 4.4 KitKat终于支持录屏(Screen Recording)了!

    本文介绍了Android 4.4 KitKat系统新增加的录屏功能以及录屏方法,和限制因素.如果App由于版权方面的原因,不想被记录屏幕录像的话,APP只需要在相应的SurfaceView请求“Sur ...

  4. android USB OTG功能实现

    一个.检查HW概要,确认是否支持OTG特征(vbus无论是动力,IDDIG pin连接是否正确) 两.如果HW确认支持OTG特征,然后根据以下方法被打开USB OTG功能及实现山: 如何打开USB O ...

  5. android apk 的root 权限和USB adb 权限的差别

    USB adb 权限是指,当adb 连接手机时,手机中的守护进程adbd 的权限为root 权限,从而它的子进程也具有root 权限.通常假设adb shell 看到是: Android 4.0 以后 ...

  6. Android 4.4 KitKat 新特性

    New in Android 4.4 KitKat 本文是一个概览,关于KitKat,也即Android4.4的新东西,先是功能型的,之后是设计上的. 很多特性本文并没有提到,很多提到的特性也只是简短 ...

  7. [转] Android实时抓包分析 : 善用adb调试桥

    Android实时抓包分析 : 善用adb调试桥   谈到android网络抓包,很多人都能想到牛逼轰轰的神器tcpdump.方法就是在android机器上面安装tcpdump,然后通过-w参数把抓包 ...

  8. I.MX6 默认打开 USB adb

    /***************************************************************************** * I.MX6 默认打开 USB adb ...

  9. 【Xamarin挖墙脚系列:Android最重要的命令工具ADB】

    原文:[Xamarin挖墙脚系列:Android最重要的命令工具ADB] adb工具提供了很好的基于命令的对系统的控制. 以前说过,安卓的本质是运行在Linux上的虚机系统.在Linux中,对系统进行 ...

随机推荐

  1. 【LeetCode练习题】Combination Sum

    Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combin ...

  2. JQuery中阻止事件冒泡方式及其区别

    JQuery 提供了两种方式来阻止事件冒泡. 方式一:event.stopPropagation();         $("#div1").mousedown(function( ...

  3. C的|、||、&、&&、异或、~、!运算(转)

    位运算     位运算的运算分量只能是整型或字符型数据,位运算把运算对象看作是由二进位组成的位串信息,按位完成指定的运算,得到位串信息的结果. 位运算符有:     &(按位与).|(按位或) ...

  4. Swift中的设计模式

    设计模式(Design Pattern)是 对软件设计中普遍存在的各种问题,所提出的解决方案.这个术语是由埃里希·伽玛等人(Erich Gamma,Richard Helm,Ralph Johnson ...

  5. 教训:TOJ[4081] God Le wants to know the directory

    以前的字符串题本来就弱..2年不写就更弱了.嗯.留作教训 God Le is the most talented ACMer in the TJU-ACM team. When he wants to ...

  6. MVCC图示

    磨砺技术珠矶,践行数据之道,追求卓越价值 回到上一级页面:PostgreSQL内部结构与源代码研究索引页    回到顶级页面:PostgreSQL索引页 [作者:高健@博客园 luckyjackgao ...

  7. 几个因为hadoop配置文件不当造成的错误

    192.168.1.20: Exception in thread "main" java.lang.IllegalArgumentException 192.168.1.20: ...

  8. 在IIS上Office Word下载失败,检索 COM 类工厂中 CLSID 为000209FF的组件失败,80070005 拒绝访问。

    最近在做一个网站时,有一个下载word文档功能,在本地直接调试是可以下载的,但部署到IIS上就出现问题了. 出现问题如下:Error:下载简历方法出错:检索 COM 类工厂中 CLSID 为 {000 ...

  9. Hibernate 关联关系映射实例

    双向多对一/一对多(many-to-one/one-to-many) 例子,多个学生对应一个班级,一个班级对应多个学生: 班级类,Grade.java: public class Grade { pr ...

  10. PHP基础之 define() 函数

    定义和用法 define() 函数定义一个常量. 常量类似变量,不同之处在于: 在设定以后,常量的值无法更改 常量名不需要开头的美元符号 ($) 作用域不影响对常量的访问 常量值只能是字符串或数字 语 ...