Re: Hidden network with different APs.

2015-04-14 Thread Jason Abele
On Tue, Apr 14, 2015 at 12:25:58PM +0200, Pedro Erencia wrote:
 As a workaround I'd try to always remove the wifi_xxx_ folders until a 
 solution is found. Any other ideas ?

Could you check if the AP is changing frequencies each time you power-cycle
it?

My guess is that the AP is set to auto-select a frequency on boot, so
connman does not find the hidden network on the same frequency the second
time (the last successful frequency is stored in the config file).

Please let us know which frequency your AP is using.

iw wlan0 scan | grep -e '^BSS' -e 'SSID' -e 'freq:'

Thanks,
Jason
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] wifi: fix autoscan interval limit

2015-01-19 Thread Jason Abele
From: Jason Abele ja...@aether.com

The comparison to autoscan-limit is performed before setting the new
autoscan-interval, allowing one interval to overshoot the limit.  Fix
this by comparing against the newly calculated interval.
---
 plugins/wifi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 68ed5d0..e081f8a 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1311,7 +1311,7 @@ static gboolean autoscan_timeout(gpointer data)
} else
interval = autoscan-interval * autoscan-base;
 
-   if (autoscan-interval = autoscan-limit)
+   if (interval  autoscan-limit)
interval = autoscan-limit;
 
throw_wifi_scan(wifi-device, scan_callback_hidden);
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/2] Debug log control API

2015-01-19 Thread Jason Abele
On Mon, Jan 19, 2015 at 2:41 PM, Slava Monich slava.mon...@jolla.com
wrote:

 These patches introduce net.connman.DebugLog D-Bus interface
 which provides the following methods:

   void Enable(string pattern)
   void Disable(string pattern)
   array{string} List()


Tested these out and it works for my application ... thanks!

Jason
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] wifi: do not start autoscan while connected

2014-11-10 Thread Jason Abele
Did this patch get forgotten?

I had expected it to show up ahead of my other recent patch

Thanks again for all the review and feedback
Jason
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] wifi: scan all channels when connected

2014-11-07 Thread Jason Abele
From: Jason Abele ja...@aether.com

If the wifi interface is connected and a scan is requested via dbus,
only the channels from connectable services will be scanned.  This
leaves few options to fill out a UI with a fresh list of available
services when already connected.

Fix this by performing a wifi_scan_simple() when connected.
---
 plugins/wifi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 187233b..9357b92 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1842,6 +1842,9 @@ static int wifi_scan(enum connman_service_type type,
 
return 0;
}
+   } else if (wifi-connected) {
+   g_supplicant_free_scan_params(scan_params);
+   return wifi_scan_simple(device);
} else {
ret = get_latest_connections(driver_max_ssids, scan_params);
if (ret = 0) {
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [RFC] wifi: extend dbus scan interface for full scans

2014-11-07 Thread Jason Abele
Hi Tomasz,

 No because the autoscan is not a user triggered scan, the fact it's
 reset after a user triggered scan is nominal, but we don't want to
 relate the DBus pending call to it. The end result is that he will get
 all the results properly through Manager.ServicesChanged() signal, after
 his scan and after all autoscan events if those brings updates.

 I agree that scanning known networks first is a good feature, so I am
 a bit concerned that sending a patch like the hunk above will make
 finding known networks slower.

 Known networks will be eventually found in such full scan so no worry.
 When connected, there won't be any scan ran unless the user asks for one.
 At this point doing only a full scan is the best imo.

Agreed that watching for ServicesChanged() will be required regardless
and that autoscan will get around to scanning the remaining channels
after the dbus pending call finishes, so this is one reasonable way to
meet my specific needs, so I will drop the dbus api change.

 And you patch does not affect the nominal behavior when not connected
 (first a known networks scan, then a full scan via autoscan, etc...)

For a user-requested scan when disconnected, yes, it is still known
networks first, then full scan.

However, disconnect_callback() calls start_autoscan(), and that leads
to a throw_wifi_scan() of all channels, not a scan for known networks.

I think that is ok, or at least the subject of a separate patch.

 Your patch is good to go, send it.

Sent .. thanks for the review

Jason
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [RFC] wifi: extend dbus scan interface for full scans

2014-11-06 Thread Jason Abele
Hi Tomasz,

On Tue, Nov 4, 2014 at 11:49 PM, Tomasz Bursztyka
tomasz.burszt...@linux.intel.com wrote:
 If so, then this is a bug in plugins/wifi.c and that should be fixed. Look
 closer to wifi_scan():
 line 1843: if the current wifi is connected you could skip this. So it would
 not look for known networks,
 when wifi is already connected.

 The logic behind is: if not connected and if there are known networks, it
 will first do an active scan on those,
 and then autoscan will do a passive scan. But since your recent patch: if
 connected, autoscan won't start.

Makes sense, and I think it is appropriate to scan the known networks
first, especially when searching for a connection.

 I did not check thoroughly but I think it's the right place to fix this is
 line 1842:
 instead of: } else { try a: } else if (!wifi-connected) {

 That should do the trick I believe.

I tried something like your suggestion and
g_supplicant_interface_scan() does not actually trigger a scan when
scan_params is allocated, but not filled in, so I did something like
this:

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 5ef4520..6b70f0e 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1842,6 +1842,9 @@ static int wifi_scan(enum connman_service_type type,

return 0;
}
+   } else if (wifi-connected) {
+   g_supplicant_free_scan_params(scan_params);
+   return wifi_scan_simple(device);
} else {
ret = get_latest_connections(driver_max_ssids, scan_params);
if (ret = 0) {

and that does make the dbus requested scans cover all channels when connected.

However, when not connected, a dbus scan request will return after
scanning only the known networks, and then autoscan will handle
scanning all channels.  I would have expected that scans requested via
dbus would scan all channels before returning.

I agree that scanning known networks first is a good feature, so I am
a bit concerned that sending a patch like the hunk above will make
finding known networks slower.

If you prefer a patch like that hunk above, I am happy to send out a
patch or you can, though I had a preference for something that would
either:

1. Scan the known networks first, then the remaining channels (or all
channels once), then return from the dbus call.
2. Clarify the dbus api in some fashion to allow dbus clients to know
whether they are scanning some or all channels, preferably as
specified by the client.

Thanks for the quick review and feedback so far, much appreciated

Jason
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[RFC] wifi: extend dbus scan interface for full scans

2014-11-04 Thread Jason Abele
From: Jason Abele ja...@aether.com

If the wifi interface is connected and a scan is requested via dbus, only
the channels from connectable services will be scanned.  This leaves few
options to fill out a UI with a fresh list of available services when
already connected.

Fix this by adding a new dbus method ScanFull() to request a full scan
of all channels.
---
Obviously this needs an entry in the API documentation, but I wanted to get
feedback on the idea before touching up those details.  Right now, I am just
looking for feedback regarding whether extending the dbus api for full scans is
acceptable and if this is roughly the right way to do it.

Is there a way to request a full scan while connected which I am missing?

$ connmanctl connect SERVICE
$ iw event -t 
$ gdbus call -y -d net.connman -o /net/connman/technology/wifi \
-m net.connman.Technology.ScanFull
1415056830.095942: wlan0 (phy #0): scan started
1415056833.057016: wlan0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 
2442 2447 2452 2457 2462 2467 2472 2484 5040 5060 5080 5170 5190 5210 5230 5180 
5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 
5680 5700 5745 5765 5785 5805 5825, SERVICE_SSID 
()

$ connmanctl connect SERVICE
$ iw event -t 
$ gdbus call -y -d net.connman -o /net/connman/technology/wifi \
-m net.connman.Technology.Scan
1415056842.920538: wlan0 (phy #0): scan started
1415056842.971047: wlan0 (phy #0): scan finished: 5300, SERVICE_SSID
()

 plugins/wifi.c   |  4 
 src/config.c |  2 +-
 src/connman.h|  3 ++-
 src/device.c | 10 ++
 src/technology.c |  7 ++-
 5 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 5ef4520..e3268a0 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1790,6 +1790,10 @@ static int wifi_scan(enum connman_service_type type,
if (driver_max_ssids == 0)
return wifi_scan_simple(device);
 
+   if (user_data  g_str_equal((char *) user_data, full)) {
+   return wifi_scan_simple(device);
+   }
+
do_hidden = false;
} else {
if (scanning  wifi-hidden  wifi-postpone_hidden)
diff --git a/src/config.c b/src/config.c
index e7d1671..4e44658 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1487,7 +1487,7 @@ int connman_config_provision_mutable_service(GKeyFile 
*keyfile)
__connman_service_provision_changed(vfile);
 
if (g_strcmp0(service_config-type, wifi) == 0)
-   __connman_device_request_scan(CONNMAN_SERVICE_TYPE_WIFI);
+   __connman_device_request_scan(CONNMAN_SERVICE_TYPE_WIFI, NULL);
 
return 0;
 
diff --git a/src/connman.h b/src/connman.h
index da01215..7b68bae 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -550,7 +550,8 @@ void __connman_device_list(DBusMessageIter *iter, void 
*user_data);
 
 enum connman_service_type __connman_device_get_service_type(struct 
connman_device *device);
 struct connman_device *__connman_device_find_device(enum connman_service_type 
type);
-int __connman_device_request_scan(enum connman_service_type type);
+int __connman_device_request_scan(enum connman_service_type type,
+   void *user_data);
 int __connman_device_request_hidden_scan(struct connman_device *device,
const char *ssid, unsigned int ssid_len,
const char *identity, const char *passphrase,
diff --git a/src/device.c b/src/device.c
index c0683ab..6887619 100644
--- a/src/device.c
+++ b/src/device.c
@@ -604,7 +604,8 @@ bool connman_device_get_powered(struct connman_device 
*device)
 }
 
 static int device_scan(enum connman_service_type type,
-   struct connman_device *device)
+   struct connman_device *device,
+   void *user_data)
 {
if (!device-driver || !device-driver-scan)
return -EOPNOTSUPP;
@@ -613,7 +614,7 @@ static int device_scan(enum connman_service_type type,
return -ENOLINK;
 
return device-driver-scan(type, device, NULL, 0,
-   NULL, NULL, NULL, NULL);
+   NULL, NULL, NULL, user_data);
 }
 
 int __connman_device_disconnect(struct connman_device *device)
@@ -1077,7 +1078,8 @@ void connman_device_regdom_notify(struct connman_device 
*device,
__connman_technology_notify_regdom_by_device(device, result, alpha2);
 }
 
-int __connman_device_request_scan(enum connman_service_type type)
+int __connman_device_request_scan(enum connman_service_type type,
+   void *user_data)
 {
bool success = false;
int last_err = -ENOSYS;
@@ -1112,7 +1114,7 @@ int __connman_device_request_scan(enum 
connman_service_type type)
continue;
}
 
-   err

[PATCH] wifi: do not start autoscan while connected

2014-11-03 Thread Jason Abele
From: Jason Abele ja...@aether.com

When wifi is connected, requesting a scan via dbus causes autoscan
to start.  This is undesired during a connection as it may cause service
interruptions while the wifi device is off-channel.

Fix this by only starting autoscan when wifi is not connected.
---

Changes since RFC:
 * move check for wifi-connected to start_autoscan()

Logs with this patch:

connmanctl connect $SERVICE
$ iw event -t 
$ connmanctl scan wifi
1414783973.521688: wlan0 (phy #0): scan started
1414783973.614745: wlan0 (phy #0): scan finished: 5540 5180, RECENT_SSID1 
RECENT_SSID2
Scan completed for wifi

Logs without this patch:

$ connmanctl connect $SERVICE
$ iw event -t 
$ journalctl -u connman -f | grep -i autoscan 
$ connmanctl scan wifi
1414785276.400245: wlan0 (phy #0): scan started
Oct 31 19:54:36 connmand[547]: plugins/wifi.c:reset_autoscan()
1414785276.492174: wlan0 (phy #0): scan finished: 5540 5180, RECENT_SSID1 
RECENT_SSID2
Scan completed for wifi
Oct 31 19:54:37 connmand[547]: plugins/wifi.c:start_autoscan()
Oct 31 19:54:37 connmand[547]: src/device.c:connman_device_ref_debug() 0x425ad8 
ref 4 by plugins/wifi.c:1350:start_autoscan()
Oct 31 19:54:37 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 3
1414785281.194940: wlan0 (phy #0): scan started
Oct 31 19:54:41 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 9
1414785284.159957: wlan0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 
2442 2447 2452 2457 2462 2467 2472 2484 5040 5060 5080 5170 5190 5210 5230 5180 
5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 
5680 5700 5745 5765 5785 5805 5825, RECENT_SSID1 
1414785290.199609: wlan0 (phy #0): scan started
Oct 31 19:54:50 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 27
1414785293.161206: wlan0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 
2442 2447 2452 2457 2462 2467 2472 2484 5040 5060 5080 5170 5190 5210 5230 5180 
5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 
5680 5700 5745 5765 5785 5805 5825, RECENT_SSID1 

 plugins/wifi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 5f2ebf1..187233b 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1340,6 +1340,9 @@ static void start_autoscan(struct connman_device *device)
if (wifi-p2p_device)
return;
 
+   if (wifi-connected)
+   return;
+
autoscan = wifi-autoscan;
if (!autoscan)
return;
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[RFC] wifi: do not start autoscan while connected

2014-10-31 Thread Jason Abele
From: Jason Abele ja...@aether.com

When wifi is connected, requesting a scan via dbus causes autoscan
to start.  This is undesired during a connection as it may cause service
interruptions while the wifi device is off-channel.

Fix this by only starting autoscan when wifi is not connected.
---
 plugins/wifi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Note: I expected a call to net.connman.Technology.Scan would give one scan of
all channels, but there does not appear to be an easy to request one scan of
all channels from dbus.

I am willing to implement something like this, but I would like feedback first
on the two options I am considering (please let me know of better methods):

1) Modify the dbus api to pass information that a full scan was
   requested and then use that information to call wifi_scan_simple() from
   within wifi_scan()

2) Allow autoscan to run once and then reset_autoscan() the second time through
   autoscan_timeout()

The first option seems fairly invasive, but the second option has the downside
of returning from the dbus scan call before the actual scan of all channels
completes.


Logs with this patch:

# connmanctl connect $SERVICE
# iw event -t 
# connmanctl scan wifi
1414783973.521688: wlan0 (phy #0): scan started
1414783973.614745: wlan0 (phy #0): scan finished: 5540 5180, RECENT_SSID1 
RECENT_SSID2
Scan completed for wifi


Logs without this patch:

# connmanctl connect $SERVICE
# iw event -t 
# journalctl -u connman -f | grep -i autoscan 
# connmanctl scan wifi
1414785276.400245: wlan0 (phy #0): scan started
Oct 31 19:54:36 connmand[547]: plugins/wifi.c:reset_autoscan()
1414785276.492174: wlan0 (phy #0): scan finished: 5540 5180, RECENT_SSID1 
RECENT_SSID2
Scan completed for wifi
Oct 31 19:54:37 connmand[547]: plugins/wifi.c:start_autoscan()
Oct 31 19:54:37 connmand[547]: src/device.c:connman_device_ref_debug() 0x425ad8 
ref 4 by plugins/wifi.c:1350:start_autoscan()
Oct 31 19:54:37 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 3
1414785281.194940: wlan0 (phy #0): scan started
Oct 31 19:54:41 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 9
1414785284.159957: wlan0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 
2442 2447 2452 2457 2462 2467 2472 2484 5040 5060 5080 5170 5190 5210 5230 5180 
5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 
5680 5700 5745 5765 5785 5805 5825, RECENT_SSID1 
1414785290.199609: wlan0 (phy #0): scan started
Oct 31 19:54:50 connmand[547]: plugins/wifi.c:autoscan_timeout() interval 27
1414785293.161206: wlan0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 
2442 2447 2452 2457 2462 2467 2472 2484 5040 5060 5080 5170 5190 5210 5230 5180 
5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 
5680 5700 5745 5765 5785 5805 5825, RECENT_SSID1 

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 5f2ebf1..a87124d 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1243,7 +1243,7 @@ static void scan_callback(int result, 
GSupplicantInterface *interface,
CONNMAN_SERVICE_TYPE_WIFI, false);
}
 
-   if (result != -ENOLINK)
+   if (result != -ENOLINK  !wifi-connected)
start_autoscan(device);
 
/*
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman