--- 5df34c01ab71071396a02bf5709ac9d1dc8b21be +++ 25c80f7024f0de10f68dc2e582029b62f142187f @@ -32,6 +32,7 @@ #include #include +#include #define BULK_BUFFER_SIZE 4096 @@ -40,6 +41,7 @@ #define RX_REQ_MAX 32 static const char shortname[] = "android_adb"; +static struct wake_lock adb_idle_wake_lock; struct adb_dev { struct usb_function function; @@ -449,6 +451,7 @@ static ssize_t adb_write(struct file *fp r = -EIO; break; } + wake_lock_timeout(&adb_idle_wake_lock, HZ / 2); buf += xfer; count -= xfer; @@ -510,7 +513,7 @@ static int adb_enable_open(struct inode } printk(KERN_INFO "enabling adb\n"); - android_enable_function(&_adb_dev->function, 1, true); + android_enable_function(&_adb_dev->function, 1); return 0; } @@ -518,7 +521,7 @@ static int adb_enable_open(struct inode static int adb_enable_release(struct inode *ip, struct file *fp) { printk(KERN_INFO "disabling adb\n"); - android_enable_function(&_adb_dev->function, 0, true); + android_enable_function(&_adb_dev->function, 0); atomic_dec(&adb_enable_excl); return 0; } @@ -697,6 +700,10 @@ static int adb_bind_config(struct usb_co if (board_mfg_mode() != 2) dev->function.hidden = 1; +/* Workaround: enable adb first */ +#ifdef CONFIG_MACH_MECHA + dev->function.hidden = 0; +#endif /* _adb_dev must be set before calling usb_gadget_register_driver */ _adb_dev = dev; @@ -732,6 +739,7 @@ static struct android_usb_function adb_f static int __init init(void) { printk(KERN_INFO "f_adb init\n"); + wake_lock_init(&adb_idle_wake_lock, WAKE_LOCK_IDLE, "adb_idle_lock"); android_register_function(&adb_function); return 0; }