2006-03-02 Robert Love <rml@novell.com>
Add support for retrieving both the per-device speed and the per-network maximum supported rate. Then change the getProperties DBUS API for both networks and devices to report this informaiton. Finally, display the information via both nm-applet and nm-tool: * gnome/applet/applet-dbus-devices.c: Grab the speed from getProperties and set it. * gnome/applet/applet.c: Display the device's speed in the 'Connection Information' dialog. * gnome/applet/applet.glade: Update the UI to show per-device speed. * gnome/applet/nm-device.c, gnome/applet/nm-device.h: Add interfaces network_device_get_speed() and network_device_set_speed() for retrieving and setting, respectively, a network device's current speed. * src/nm-dbus-device.c: Send the device's speed on getProperties. * src/nm-device-802-11-wireless.c: Return the rate in Mb/s, not Kb/s, in the function nm_device_802_11_wireless_get_bitrate() -- it does not matter (yet) what the units are, because we only feed it its own output. Implement SIOCGIRATE and set the per-network maximum supported rate during scanning. * src/nm-device-802-11-wireless.h: Export the function nm_device_802_11_wireless_get_bitrate(). * src/nm-device-802-3-ethernet.c, src/nm-device-802-3-ethernet.h: Add function nm_device_802_3_ethernet_get_speed() for returning an 802.3's current speed, in Mb/s. * test/nm-tool.c: Display the per-device current speed, if available, and the per-network maximum rate. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
29
ChangeLog
29
ChangeLog
@@ -1,3 +1,32 @@
|
||||
2006-03-02 Robert Love <rml@novell.com>
|
||||
|
||||
Add support for retrieving both the per-device speed and the
|
||||
per-network maximum supported rate. Then change the getProperties
|
||||
DBUS API for both networks and devices to report this informaiton.
|
||||
Finally, display the information via both nm-applet and nm-tool:
|
||||
* gnome/applet/applet-dbus-devices.c: Grab the speed from getProperties
|
||||
and set it.
|
||||
* gnome/applet/applet.c: Display the device's speed in the 'Connection
|
||||
Information' dialog.
|
||||
* gnome/applet/applet.glade: Update the UI to show per-device speed.
|
||||
* gnome/applet/nm-device.c, gnome/applet/nm-device.h: Add interfaces
|
||||
network_device_get_speed() and network_device_set_speed() for
|
||||
retrieving and setting, respectively, a network device's current
|
||||
speed.
|
||||
* src/nm-dbus-device.c: Send the device's speed on getProperties.
|
||||
* src/nm-device-802-11-wireless.c: Return the rate in Mb/s, not Kb/s,
|
||||
in the function nm_device_802_11_wireless_get_bitrate() -- it does
|
||||
not matter (yet) what the units are, because we only feed it its own
|
||||
output. Implement SIOCGIRATE and set the per-network maximum
|
||||
supported rate during scanning.
|
||||
* src/nm-device-802-11-wireless.h: Export the function
|
||||
nm_device_802_11_wireless_get_bitrate().
|
||||
* src/nm-device-802-3-ethernet.c, src/nm-device-802-3-ethernet.h: Add
|
||||
function nm_device_802_3_ethernet_get_speed() for returning an
|
||||
802.3's current speed, in Mb/s.
|
||||
* test/nm-tool.c: Display the per-device current speed, if available,
|
||||
and the per-network maximum rate.
|
||||
|
||||
2006-03-02 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
|
@@ -745,6 +745,7 @@ static void nma_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_da
|
||||
const char * secondary_dns = NULL;
|
||||
dbus_int32_t mode = -1;
|
||||
dbus_int32_t strength = -1;
|
||||
dbus_int32_t speed = 0;
|
||||
char * active_network_path = NULL;
|
||||
dbus_bool_t link_active = FALSE;
|
||||
dbus_uint32_t caps = NM_DEVICE_CAP_NONE;
|
||||
@@ -787,6 +788,7 @@ static void nma_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_da
|
||||
DBUS_TYPE_INT32, &mode,
|
||||
DBUS_TYPE_INT32, &strength,
|
||||
DBUS_TYPE_BOOLEAN,&link_active,
|
||||
DBUS_TYPE_INT32, &speed,
|
||||
DBUS_TYPE_UINT32, &caps,
|
||||
DBUS_TYPE_UINT32, &type_caps,
|
||||
DBUS_TYPE_STRING, &active_network_path,
|
||||
@@ -798,6 +800,7 @@ static void nma_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_da
|
||||
|
||||
network_device_set_hal_udi (dev, udi);
|
||||
network_device_set_address (dev, hw_addr);
|
||||
network_device_set_speed (dev, speed);
|
||||
network_device_set_active (dev, active);
|
||||
network_device_set_link (dev, link_active);
|
||||
network_device_set_capabilities (dev, caps);
|
||||
|
@@ -190,8 +190,9 @@ static gboolean nma_update_info (NMApplet *applet)
|
||||
{
|
||||
GtkWidget *info_dialog;
|
||||
char *addr = NULL, *broadcast = NULL, *primary_dns = NULL, *secondary_dns = NULL;
|
||||
char *mac = NULL, *iface_and_type = NULL, *route = NULL, *mask = NULL;
|
||||
char *mac = NULL, *iface_and_type = NULL, *route = NULL, *mask = NULL, *speed = NULL;
|
||||
GtkWidget *label;
|
||||
int mbs;
|
||||
const char *iface = NULL, *driver = NULL;
|
||||
NetworkDevice *dev;
|
||||
|
||||
@@ -225,6 +226,11 @@ static gboolean nma_update_info (NMApplet *applet)
|
||||
primary_dns = (char*) network_device_get_primary_dns (dev);
|
||||
secondary_dns = (char*) network_device_get_secondary_dns (dev);
|
||||
|
||||
printf ("WOLF %d\n", network_device_get_speed (dev));
|
||||
mbs = network_device_get_speed (dev);
|
||||
if (mbs)
|
||||
speed = g_strdup_printf ("%d Mb/s", mbs);
|
||||
|
||||
if (network_device_is_wired (dev))
|
||||
iface_and_type = g_strdup_printf (_("Wired Ethernet (%s)"), iface);
|
||||
else
|
||||
@@ -233,6 +239,9 @@ static gboolean nma_update_info (NMApplet *applet)
|
||||
label = get_label (info_dialog, applet->info_dialog_xml, "label-interface");
|
||||
gtk_label_set_text (GTK_LABEL (label), iface_and_type);
|
||||
|
||||
label = get_label (info_dialog, applet->info_dialog_xml, "label-speed");
|
||||
gtk_label_set_text (GTK_LABEL (label), mbs ? speed : "Unknown");
|
||||
|
||||
label = get_label (info_dialog, applet->info_dialog_xml, "label-driver");
|
||||
gtk_label_set_text (GTK_LABEL (label), driver);
|
||||
|
||||
@@ -258,6 +267,7 @@ static gboolean nma_update_info (NMApplet *applet)
|
||||
gtk_label_set_text (GTK_LABEL (label), mac);
|
||||
|
||||
g_free (iface_and_type);
|
||||
g_free (speed);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -924,7 +924,7 @@ WEP 40/128-bit ASCII
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">1</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">13</property>
|
||||
<property name="n_rows">14</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">3</property>
|
||||
@@ -1091,8 +1091,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="bottom_attach">13</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="bottom_attach">14</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1120,8 +1120,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="bottom_attach">13</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="bottom_attach">14</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1148,8 +1148,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="bottom_attach">13</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1177,8 +1177,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="bottom_attach">13</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1205,8 +1205,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1234,8 +1234,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1262,8 +1262,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1291,8 +1291,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1319,8 +1319,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1348,8 +1348,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1376,8 +1376,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1405,8 +1405,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1433,8 +1433,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1462,8 +1462,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1489,8 +1489,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1517,8 +1517,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1545,8 +1545,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1573,8 +1573,8 @@ WEP 40/128-bit ASCII
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@@ -1598,6 +1598,63 @@ WEP 40/128-bit ASCII
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label-driver">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label29">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Speed:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
@@ -1609,7 +1666,7 @@ WEP 40/128-bit ASCII
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label-driver">
|
||||
<widget class="GtkLabel" id="label-speed">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
@@ -1665,7 +1722,7 @@ WEP 40/128-bit ASCII
|
||||
|
||||
<widget class="GtkWindow" id="wep_key_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="no">wep_key_subwindow</property>
|
||||
<property name="title">wep_key_subwindow</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
@@ -1854,7 +1911,7 @@ Shared Key</property>
|
||||
|
||||
<widget class="GtkWindow" id="leap_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="no">leap_subwindow</property>
|
||||
<property name="title">leap_subwindow</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
@@ -2046,7 +2103,7 @@ Shared Key</property>
|
||||
|
||||
<widget class="GtkWindow" id="wpa_psk_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="no">wpa_psk_subwindow</property>
|
||||
<property name="title">wpa_psk_subwindow</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
@@ -2234,7 +2291,7 @@ Shared Key</property>
|
||||
|
||||
<widget class="GtkWindow" id="wpa_eap_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="no">wpa_eap_subwindow</property>
|
||||
<property name="title">wpa_eap_subwindow</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
@@ -2712,7 +2769,7 @@ Shared Key</property>
|
||||
|
||||
<widget class="GtkWindow" id="wep_passphrase_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="no">wep_passphrase_subwindow</property>
|
||||
<property name="title">wep_passphrase_subwindow</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
|
@@ -51,6 +51,7 @@ struct NetworkDevice
|
||||
char * primary_dns;
|
||||
char * secondary_dns;
|
||||
gint strength;
|
||||
gint speed;
|
||||
GSList * networks;
|
||||
NMActStage act_stage;
|
||||
};
|
||||
@@ -678,6 +679,23 @@ void network_device_set_link (NetworkDevice *dev, gboolean link)
|
||||
dev->link = link;
|
||||
}
|
||||
|
||||
/*
|
||||
* Accessors for speed (in Mb/s)
|
||||
*/
|
||||
int network_device_get_speed (NetworkDevice *dev)
|
||||
{
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
return (dev->speed);
|
||||
}
|
||||
|
||||
void network_device_set_speed (NetworkDevice *dev, int speed)
|
||||
{
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
dev->speed = speed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Accessors for active
|
||||
*/
|
||||
|
@@ -97,6 +97,9 @@ void network_device_set_hal_udi (NetworkDevice *dev, const char *hal_udi)
|
||||
gboolean network_device_get_link (NetworkDevice *dev);
|
||||
void network_device_set_link (NetworkDevice *dev, gboolean link);
|
||||
|
||||
int network_device_get_speed (NetworkDevice *dev);
|
||||
void network_device_set_speed (NetworkDevice *dev, int speed);
|
||||
|
||||
gboolean network_device_get_active (NetworkDevice *dev);
|
||||
void network_device_set_active (NetworkDevice *dev, gboolean active);
|
||||
|
||||
|
@@ -367,6 +367,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
|
||||
char * hw_addr_buf_ptr = &hw_addr_buf[0];
|
||||
dbus_int32_t mode = -1;
|
||||
dbus_int32_t strength = -1;
|
||||
dbus_int32_t speed = 0;
|
||||
char * active_network_path = NULL;
|
||||
dbus_bool_t link_active = (dbus_bool_t) nm_device_has_active_link (dev);
|
||||
dbus_uint32_t capabilities = (dbus_uint32_t) nm_device_get_capabilities (dev);
|
||||
@@ -419,8 +420,9 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
|
||||
NMAccessPointList * ap_list;
|
||||
NMAPListIter * iter;
|
||||
|
||||
strength = (dbus_int32_t) nm_device_802_11_wireless_get_signal_strength (wdev);
|
||||
mode = (dbus_int32_t) nm_device_802_11_wireless_get_mode (wdev);
|
||||
strength = nm_device_802_11_wireless_get_signal_strength (wdev);
|
||||
mode = nm_device_802_11_wireless_get_mode (wdev);
|
||||
speed = nm_device_802_11_wireless_get_bitrate (wdev);
|
||||
|
||||
if (req && (ap = nm_act_request_get_ap (req)))
|
||||
{
|
||||
@@ -450,6 +452,9 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
speed = nm_device_802_3_ethernet_get_speed (NM_DEVICE_802_3_ETHERNET (dev));
|
||||
|
||||
if (!active_network_path)
|
||||
active_network_path = g_strdup ("");
|
||||
|
||||
@@ -469,6 +474,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
|
||||
DBUS_TYPE_INT32, &mode,
|
||||
DBUS_TYPE_INT32, &strength,
|
||||
DBUS_TYPE_BOOLEAN,&link_active,
|
||||
DBUS_TYPE_INT32, &speed,
|
||||
DBUS_TYPE_UINT32, &capabilities,
|
||||
DBUS_TYPE_UINT32, &type_capabilities,
|
||||
DBUS_TYPE_STRING, &active_network_path,
|
||||
|
@@ -1412,10 +1412,10 @@ nm_device_802_11_wireless_set_frequency (NMDevice80211Wireless *self,
|
||||
* nm_device_get_bitrate
|
||||
*
|
||||
* For wireless devices, get the bitrate to broadcast/receive at.
|
||||
* Returned value is rate in KHz.
|
||||
* Returned value is rate in Mb/s.
|
||||
*
|
||||
*/
|
||||
static int
|
||||
int
|
||||
nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self)
|
||||
{
|
||||
NMSock * sk;
|
||||
@@ -1435,7 +1435,7 @@ nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self)
|
||||
nm_dev_sock_close (sk);
|
||||
}
|
||||
|
||||
return ((err >= 0) ? wrq.u.bitrate.value / 1000 : 0);
|
||||
return ((err >= 0) ? wrq.u.bitrate.value / 1000000 : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -3086,6 +3086,8 @@ process_scan_results (NMDevice80211Wireless *dev,
|
||||
char *pos, *end, *custom, *genie, *gpos, *gend;
|
||||
NMAccessPoint *ap = NULL;
|
||||
size_t clen;
|
||||
struct iw_param iwp;
|
||||
int maxrate;
|
||||
struct iw_event iwe_buf, *iwe = &iwe_buf;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
@@ -3191,25 +3193,22 @@ process_scan_results (NMDevice80211Wireless *dev,
|
||||
nm_ap_add_capabilities_for_wep (ap);
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case SIOCGIWRATE:
|
||||
custom = pos + IW_EV_LCP_LEN;
|
||||
clen = iwe->len;
|
||||
if (custom + clen > end)
|
||||
break;
|
||||
maxrate = 0;
|
||||
while (((ssize_t) clen) >= sizeof(struct iw_param)) {
|
||||
/* Note: may be misaligned, make a local,
|
||||
* aligned copy */
|
||||
memcpy(&p, custom, sizeof(struct iw_param));
|
||||
if (p.value > maxrate)
|
||||
maxrate = p.value;
|
||||
clen -= sizeof(struct iw_param);
|
||||
custom += sizeof(struct iw_param);
|
||||
while (((ssize_t) clen) >= sizeof(struct iw_param))
|
||||
{
|
||||
/* the payload may be unaligned, so we align it */
|
||||
memcpy(&iwp, custom, sizeof (struct iw_param));
|
||||
if (iwp.value > maxrate)
|
||||
maxrate = iwp.value;
|
||||
clen -= sizeof (struct iw_param);
|
||||
custom += sizeof (struct iw_param);
|
||||
}
|
||||
results[ap_num].maxrate = maxrate;
|
||||
nm_ap_set_rate (ap, maxrate);
|
||||
break;
|
||||
#endif
|
||||
case IWEVGENIE:
|
||||
gpos = genie = custom;
|
||||
gend = genie + iwe->u.data.length;
|
||||
|
@@ -92,6 +92,8 @@ const char * nm_device_802_11_wireless_get_essid (NMDevice80211Wireless *self);
|
||||
gboolean nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
||||
const int mode);
|
||||
|
||||
int nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_best_ap (NMDevice80211Wireless *dev);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *dev,
|
||||
|
@@ -332,8 +332,8 @@ supports_ethtool_carrier_detect (NMDevice8023Ethernet *self)
|
||||
iface = nm_device_get_iface (NM_DEVICE (self));
|
||||
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_GENERAL, __func__, NULL)) == NULL)
|
||||
{
|
||||
nm_warning ("cannot open socket on interface %s for ethtool detect; errno=%d",
|
||||
iface, errno);
|
||||
nm_warning ("cannot open socket on interface %s for ethtool detect: %s",
|
||||
iface, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -357,6 +357,37 @@ out:
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self)
|
||||
{
|
||||
NMSock * sk;
|
||||
struct ifreq ifr;
|
||||
struct ethtool_cmd edata;
|
||||
const char * iface;
|
||||
int speed = 0;
|
||||
|
||||
g_return_val_if_fail (self != NULL, FALSE);
|
||||
|
||||
iface = nm_device_get_iface (NM_DEVICE (self));
|
||||
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_GENERAL, __func__, NULL)) == NULL)
|
||||
{
|
||||
nm_warning ("cannot open socket on interface %s for ethtool: %s",
|
||||
iface, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
strncpy (ifr.ifr_name, iface, sizeof (ifr.ifr_name) - 1);
|
||||
edata.cmd = ETHTOOL_GSET;
|
||||
ifr.ifr_data = (char *) &edata;
|
||||
if (ioctl (nm_dev_sock_get_fd (sk), SIOCETHTOOL, &ifr) == -1)
|
||||
goto out;
|
||||
speed = edata.speed;
|
||||
|
||||
out:
|
||||
nm_dev_sock_close (sk);
|
||||
return speed;
|
||||
}
|
||||
|
||||
|
||||
/**************************************/
|
||||
/* MII capability detection */
|
||||
|
@@ -73,6 +73,8 @@ void nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *dev,
|
||||
|
||||
void nm_device_802_3_ethernet_set_address (NMDevice8023Ethernet *dev);
|
||||
|
||||
int nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_DEVICE_802_3_ETHERNET_H */
|
||||
|
@@ -184,8 +184,13 @@ static void detail_network (DBusConnection *connection, const char *path, const
|
||||
enc_string = g_string_append (enc_string, ")");
|
||||
}
|
||||
|
||||
temp = g_strdup_printf ("%s Mode, Freq %.3f MHz, Strength %d%%%s%s", (mode == IW_MODE_INFRA) ? "Infrastructure" : "Ad-Hoc",
|
||||
flt_freq, strength, (enc_string && strlen (enc_string->str)) ? enc_string->str : "", !broadcast ? ", Hidden" : "");
|
||||
temp = g_strdup_printf ("%s Mode, Freq %.3f MHz, Rate %d Mb/s, Strength %d%%%s%s",
|
||||
(mode == IW_MODE_INFRA) ? "Infrastructure" : "Ad-Hoc",
|
||||
flt_freq,
|
||||
rate / 1024,
|
||||
strength,
|
||||
(enc_string && strlen (enc_string->str)) ? enc_string->str : "",
|
||||
!broadcast ? ", Hidden" : "");
|
||||
temp_essid = g_strdup_printf (" %s%s", active ? "*" : "", essid);
|
||||
print_string (temp_essid, temp);
|
||||
g_string_free (enc_string, TRUE);
|
||||
@@ -251,6 +256,7 @@ static void detail_device (DBusConnection *connection, const char *path)
|
||||
dbus_int32_t strength = -1;
|
||||
char * active_network_path = NULL;
|
||||
dbus_bool_t link_active = FALSE;
|
||||
dbus_int32_t speed = 0;
|
||||
dbus_uint32_t caps = NM_DEVICE_CAP_NONE;
|
||||
dbus_uint32_t type_caps = NM_DEVICE_CAP_NONE;
|
||||
char ** networks = NULL;
|
||||
@@ -290,6 +296,7 @@ static void detail_device (DBusConnection *connection, const char *path)
|
||||
DBUS_TYPE_INT32, &mode,
|
||||
DBUS_TYPE_INT32, &strength,
|
||||
DBUS_TYPE_BOOLEAN,&link_active,
|
||||
DBUS_TYPE_INT32, &speed,
|
||||
DBUS_TYPE_UINT32, &caps,
|
||||
DBUS_TYPE_UINT32, &type_caps,
|
||||
DBUS_TYPE_STRING, &active_network_path,
|
||||
@@ -328,6 +335,15 @@ static void detail_device (DBusConnection *connection, const char *path)
|
||||
if (caps & NM_DEVICE_CAP_CARRIER_DETECT)
|
||||
print_string (" Carrier Detect", "yes");
|
||||
|
||||
if (speed)
|
||||
{
|
||||
char *speed_string;
|
||||
|
||||
speed_string = g_strdup_printf ("%d Mb/s", speed);
|
||||
print_string (" Speed", speed_string);
|
||||
g_free (speed_string);
|
||||
}
|
||||
|
||||
/* Wireless specific information */
|
||||
if (type == DEVICE_TYPE_802_11_WIRELESS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user