Hi Marcel:
I have worked out a patch to let connect the last network.
The patch works like below:
1. Before remove the device, record the last_network to dist
2. Connect to the last_network when the network can be scanned.
So after reboot suspend ConnMan can connect to the last service.
I have verify it on The Dell Mini 9 netbook which using Broadcom 4312
It works fine.
Please review the patch:
I will continue to work on patch to connect the favorite service, if the last
network is unavailable.
diff --git a/src/device.c b/src/device.c
index a2507b5..e970da1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1338,6 +1338,7 @@ static void connect_known_network(struct connman_device
*device)
CONNMAN_PROPERTY_ID_NAME);
if (name != NULL && device->last_network != NULL) {
if (g_str_equal(name, device->last_network) == TRUE) {
+ DBG("Find LastNetwork: %s", name);
network = value;
break;
}
@@ -1848,6 +1849,7 @@ static int device_load(struct connman_device *device)
gchar *pathname, *identifier, *data = NULL;
gsize length;
int val;
+ char *last_network;
DBG("device %p", device);
@@ -1887,6 +1889,13 @@ static int device_load(struct connman_device *device)
"ScanInterval", NULL);
if (val > 0)
device->scan_interval = val;
+ last_network = g_key_file_get_string(keyfile, identifier,
+ "LastNetwork", NULL);
+ if (last_network != NULL) {
+ DBG("Load LastNetwork %s", last_network);
+ g_free(device->last_network);
+ device->last_network = last_network;
+ }
break;
}
@@ -1938,6 +1947,11 @@ update:
if (device->scan_interval > 0)
g_key_file_set_integer(keyfile, identifier,
"ScanInterval", device->scan_interval);
+ if (device->last_network != NULL) {
+ DBG("Save LastNetwork:%s", device->last_network);
+ g_key_file_set_string(keyfile, identifier,
+ "LastNetwork", device->last_network);
+ }
break;
}
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman