Skip to contentSkip to conversation

tether: Fix connman_technology_get_wifi_tethering

PATCH Applied Michael Trimarchi 2 participants 3 messages Oct 23, 2021 – Oct 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tether: Fix connman_technology_get_wifi_tethering

The function is called from tethering, so the tethering is not yet enabled. We need to workaround in order to get the right value

---
 src/technology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
src/technology.c +6 -2
index 97419150..5c469111 100644
@@ -367,19 +367,23 @@ bool connman_technology_get_wifi_tethering(const struct connman_technology *tech
 					const char **ssid, const char **psk,
 					int *freq)
 {
+	bool force = true;
+
 	if (!ssid || !psk)
 		return false;
 
 	*ssid = *psk = NULL;
 
 	/* Workaround for the neard plugin */
-	if (!technology)
+	if (!technology) {
 		technology = technology_find(CONNMAN_SERVICE_TYPE_WIFI);
+		force = false;
+	}
 
 	if (!technology)
 		return false;
 
-	if (!technology->tethering)
+	if (!force && !technology->tethering)
 		return false;
 
 	*ssid = technology->tethering_ident;
Signature · 1 line
2.25.1
#1 lore raw

Hi

I keep the compatibility. Another option is to give back them all anyway

Michael

Quoted 43 lines · Michael Trimarchi

The function is called from tethering, so the tethering is not yet enabled. We need to workaround in order to get the right value

---
 src/technology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
src/technology.c +6 -3
index 97419150..5c469111 100644
@@ -367,19 +367,23 @@ bool connman_technology_get_wifi_tethering(const struct connman_technology *tech
                                        const char **ssid, const char **psk,
                                        int *freq)
 {
+       bool force = true;
+
        if (!ssid || !psk)
                return false;
 
        *ssid = *psk = NULL;
 
        /* Workaround for the neard plugin */
-       if (!technology)
+       if (!technology) {
                technology = technology_find(CONNMAN_SERVICE_TYPE_WIFI);
+               force = false;
+       }
 
        if (!technology)
                return false;
 
-       if (!technology->tethering)
+       if (!force && !technology->tethering)
                return false;
 
        *ssid = technology->tethering_ident;
--

2.25.1

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#2 lore raw
In reply to Michael Trimarchi
Quoted 5 lines · Michael Trimarchi

The function is called from tethering, so the tethering is not yet enabled. We need to workaround in order to get the right value

Applied, thanks!

[1/1] tether: Fix connman_technology_get_wifi_tethering

      commit: bc26ab84e4a77950104c6c60609b549b9ce2830f

Best regards,

Signature · 1 line
Daniel Wagner <[email protected]>