From: Youngjae Cho Date: Mon, 2 May 2022 08:06:31 +0000 (+0900) Subject: usb-gadget: add dummy operations for emulator X-Git-Tag: accepted/tizen/unified/20220505.134703^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F274556%2F1;p=platform%2Fcore%2Fsystem%2Fdeviced.git usb-gadget: add dummy operations for emulator Change-Id: I6491d3b918073ab9990a8c6d065c64badcf40d73 Signed-off-by: Youngjae Cho --- diff --git a/src/usb-gadget/usb-gadget-ops.c b/src/usb-gadget/usb-gadget-ops.c index 14d7a20..ededc18 100644 --- a/src/usb-gadget/usb-gadget-ops.c +++ b/src/usb-gadget/usb-gadget-ops.c @@ -8,6 +8,7 @@ #include #include +#include #include "usb-gadget-ops.h" #include "usb-gadget-cfs-ops.h" @@ -37,6 +38,31 @@ static GList *service_config_list; static char board_serial[128] = "01234TEST"; +static int dummy_usb_gadget_open(void) +{ + return 0; +} + +static int dummy_usb_gadget_close(void) +{ + return 0; +} + +static int dummy_usb_gadget_enable(void) +{ + return 0; +} + +static int dummy_usb_gadget_disable(void) +{ + return 0; +} + +static int dummy_usb_gadget_reconfigure(struct usb_gadget *gadget) +{ + return 0; +} + static void rndis_handler(int enable) { if (enable) @@ -459,7 +485,13 @@ int usb_gadget_ops_init(void) libsys_config_parse_by_section(PATH_USB_GADGET_CONF, load_usb_gadget_config, NULL); - if (usb_gadget_legacy_supported()) { + if (is_emulator()) { + __usb_gadget_open = dummy_usb_gadget_open; + __usb_gadget_close = dummy_usb_gadget_close; + __usb_gadget_enable = dummy_usb_gadget_enable; + __usb_gadget_disable = dummy_usb_gadget_disable; + __usb_gadget_reconfigure = dummy_usb_gadget_reconfigure; + } else if (usb_gadget_legacy_supported()) { usb_gadget_bind_legacy_ops(&__usb_gadget_open, &__usb_gadget_close, &__usb_gadget_enable,