Extend USB gadget configuration for usb debug mode. 33/223733/1 submit/tizen_5.5/20200205.031401
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 3 Feb 2020 10:02:37 +0000 (19:02 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 3 Feb 2020 10:14:32 +0000 (10:14 +0000)
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

index 7416790..0b79539 100644 (file)
@@ -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;