From a12b77f1b7f906004caeb163c0968fb69e6a1b5c Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Mon, 3 Feb 2020 19:02:37 +0900 Subject: [PATCH] Extend USB gadget configuration for usb debug mode. In MCD user mode binary, sdb is disabled and mtp mode is only enabled. When you enable debug mode(on Setting menu), both sdb is enabled. As a result, sdb and mtp are enabled. But, there were no configuration of SDB + MTP mode. Device log at this situation. ////////////////////////////////////////////////////////////////////// 01-15 22:25:31.787 I/DEVICED (P 2608, T 2608): usb-debug.c: usb_debug_changed(64) > USB debug ON. 01-15 22:25:31.788 I/DEVICED (P 2608, T 2608): usb-debug.c: usb_debug_mode_changed(81) > Previous mode(1). 01-15 22:25:31.788 I/DEVICED (P 2608, T 2608): usb-debug.c: usb_debug_mode_changed(88) > New mode(5). 01-15 22:25:31.789 E/DEVICED (P 2608, T 2608): usb.c: usb_change_gadget(244) > Unable to translate id into gadget: -22 01-15 22:25:31.789 E/DEVICED (P 2608, T 2608): usb.c: usb_change_mode(332) > Failed to change gadget: -22 /////////////////////////////////////////////////////////////////////// Change-Id: Ic3f5420603b8ef02411ed429540542710415685b --- hw/usb_gadget_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c index 7416790..0b79539 100644 --- a/hw/usb_gadget_common.c +++ b/hw/usb_gadget_common.c @@ -263,6 +263,14 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id, gadget->attrs.idProduct = 0x6860; break; + case USB_FUNCTION_MTP | USB_FUNCTION_SDB: + n_configs = 1; + functions[0][0] = USB_FUNCTION_MTP; + functions[0][1] = USB_FUNCTION_SDB; + functions[0][2] = 0; + gadget->attrs.idProduct = 0x6860; + break; + case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB: n_configs = 1; functions[0][0] = USB_FUNCTION_MTP; -- 2.34.1