[Touch Pro, Fuze Android Development] redonkuless:
here is the patch file:

diff -Naur htc_kernel_eris_ps3/arch/arm/mach-msm/devices.c htc_kernel_eris_ps3-mod/arch/arm/mach-msm/devices.c

--- htc_kernel_eris_ps3/arch/arm/mach-msm/devices.c	2010-10-10 20:35:25.689109186 +0200

+++ htc_kernel_eris_ps3-mod/arch/arm/mach-msm/devices.c	2010-10-10 16:05:14.460250606 +0200

@@ -274,8 +274,10 @@

void __init msm_init_ums_lun(int lun_num)

{

+#ifdef CONFIG_USB_FUNCTION

if (lun_num > 0)

mass_storage_pdata.nluns = lun_num;

+#endif

}

void __init msm_register_usb_phy_init_seq(int *int_seq)

@@ -292,7 +294,9 @@

void __init msm_add_usb_id_pin_gpio(int usb_id_pin_io)

{

+#ifdef CONFIG_USB_FUNCTION

msm_hsusb_pdata.usb_id_pin_gpio = usb_id_pin_io;

+#endif

}

diff -Naur htc_kernel_eris_ps3/.config htc_kernel_eris_ps3-mod/.config

--- htc_kernel_eris_ps3/.config	2010-10-10 20:40:58.734651200 +0200

+++ htc_kernel_eris_ps3-mod/.config	2010-10-10 20:39:07.252090704 +0200

@@ -1,7 +1,7 @@

#

# Automatically generated make config: don't edit

# Linux kernel version: 2.6.29

-# Wed Sep 15 23:03:51 2010

+# Sun Oct 10 15:58:55 2010

#

CONFIG_ARM=y

CONFIG_SYS_SUPPORTS_APM_EMULATION=y

@@ -1188,7 +1188,7 @@

# CONFIG_USB_G_SERIAL is not set

# CONFIG_USB_MIDI_GADGET is not set

# CONFIG_USB_G_PRINTER is not set

-CONFIG_USB_ANDROID=m

+CONFIG_USB_ANDROID=y

# CONFIG_USB_CDC_COMPOSITE is not set

#

@@ -1199,20 +1199,8 @@

#

# USB Function Support

#

-CONFIG_USB_FUNCTION=y

+# CONFIG_USB_FUNCTION is not set

# CONFIG_USB_FUNCTION_MSM_HSUSB is not set

-# CONFIG_USB_FUNCTION_NULL is not set

-# CONFIG_USB_FUNCTION_ZERO is not set

-# CONFIG_USB_FUNCTION_LOOPBACK is not set

-# CONFIG_USB_FUNCTION_ADB is not set

-# CONFIG_USB_FUNCTION_UMS is not set

-# CONFIG_USB_FUNCTION_MASS_STORAGE is not set

-# CONFIG_USB_FUNCTION_DIAG is not set

-# CONFIG_USB_FUNCTION_ETHER is not set

-# CONFIG_USB_FUNCTION_FSYNC is not set

-# CONFIG_USB_FUNCTION_SERIAL is not set

-# CONFIG_USB_FUNCTION_PROJECTOR is not set

-# CONFIG_USB_FUNCTION_MTP_TUNNEL is not set

CONFIG_MMC=y

# CONFIG_MMC_DEBUG is not set

CONFIG_MMC_UNSAFE_RESUME=y

diff -Naur htc_kernel_eris_ps3/drivers/usb/gadget/android.c htc_kernel_eris_ps3-mod/drivers/usb/gadget/android.c

--- htc_kernel_eris_ps3/drivers/usb/gadget/android.c	2010-10-10 20:35:37.988089294 +0200

+++ htc_kernel_eris_ps3-mod/drivers/usb/gadget/android.c	2010-10-10 19:37:08.812090718 +0200

@@ -14,10 +14,10 @@

* GNU General Public License for more details.

*

*/

-

-/* #define DEBUG */

-/* #define VERBOSE_DEBUG */

-

+/*

+#define DEBUG

+#define VERBOSE_DEBUG

+*/

#include <linux/init.h>

#include <linux/module.h>

#include <linux/fs.h>

@@ -32,6 +32,8 @@

#include <linux/usb/ch9.h>

#include <linux/usb/composite.h>

#include <linux/usb/gadget.h>

+#include <linux/proc_fs.h>	/* Necessary because we use the proc fs */

+#include <asm/uaccess.h>	/* for copy_from_user */

#include "f_mass_storage.h"

#include "f_adb.h"

@@ -57,8 +59,16 @@

static const char longname[] = "Gadget Android";

+#define PROCFS_MAX_SIZE	100

+#define PROCFS_NAME	"dusb"

+static struct proc_dir_entry *Proc_File;

+static char procfs_buffer[PROCFS_MAX_SIZE];

+static unsigned long procfs_buffer_size = 0;

+static int disabled = 0;

+

/* Default vendor and product IDs, overridden by platform data */

-#define VENDOR_ID	0x18D1

+//#define VENDOR_ID	0x18D1

+#define VENDOR_ID	0x0BB4

#define PRODUCT_ID	0x0001

#define ADB_PRODUCT_ID	0x0002

@@ -307,6 +317,30 @@

.probe = android_probe,

};

+int procfile_write(struct file *file, const char *buffer, unsigned long count,

+	void *data)

+{

+	procfs_buffer_size = count;

+	if (procfs_buffer_size > PROCFS_MAX_SIZE ) {

+	procfs_buffer_size = PROCFS_MAX_SIZE;

+	}

+

+	if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) {

+	return -EFAULT;

+	}

+	if (procfs_buffer[0] == '1' && disabled == 0) {

+	android_usb_set_connected(0);

+	usb_composite_unregister(&android_usb_driver);

+	misc_deregister(&adb_enable_device);

+	platform_driver_unregister(&android_platform_driver);

+	kfree(_android_dev);

+	_android_dev = NULL;

+	printk(KERN_INFO "Disabled USB\n");

+	disabled = 1;

+	}

+	return procfs_buffer_size;

+}

+

static int __init init(void)

{

struct android_dev *dev;

@@ -323,6 +357,24 @@

dev->adb_product_id = ADB_PRODUCT_ID;

_android_dev = dev;

+	/* create the /proc file */

+	Proc_File = create_proc_entry(PROCFS_NAME, 0644, NULL);

+

+	if (Proc_File == NULL) {

+	remove_proc_entry(PROCFS_NAME, NULL);

+	printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",

+	PROCFS_NAME);

+	return -ENOMEM;

+	}

+

+	Proc_File->write_proc = procfile_write;

+	Proc_File->mode	= S_IFREG | S_IRUGO;

+	Proc_File->uid	= 0;

+	Proc_File->gid	= 0;

+	Proc_File->size	= 37;

+

+	printk(KERN_INFO "/proc/%s created\n", PROCFS_NAME);

+

ret = platform_driver_register(&android_platform_driver);

if (ret)

return ret;

diff -Naur htc_kernel_eris_ps3/drivers/usb/gadget/composite.c htc_kernel_eris_ps3-mod/drivers/usb/gadget/composite.c

--- htc_kernel_eris_ps3/drivers/usb/gadget/composite.c	2010-10-10 20:35:37.992089593 +0200

+++ htc_kernel_eris_ps3-mod/drivers/usb/gadget/composite.c	2010-10-10 11:59:52.177139590 +0200

@@ -1061,7 +1061,7 @@

.speed	= USB_SPEED_HIGH,

.bind	= composite_bind,

-	.unbind	= __exit_p(composite_unbind),

+	.unbind	= composite_unbind,

.setup	= composite_setup,

.disconnect	= composite_disconnect,

@@ -1110,7 +1110,7 @@

* This function is used to unregister drivers using the composite

* driver framework.

*/

-void __exit usb_composite_unregister(struct usb_composite_driver *driver)

+void usb_composite_unregister(struct usb_composite_driver *driver)

{

if (composite != driver)

return;

diff -Naur htc_kernel_eris_ps3/drivers/usb/gadget/f_adb.c htc_kernel_eris_ps3-mod/drivers/usb/gadget/f_adb.c

--- htc_kernel_eris_ps3/drivers/usb/gadget/f_adb.c	2010-10-10 20:35:37.996090661 +0200

+++ htc_kernel_eris_ps3-mod/drivers/usb/gadget/f_adb.c	2010-10-10 19:38:13.060092222 +0200

@@ -470,7 +470,8 @@

static int adb_release(struct inode *ip, struct file *fp)

{

printk(KERN_INFO "adb_release\n");

-	_unlock(&_adb_dev->open_excl);

+	if (_adb_dev)

+	_unlock(&_adb_dev->open_excl);

return 0;

}

diff -Naur htc_kernel_eris_ps3/drivers/usb/gadget/msm72k_udc.c htc_kernel_eris_ps3-mod/drivers/usb/gadget/msm72k_udc.c

--- htc_kernel_eris_ps3/drivers/usb/gadget/msm72k_udc.c	2010-10-10 20:35:38.008095190 +0200

+++ htc_kernel_eris_ps3-mod/drivers/usb/gadget/msm72k_udc.c	2010-10-10 19:40:22.248093259 +0200

@@ -41,8 +41,6 @@

#include <linux/device.h>

#include <mach/msm_hsusb_hw.h>

-#define CONFIG_ARCH_MSM7X00A

-

static const char driver_name[] = "msm72k_udc";

/* #define DEBUG */