From cdc5af313099c6862fa7632c4807b85939c88169 Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Tue, 12 Sep 2023 16:24:59 +0900 Subject: [PATCH] Added dbus method to get whether 6GHz band is supported Change-Id: Ic7655ec24fa978f7225c0ccd767fb4aa93feb562 Signed-off-by: Jaehyun Kim --- gsupplicant/gsupplicant.h | 1 + gsupplicant/supplicant.c | 16 +++++++++++++++- include/device.h | 3 +++ plugins/wifi.c | 12 ++++++++++++ src/connman-robot.conf | 1 + src/connman.conf | 1 + src/device.c | 12 ++++++++++++ src/technology.c | 37 +++++++++++++++++++++++++++++++++++++ 8 files changed, 82 insertions(+), 1 deletion(-) diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 7f8a7a4..f49ad80 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -427,6 +427,7 @@ void *g_supplicant_interface_get_data(GSupplicantInterface *interface); const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface); #if defined TIZEN_EXT bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface); +bool g_supplicant_interface_get_is_6_0_ghz_supported(GSupplicantInterface *interface); unsigned char *g_supplicant_interface_get_add_network_bssid(GSupplicantInterface *interface); typedef void (*GSupplicantMacPolicyCallback) (int result, unsigned int policy, void *user_data); diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index c268703..0f44766 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -265,6 +265,7 @@ struct _GSupplicantInterface { struct added_network_information network_info; #if defined TIZEN_EXT dbus_bool_t is_5_0_Ghz_supported; + dbus_bool_t is_6_0_Ghz_supported; int disconnect_reason; #endif #if defined TIZEN_EXT @@ -1314,6 +1315,11 @@ static void interface_capability(const char *key, DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &is_5_0_Ghz_supported); interface->is_5_0_Ghz_supported = is_5_0_Ghz_supported; + } else if (g_strcmp0(key, "Is6GhzSupported") == 0) { + dbus_bool_t is_6_0_Ghz_supported; + + dbus_message_iter_get_basic(iter, &is_6_0_Ghz_supported); + interface->is_6_0_Ghz_supported = is_6_0_Ghz_supported; #endif } else SUPPLICANT_DBG("key %s type %c", @@ -1425,11 +1431,19 @@ const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface) bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface) { if (!interface) - return NULL; + return false; return interface->is_5_0_Ghz_supported; } +bool g_supplicant_interface_get_is_6_0_ghz_supported(GSupplicantInterface *interface) +{ + if (!interface) + return false; + + return interface->is_6_0_Ghz_supported; +} + unsigned char *g_supplicant_interface_get_add_network_bssid(GSupplicantInterface *interface) { if (!interface) diff --git a/include/device.h b/include/device.h index 8cc8cce..acbd1d5 100755 --- a/include/device.h +++ b/include/device.h @@ -118,7 +118,10 @@ void connman_device_set_max_scan_ssids(struct connman_device *device, int connman_device_get_max_scan_ssids(struct connman_device *device); void connman_device_set_wifi_5ghz_supported(struct connman_device *device, bool is_5_0_ghz_supported); +void connman_device_set_wifi_6ghz_supported(struct connman_device *device, + bool is_6_0_ghz_supported); bool connman_device_get_wifi_5ghz_supported(struct connman_device *device); +bool connman_device_get_wifi_6ghz_supported(struct connman_device *device); #endif int connman_device_remove_network(struct connman_device *device, struct connman_network *network); diff --git a/plugins/wifi.c b/plugins/wifi.c index befc7e2..36e2262 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -2718,7 +2718,17 @@ static void interface_create_callback(int result, wifi->interface = interface; g_supplicant_interface_set_data(interface, wifi); +#ifdef TIZEN_EXT + if (interface && wifi->device && + !connman_device_get_wifi_5ghz_supported(wifi->device) && + !connman_device_get_wifi_6ghz_supported(wifi->device)) { + bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface); + bool is_6_0_ghz_supported = g_supplicant_interface_get_is_6_0_ghz_supported(interface); + connman_device_set_wifi_5ghz_supported(wifi->device, is_5_0_ghz_supported); + connman_device_set_wifi_6ghz_supported(wifi->device, is_6_0_ghz_supported); + } +#endif if (g_supplicant_interface_get_ready(interface)) { wifi->interface_ready = true; finalize_interface_creation(wifi); @@ -4485,6 +4495,7 @@ static void interface_added(GSupplicantInterface *interface) #if defined TIZEN_EXT bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface); + bool is_6_0_ghz_supported = g_supplicant_interface_get_is_6_0_ghz_supported(interface); #endif struct wifi_data *wifi; @@ -4512,6 +4523,7 @@ static void interface_added(GSupplicantInterface *interface) connman_device_set_powered(wifi->device, true); #if defined TIZEN_EXT connman_device_set_wifi_5ghz_supported(wifi->device, is_5_0_ghz_supported); + connman_device_set_wifi_6ghz_supported(wifi->device, is_6_0_ghz_supported); /* Max number of SSIDs supported by wlan chipset that can be scanned */ int max_scan_ssids = g_supplicant_interface_get_max_scan_ssids(interface); connman_device_set_max_scan_ssids(wifi->device, max_scan_ssids); diff --git a/src/connman-robot.conf b/src/connman-robot.conf index b089f40..f123c25 100644 --- a/src/connman-robot.conf +++ b/src/connman-robot.conf @@ -15,6 +15,7 @@ + diff --git a/src/connman.conf b/src/connman.conf index 2b96713..997c1ea 100644 --- a/src/connman.conf +++ b/src/connman.conf @@ -15,6 +15,7 @@ + diff --git a/src/device.c b/src/device.c index 5116900..1e3924b 100755 --- a/src/device.c +++ b/src/device.c @@ -82,6 +82,7 @@ struct connman_device { */ int max_scan_ssids; bool is_5_0_ghz_supported; + bool is_6_0_ghz_supported; unsigned int mac_policy; unsigned int preassoc_mac_policy; unsigned int random_mac_lifetime; @@ -1281,10 +1282,21 @@ void connman_device_set_wifi_5ghz_supported(struct connman_device *device, device->is_5_0_ghz_supported = is_5_0_ghz_supported; } +void connman_device_set_wifi_6ghz_supported(struct connman_device *device, + bool is_6_0_ghz_supported) +{ + device->is_6_0_ghz_supported = is_6_0_ghz_supported; +} + bool connman_device_get_wifi_5ghz_supported(struct connman_device *device) { return device->is_5_0_ghz_supported; } + +bool connman_device_get_wifi_6ghz_supported(struct connman_device *device) +{ + return device->is_6_0_ghz_supported; +} #endif /** diff --git a/src/technology.c b/src/technology.c index 44cd116..4cc540b 100644 --- a/src/technology.c +++ b/src/technology.c @@ -2104,6 +2104,41 @@ static DBusMessage *get_5ghz_supported(DBusConnection *conn, DBusMessage *msg, v return reply; } +static DBusMessage *get_6ghz_supported(DBusConnection *conn, DBusMessage *msg, void *data) +{ + DBusMessage *reply; + DBusMessageIter iter, dict; + GSList *list; + struct connman_technology *technology = data; + dbus_bool_t supported = false; + const char *ifname = NULL; + + DBG("technology %p", technology); + + reply = dbus_message_new_method_return(msg); + if (!reply) + return NULL; + + dbus_message_iter_init_append(reply, &iter); + connman_dbus_dict_open(&iter, &dict); + + for (list = technology->device_list; list; list = list->next) { + struct connman_device *device = list->data; + + supported = connman_device_get_wifi_6ghz_supported(device); + ifname = connman_device_get_string(device, "Interface"); + + DBG("ifname %s supported : %d", ifname, supported); + connman_dbus_dict_append_basic(&dict, ifname, + DBUS_TYPE_BOOLEAN, + &supported); + } + + connman_dbus_dict_close(&iter, &dict); + + return reply; +} + static DBusMessage *get_scan_state(DBusConnection *conn, DBusMessage *msg, void *data) { DBusMessage *reply; @@ -2882,6 +2917,8 @@ static const GDBusMethodTable technology_methods[] = { get_scan_state) }, { GDBUS_METHOD("Get5GhzSupported", NULL, GDBUS_ARGS({ "supported", "a{sv}" }), get_5ghz_supported) }, + { GDBUS_METHOD("Get6GHzSupported", NULL, GDBUS_ARGS({ "supported", "a{sv}" }), + get_6ghz_supported) }, { GDBUS_METHOD("GetMaxScanSsid", NULL, GDBUS_ARGS({ "maxscanssid", "a{sv}" }), get_max_scan_ssid) }, { GDBUS_ASYNC_METHOD("SetDevicePower", -- 2.7.4