android adb garget porting

 

1.kernel support
Device Drivers  --->
[*] USB support  --->
<*>   USB Gadget Support  --->   
USB Peripheral Controller (S3C HS/OtG USB Device controller)  --->   
<*>   USB Gadget Drivers (Android Gadget)  --->
[*]       Android gadget adb function                                                      
[*]       Android gadget mass storage function
2.mach-smdk6410
--- mach-smdk6410.c 2012-02-08 14:37:17.897565078 +0800
+++ samsung/arch/arm/mach-s3c64xx/mach-smdk6410.c 2012-02-08 14:49:58.569615227 +0800
@@ -74,6 +74,7 @@
 #include <linux/mtd/partitions.h>
 #include <plat/nand.h>
 #include <plat/regs-usb-hsotg-phy.h>
+#include <linux/usb/android_composite.h>
 
 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
@@ -419,6 +420,57 @@
 
 static struct map_desc smdk6410_iodesc[] = {};
 
+
+
+static char *usb_functions_ums[] = {
+ "usb_mass_storage",
+};
+
+static char *usb_functions_ums_adb[] = {
+ "usb_mass_storage",
+ "adb",
+};
+
+static char *usb_functions_all[] = {
+ "usb_mass_storage",
+ "adb",
+};
+
+
+static struct android_usb_product usb_products[] = {
+ {
+  .product_id  = 0x4e11,
+  .num_functions = ARRAY_SIZE(usb_functions_ums),
+  .functions  = usb_functions_ums,
+ },
+ {
+  .product_id  = 0x4e12,
+  .num_functions = ARRAY_SIZE(usb_functions_ums_adb),
+  .functions  = usb_functions_ums_adb,
+ },
+};
+
+static struct android_usb_platform_data android_usb_pdata = {
+ .vendor_id  = 0x18d1,
+ .product_id  = 0x4e11,
+ .version  = 0x0100,
+ .product_name = "OK6410",
+ .manufacturer_name = "Witech",
+ .serial_number = "OK6410_2011M04",
+ .num_products = ARRAY_SIZE(usb_products),
+ .products  = usb_products,
+ .num_functions = ARRAY_SIZE(usb_functions_all),
+ .functions  = usb_functions_all,
+};
+
+ struct platform_device s3c_device_android_usb = {
+ .name   = "android_usb",
+ .id    = -1,
+ .dev   = {
+  .platform_data = &android_usb_pdata,
+ },
+};
+
 static struct platform_device *smdk6410_devices[] __initdata = {
 #ifdef CONFIG_SMDK6410_SD_CH0
  &s3c_device_hsmmc0,
@@ -434,6 +486,7 @@
  &s3c64xx_device_iisv4,
 
  &s3c64xx_device_ac97,
+ &s3c_device_android_usb,
 #ifdef CONFIG_REGULATOR
  &smdk6410_b_pwr_5v,
 #endif
3.patching file arch/arm/plat-samsung/include/plat/devs.h

extern struct platform_device s3c_device_usb_mass_storage;
extern struct platform_device s3c_device_android_usb;

4.make zImage
drivers/usb/gadget/f_adb.c:207: error: 'TASK_NORMAL' undeclared (first use in this
function)
解决:在f_adb.c中加头文件#include <linux/sched.h>
5.usb otg连接PC
usb 1-2: device descriptor read/64, error -62
hub 1-0:1.0: unable to enumerate USB device on port 2

usb 1-2: new full speed USB device using s3c2410-ohci and address 2
usb 1-2: device descriptor read/64, error -62
usb 1-2: device descriptor read/64, error -62
usb 1-2: new full speed USB device using s3c2410-ohci and address 3
enabling adb
adb_open
usb 1-2: device descriptor read/64, error -62
usb 1-2: device descriptor read/64, error -62
usb 1-2: new full speed USB device using s3c2410-ohci and address 4
usb 1-2: device not accepting address 4, error -62
usb 1-2: new full speed USB device using s3c2410-ohci and address 5
usb 1-2: device not accepting address 5, error -62
hub 1-0:1.0: unable to enumerate USB device on port 2
s3c-hsotg s3c-hsotg: s3c_hsotg_corereset: reset failed, GRSTCTL=80000001
------------------------------------------------------------------------
没有探测到USB设备修改usb_driver的配置文件
usb_driver/android_winusb.inf
[Google.NTx86]
;OK6410_2011M04
%SingleAdbInterface%        = USB_Install, USB\VID_18d1&PID_4e12
%CompositeAdbInterface%     = USB_Install, USB\VID_18d1&PID_4e12&MI_01

[Google.NTamd64]
;OK6410_2011M04
%SingleAdbInterface%        = USB_Install, USB\VID_18d1&PID_4e12
%CompositeAdbInterface%     = USB_Install, USB\VID_18d1&PID_4e12&MI_01
6.PC上
D:\software\android-sdk-windows\tools>adb push fruit.apk /sdcard
adb shell
#ls

                                                                        

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值