From 5d3b79a053b332226526165c12860da397fa7363 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 3 May 2022 09:59:36 +0900 Subject: [PATCH] Apply new enums for usb-gadget mode Change-Id: Id4f1d01bb7e2f686632e24f2049ce22db72821ba Signed-off-by: Youngjae Cho --- CMakeLists.txt | 1 + packaging/mobileap-agent.spec | 1 + src/mobileap_usb.c | 15 ++++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 687b1b3..a240c9c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ SET(BASE_PKGS alarm-service capi-network-bluetooth capi-network-connection capi-network-wifi-manager + capi-system-device capi-system-info dbus-1 deviced diff --git a/packaging/mobileap-agent.spec b/packaging/mobileap-agent.spec index 745cb5e..71db888 100644 --- a/packaging/mobileap-agent.spec +++ b/packaging/mobileap-agent.spec @@ -10,6 +10,7 @@ Source2: org.tizen.MobileapAgent.service BuildRequires: pkgconfig(alarm-service) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(capi-network-wifi-manager) +BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(deviced) BuildRequires: pkgconfig(dlog) diff --git a/src/mobileap_usb.c b/src/mobileap_usb.c index cd5cd21..4c1b2ae 100755 --- a/src/mobileap_usb.c +++ b/src/mobileap_usb.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "mobileap.h" #include "mobileap_common.h" @@ -215,7 +216,7 @@ static void __handle_usb_mode_change(keynode_t *key, void *data) vconf_keynode_get_name(key), vconf_key); if (_mobileap_is_enabled(MOBILE_AP_STATE_USB)) { - if (vconf_key != SET_USB_RNDIS) { + if ((vconf_key & USB_GADGET_FUNC_RNDIS) == 0) { DBG("Is progressing for usb mode change\n"); return; } @@ -228,7 +229,7 @@ static void __handle_usb_mode_change(keynode_t *key, void *data) if (ret != 0) ERR("vconf_get_int is failed. but ignored [%d]\n", ret); - if (vconf_key != SET_USB_RNDIS) { + if ((vconf_key & USB_GADGET_FUNC_RNDIS) == 0) { ERR("USB Mode is changed suddenly\n"); if (!_mobileap_get_ipv6_state(MOBILE_AP_STATE_USB)) _disable_usb_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4); @@ -311,7 +312,7 @@ static void __handle_usb_mode_change(keynode_t *key, void *data) g_free(usb_hw_addr); g_free(usb_ipv6_addr); } else { - if (vconf_key == SET_USB_RNDIS) { + if (vconf_key & USB_GADGET_FUNC_RNDIS) { DBG("Is progressing for usb mode change\n"); return; } @@ -337,7 +338,7 @@ mobile_ap_error_code_e _enable_usb_tethering(Tethering *obj, mobile_ap_address_t { mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE; int vconf_ret; - int usb_mode = SET_USB_NONE; + int usb_mode = USB_GADGET_FUNC_NONE; char *usb_hw_addr = NULL; char *usb_ipv6_addr = NULL; @@ -390,7 +391,7 @@ mobile_ap_error_code_e _enable_usb_tethering(Tethering *obj, mobile_ap_address_t goto FAIL; } - if (usb_mode == SET_USB_RNDIS) { + if (usb_mode & USB_GADGET_FUNC_RNDIS) { vconf_ignore_key_changed(VCONFKEY_USB_CUR_MODE, __handle_usb_mode_change); if (address_type == MOBILE_AP_ADDRESS_TYPE_IPV4) { @@ -551,7 +552,7 @@ gboolean tethering_disable_usb_tethering(Tethering *obj, GDBusMethodInvocation *context, mobile_ap_address_type_e address_type) { mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE; - int usb_mode = SET_USB_NONE; + int usb_mode = USB_GADGET_FUNC_NONE; int vconf_ret = 0; DBG("+\n"); @@ -592,7 +593,7 @@ gboolean tethering_disable_usb_tethering(Tethering *obj, goto DONE; } - if (usb_mode != SET_USB_RNDIS) { + if ((usb_mode & USB_GADGET_FUNC_RNDIS) != 0) { DBG("Don't need to wait for usb-setting\n"); //LCOV_EXCL_LINE goto DONE; } -- 2.7.4