From dacd722426e68ac39fcef045574c7618951836ae Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Fri, 28 Aug 2020 16:19:17 +0530 Subject: [PATCH] Fix driver activation logic based on multi-interface support Change-Id: I44acf6d855b282b57d205f544110da8086be5988 Signed-off-by: Nishant Chaprana --- packaging/mobileap-agent.spec | 2 +- src/mobileap_softap.c | 32 +++++--------------------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/packaging/mobileap-agent.spec b/packaging/mobileap-agent.spec index e9c3cf3..c6f0e52 100644 --- a/packaging/mobileap-agent.spec +++ b/packaging/mobileap-agent.spec @@ -1,6 +1,6 @@ Name: mobileap-agent Summary: Mobile AP daemon for setting tethering environments -Version: 1.0.137 +Version: 1.0.138 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/mobileap_softap.c b/src/mobileap_softap.c index 4418dfd..af9427a 100755 --- a/src/mobileap_softap.c +++ b/src/mobileap_softap.c @@ -83,7 +83,6 @@ struct in6_ifreq { static void __generate_eui64_address(int idx, const char *hw_addr, char **eui64_addr); #endif -static gboolean g_is_wifi_sharing = FALSE; static gboolean __hostapd_connect_timer_cb(gpointer user_data); static char *__find_first_caps_char(char *str) @@ -829,7 +828,7 @@ static mobile_ap_drv_interface_e __get_drv_interface(void) return drv_interface; } -static int __mh_core_softap_firmware_start(const char *tether_type, const char *src_if) +static int __mh_core_softap_firmware_start(const char *ifname) { int err = 0; DBusError error; @@ -839,18 +838,6 @@ static int __mh_core_softap_firmware_start(const char *tether_type, const char * DBusConnection *connection = NULL; const char *device = "softap"; - if (g_strcmp0(tether_type, "wifi_sharing") == 0) { - char buf[20] = { 0, }; - - g_is_wifi_sharing = TRUE; - snprintf(buf, sizeof(buf), "%s_%s", "wifi_sharing", src_if); - device = buf; - - } else { - char buf[20] = { 0, }; - snprintf(buf, sizeof(buf), "%s_%s", device, src_if); - device = buf; - } DBG("Start Device: %s", device); DBG("+"); @@ -870,6 +857,7 @@ static int __mh_core_softap_firmware_start(const char *tether_type, const char * dbus_message_iter_init_append(message, &iter); dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &device); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &ifname); dbus_error_init(&error); @@ -900,7 +888,7 @@ static int __mh_core_softap_firmware_start(const char *tether_type, const char * return err; } -static int __mh_core_softap_firmware_stop(const char *src_if) +static int __mh_core_softap_firmware_stop(const char *ifname) { int err = 0; DBusError error; @@ -910,17 +898,6 @@ static int __mh_core_softap_firmware_stop(const char *src_if) DBusConnection *connection = NULL; const char *device = "softap"; - if (g_is_wifi_sharing == TRUE) { - char buf[20] = { 0, }; - snprintf(buf, sizeof(buf), "%s_%s", "wifi_sharing", src_if); - device = buf; - - } else { - char buf[20] = { 0, }; - snprintf(buf, sizeof(buf), "%s_%s", device, src_if); - device = buf; - } - DBG("Stop device: %s", device); connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); @@ -939,6 +916,7 @@ static int __mh_core_softap_firmware_stop(const char *src_if) dbus_message_iter_init_append(message, &iter); dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &device); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &ifname); dbus_error_init(&error); @@ -994,7 +972,7 @@ int _mh_core_enable_softap(const mobile_ap_type_e type, softap_settings_t *setti return MOBILE_AP_ERROR_INTERNAL; } - if (__mh_core_softap_firmware_start(settings->tether_type, if_name) < 0) + if (__mh_core_softap_firmware_start(if_name) < 0) return MOBILE_AP_ERROR_INTERNAL; drv_interface = __get_drv_interface(); -- 2.7.4