diff options
author | Andreas Müller <schnitzeltony@googlemail.com> | 2014-10-20 15:27:46 +0200 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2014-10-27 12:50:00 +0100 |
commit | 7a7f06b90c3f051569e4277b2491ece2d381ac84 (patch) | |
tree | 3bf7adb3736a8f7fbda986b50dc267c65eae822e /meta-gnome | |
parent | 4c3a2f5c5f55501fb1bd90efc9fc54c65e5a2f8c (diff) | |
download | meta-openembedded-7a7f06b90c3f051569e4277b2491ece2d381ac84.tar.gz |
network-manager-applet: add basic AP support
Tested with gumstix overo as access point and connected windows pc and android
smartphone.
Note that there are are some settings available for AP which do not make sense - see
[1] for further details.
[1] https://bugzilla.gnome.org/show_bug.cgi?id=734589#c6
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-gnome')
3 files changed, 178 insertions, 0 deletions
diff --git a/meta-gnome/recipes-connectivity/network-manager-applet/files/0002-Add-support-for-AP-mode-setting-for-wifi-sharing.patch b/meta-gnome/recipes-connectivity/network-manager-applet/files/0002-Add-support-for-AP-mode-setting-for-wifi-sharing.patch new file mode 100644 index 000000000..d0506b2e8 --- /dev/null +++ b/meta-gnome/recipes-connectivity/network-manager-applet/files/0002-Add-support-for-AP-mode-setting-for-wifi-sharing.patch | |||
@@ -0,0 +1,128 @@ | |||
1 | From d789ef88a8806887bf1160bfa5d3d9eb47b6216c Mon Sep 17 00:00:00 2001 | ||
2 | From: "Marius B. Kotsbak" <marius@kotsbak.com> | ||
3 | Date: Mon, 11 Aug 2014 22:11:52 +0200 | ||
4 | Subject: [PATCH] Add support for AP mode setting for wifi sharing. | ||
5 | |||
6 | Upstream-Status: Pending [1] | ||
7 | |||
8 | [1] https://bugzilla.gnome.org/show_bug.cgi?id=734589 | ||
9 | --- | ||
10 | src/connection-editor/ce-page-wifi.ui | 3 +++ | ||
11 | src/connection-editor/page-wifi.c | 46 ++++++++++++++++++++--------------- | ||
12 | 2 files changed, 30 insertions(+), 19 deletions(-) | ||
13 | |||
14 | diff --git a/src/connection-editor/ce-page-wifi.ui b/src/connection-editor/ce-page-wifi.ui | ||
15 | index e2e544b..b8b27c1 100644 | ||
16 | --- a/src/connection-editor/ce-page-wifi.ui | ||
17 | +++ b/src/connection-editor/ce-page-wifi.ui | ||
18 | @@ -50,6 +50,9 @@ | ||
19 | <row> | ||
20 | <col id="0" translatable="yes">Ad-hoc</col> | ||
21 | </row> | ||
22 | + <row> | ||
23 | + <col id="0" translatable="yes">Shared AP</col> | ||
24 | + </row> | ||
25 | </data> | ||
26 | </object> | ||
27 | <object class="GtkTable" id="WifiPage"> | ||
28 | diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c | ||
29 | index d0a5617..17db2fa 100644 | ||
30 | --- a/src/connection-editor/page-wifi.c | ||
31 | +++ b/src/connection-editor/page-wifi.c | ||
32 | @@ -59,6 +59,12 @@ typedef struct { | ||
33 | gboolean disposed; | ||
34 | } CEPageWifiPrivate; | ||
35 | |||
36 | +enum { | ||
37 | + WIFI_MODE_INFRASTRUCTURE, | ||
38 | + WIFI_MODE_ADHOC, | ||
39 | + WIFI_MODE_AP | ||
40 | +}; | ||
41 | + | ||
42 | static void | ||
43 | wifi_private_init (CEPageWifi *self) | ||
44 | { | ||
45 | @@ -244,22 +250,16 @@ mode_combo_changed_cb (GtkComboBox *combo, | ||
46 | CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self); | ||
47 | CEPage *parent = CE_PAGE (self); | ||
48 | GtkWidget *widget_band_label, *widget_chan_label, *widget_bssid_label; | ||
49 | - gboolean adhoc; | ||
50 | + gint wifi_mode; | ||
51 | + gboolean shared_wifi; | ||
52 | |||
53 | - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) { | ||
54 | - case 1: /* adhoc */ | ||
55 | - adhoc = TRUE; | ||
56 | - break; | ||
57 | - default: /* infrastructure */ | ||
58 | - adhoc = FALSE; | ||
59 | - break; | ||
60 | - } | ||
61 | + wifi_mode = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); | ||
62 | |||
63 | widget_band_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_band_label")); | ||
64 | widget_chan_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_channel_label")); | ||
65 | widget_bssid_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_bssid_label")); | ||
66 | |||
67 | - if (adhoc) { | ||
68 | + if (WIFI_MODE_ADHOC == wifi_mode || WIFI_MODE_AP == wifi_mode) { | ||
69 | /* For Ad-Hoc show Band and Channel */ | ||
70 | gtk_widget_show (widget_band_label); | ||
71 | gtk_widget_show (GTK_WIDGET (priv->band)); | ||
72 | @@ -283,12 +283,13 @@ mode_combo_changed_cb (GtkComboBox *combo, | ||
73 | gtk_widget_show (GTK_WIDGET (priv->bssid)); | ||
74 | } | ||
75 | |||
76 | - gtk_widget_set_sensitive (widget_band_label, adhoc); | ||
77 | - gtk_widget_set_sensitive (GTK_WIDGET (priv->band), adhoc); | ||
78 | - gtk_widget_set_sensitive (widget_chan_label, adhoc); | ||
79 | - gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), adhoc); | ||
80 | - gtk_widget_set_sensitive (widget_bssid_label, !adhoc); | ||
81 | - gtk_widget_set_sensitive (GTK_WIDGET (priv->bssid), !adhoc); | ||
82 | + shared_wifi = wifi_mode != WIFI_MODE_INFRASTRUCTURE; | ||
83 | + gtk_widget_set_sensitive (widget_band_label, shared_wifi); | ||
84 | + gtk_widget_set_sensitive (GTK_WIDGET (priv->band), shared_wifi); | ||
85 | + gtk_widget_set_sensitive (widget_chan_label, shared_wifi); | ||
86 | + gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), shared_wifi); | ||
87 | + gtk_widget_set_sensitive (widget_bssid_label, !shared_wifi); | ||
88 | + gtk_widget_set_sensitive (GTK_WIDGET (priv->bssid), !shared_wifi); | ||
89 | |||
90 | ce_page_changed (CE_PAGE (self)); | ||
91 | } | ||
92 | @@ -348,9 +349,12 @@ populate_ui (CEPageWifi *self) | ||
93 | g_byte_array_free (ssid, TRUE); | ||
94 | |||
95 | /* Default to Infrastructure */ | ||
96 | - gtk_combo_box_set_active (priv->mode, 0); | ||
97 | + gtk_combo_box_set_active (priv->mode, WIFI_MODE_INFRASTRUCTURE); | ||
98 | if (mode && !strcmp (mode, "adhoc")) | ||
99 | - gtk_combo_box_set_active (priv->mode, 1); | ||
100 | + gtk_combo_box_set_active (priv->mode, WIFI_MODE_ADHOC); | ||
101 | + else if (mode && !strcmp (mode, "ap")) | ||
102 | + gtk_combo_box_set_active (priv->mode, WIFI_MODE_AP); | ||
103 | + | ||
104 | mode_combo_changed_cb (priv->mode, self); | ||
105 | g_signal_connect (priv->mode, "changed", G_CALLBACK (mode_combo_changed_cb), self); | ||
106 | g_free (mode); | ||
107 | @@ -510,14 +514,18 @@ ui_to_setting (CEPageWifi *self) | ||
108 | GByteArray *bssid = NULL; | ||
109 | GByteArray *device_mac = NULL; | ||
110 | GByteArray *cloned_mac = NULL; | ||
111 | + gint wifi_mode; | ||
112 | const char *mode; | ||
113 | const char *band; | ||
114 | GtkWidget *entry; | ||
115 | |||
116 | ssid = ce_page_wifi_get_ssid (self); | ||
117 | |||
118 | - if (gtk_combo_box_get_active (priv->mode) == 1) | ||
119 | + wifi_mode = gtk_combo_box_get_active (priv->mode); | ||
120 | + if (WIFI_MODE_ADHOC == wifi_mode) | ||
121 | mode = "adhoc"; | ||
122 | + else if (WIFI_MODE_AP == wifi_mode) | ||
123 | + mode = "ap"; | ||
124 | else | ||
125 | mode = "infrastructure"; | ||
126 | |||
127 | -- | ||
128 | 1.9.1 | ||
diff --git a/meta-gnome/recipes-connectivity/network-manager-applet/files/0003-Use-AP-mode-for-network-sharing-if-device-supports-it.patch b/meta-gnome/recipes-connectivity/network-manager-applet/files/0003-Use-AP-mode-for-network-sharing-if-device-supports-it.patch new file mode 100644 index 000000000..e2156463d --- /dev/null +++ b/meta-gnome/recipes-connectivity/network-manager-applet/files/0003-Use-AP-mode-for-network-sharing-if-device-supports-it.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 7343b16113e378d04e40012abfe5bd96ca776968 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Marius B. Kotsbak" <marius@kotsbak.com> | ||
3 | Date: Tue, 12 Aug 2014 11:15:20 +0200 | ||
4 | Subject: [PATCH 2/2] Use AP mode for network sharing if device supports it. | ||
5 | |||
6 | Logic taken from similar functionality in gnome-control-center. | ||
7 | |||
8 | Upstream-Status: Backport [1] | ||
9 | |||
10 | [1] https://bug734589.bugzilla-attachments.gnome.org/attachment.cgi?id=283165 | ||
11 | --- | ||
12 | src/libnm-gtk/nm-wifi-dialog.c | 18 +++++++++++++++++- | ||
13 | 1 file changed, 17 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/src/libnm-gtk/nm-wifi-dialog.c b/src/libnm-gtk/nm-wifi-dialog.c | ||
16 | index 3532caa..ca72c96 100644 | ||
17 | --- a/src/libnm-gtk/nm-wifi-dialog.c | ||
18 | +++ b/src/libnm-gtk/nm-wifi-dialog.c | ||
19 | @@ -1226,10 +1226,26 @@ nma_wifi_dialog_get_connection (NMAWifiDialog *self, | ||
20 | s_wireless = (NMSettingWireless *) nm_setting_wireless_new (); | ||
21 | g_object_set (s_wireless, NM_SETTING_WIRELESS_SSID, validate_dialog_ssid (self), NULL); | ||
22 | |||
23 | + /* Fill device */ | ||
24 | + if (device) { | ||
25 | + combo = GTK_WIDGET (gtk_builder_get_object (priv->builder, "device_combo")); | ||
26 | + gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter); | ||
27 | + gtk_tree_model_get (priv->device_model, &iter, D_DEV_COLUMN, device, -1); | ||
28 | + g_object_unref (*device); | ||
29 | + } | ||
30 | + | ||
31 | if (priv->adhoc_create) { | ||
32 | NMSettingIP4Config *s_ip4; | ||
33 | |||
34 | - g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, "adhoc", NULL); | ||
35 | + const char *mode; | ||
36 | + | ||
37 | + /* Use real AP mode if the device supports it */ | ||
38 | + if (device && nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (*device)) & NM_WIFI_DEVICE_CAP_AP) | ||
39 | + mode = NM_SETTING_WIRELESS_MODE_AP; | ||
40 | + else | ||
41 | + mode = NM_SETTING_WIRELESS_MODE_ADHOC; | ||
42 | + | ||
43 | + g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, mode, NULL); | ||
44 | |||
45 | s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); | ||
46 | g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, NULL); | ||
47 | -- | ||
48 | 1.8.3.1 | ||
diff --git a/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_0.9.8.10.bb b/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_0.9.8.10.bb index ca05866c3..663c38cbe 100644 --- a/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_0.9.8.10.bb +++ b/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_0.9.8.10.bb | |||
@@ -10,6 +10,8 @@ GNOME_COMPRESS_TYPE = "xz" | |||
10 | 10 | ||
11 | SRC_URI += " \ | 11 | SRC_URI += " \ |
12 | file://0001-remove-classes-and-properties-which-are-not-supporte.patch \ | 12 | file://0001-remove-classes-and-properties-which-are-not-supporte.patch \ |
13 | file://0002-Add-support-for-AP-mode-setting-for-wifi-sharing.patch \ | ||
14 | file://0003-Use-AP-mode-for-network-sharing-if-device-supports-it.patch \ | ||
13 | " | 15 | " |
14 | SRC_URI[archive.md5sum] = "5148348c139229c6a753f815f3f11e1c" | 16 | SRC_URI[archive.md5sum] = "5148348c139229c6a753f815f3f11e1c" |
15 | SRC_URI[archive.sha256sum] = "46fee9a1e667d1826e6a94bb6bd2e6bdbde535fc995e534542f5f7e8b8dae0cb" | 17 | SRC_URI[archive.sha256sum] = "46fee9a1e667d1826e6a94bb6bd2e6bdbde535fc995e534542f5f7e8b8dae0cb" |