Android Adb Gadget Driver

来源:互联网 发布:程序员 私活 编辑:程序博客网 时间:2024/05/07 15:03

Android Adb Gadget Driver

Marvell PXA310, Linux kernel 2.6.25


1. adb gadget file: drivers/usb/gadget/android_adb.c


2. Configs need enabled:

CONFIG_USB=y
CONFIG_USB_OTG=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_COMPOSITE=y
CONFIG_USB_GADGET_PXA3XX_U2D=y
CONFIG_USB_PXA3XX_U2D=y
CONFIG_USB_OTG_PXA3xx_U2D=y
CONFIG_USB_OTG_PXA3XX=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_ADB_GADGET=m


3. Make and generate the module: g_android_adb.ko


4. Install adb gadget: insmod /lib/modules/g_android_adb.ko


5. $ lsusb
Bus 004 Device 009: ID 18d1:dddd 


6. In your host Linux PC (I am using Ubuntu), create a file "/etc/udev/rules.d/50-android.rules" with following contents:
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

In which, the "18d1" is the USB device's vendor ID which is hard-coded in android_adb.c. you can change it or not, but if you change, remember to change both the 50-android.rules file and android_adb.c file.

After creating the file, execute command:
$chmod a+rx /etc/udev/rules.d/50-android.rules


7. Now connect your device with your host PC with USB cable, go to "out/host/linux-x86/bin" in your Android source tree directory and execute command:
$./adb devices


You will get:
List of devices attached
0123456789ABCDEF        device

原创粉丝点击