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