[PATCH] Fix access point rate for trunk and stable
- From: Helmut Schaa <hschaa suse de>
- To: Dan Williams <dcbw redhat com>
- Cc: networkmanager-list gnome org
- Subject: [PATCH] Fix access point rate for trunk and stable
- Date: Mon, 8 Oct 2007 12:41:43 +0200
Hi,
NetworkManager (stable and trunk) uses a guint16 for holding the
access-point's rate property. Unfortunately wpa_supplicant, iwlist and the
wext-interface use an int32 for the same. The attached patches fix this issue
by using a gint32 instead of a guint16 for trunk and stable.
I hope I didn't forget anything :)
Dan, Tambet, please have a look at the patches and commit if everything is
fine.
Thanks,
Helmut
--- src/NetworkManagerAP.c
+++ src/NetworkManagerAP.c
@@ -40,7 +40,7 @@
int mode; /* from IW_MODE_* in wireless.h */
gint8 strength;
double freq;
- guint16 rate;
+ gint32 rate;
guint32 capabilities;
/* Non-scanned attributes */
@@ -365,14 +365,14 @@
* Get/set functions for rate
*
*/
-guint16 nm_ap_get_rate (const NMAccessPoint *ap)
+gint32 nm_ap_get_rate (const NMAccessPoint *ap)
{
g_return_val_if_fail (ap != NULL, 0);
return (ap->rate);
}
-void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate)
+void nm_ap_set_rate (NMAccessPoint *ap, gint32 rate)
{
g_return_if_fail (ap != NULL);
--- src/NetworkManagerAP.h
+++ src/NetworkManagerAP.h
@@ -66,8 +66,8 @@
double nm_ap_get_freq (const NMAccessPoint *ap);
void nm_ap_set_freq (NMAccessPoint *ap, double freq);
-guint16 nm_ap_get_rate (const NMAccessPoint *ap);
-void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate);
+gint32 nm_ap_get_rate (const NMAccessPoint *ap);
+void nm_ap_set_rate (NMAccessPoint *ap, gint32 rate);
gboolean nm_ap_get_invalid (const NMAccessPoint *ap);
void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid);
--- test/nm-tool.c
+++ test/nm-tool.c
@@ -187,7 +187,7 @@
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,
+ rate / 1000000,
strength,
(enc_string && strlen (enc_string->str)) ? enc_string->str : "",
!broadcast ? ", Hidden" : "");
Index: test/nm-tool.c
===================================================================
--- test/nm-tool.c (Revision 2951)
+++ test/nm-tool.c (Arbeitskopie)
@@ -166,7 +166,7 @@
"%s Mode, Freq %d MHz, Rate %d Mb/s, Strength %d",
(nm_access_point_get_mode (ap) == IW_MODE_INFRA) ? "Infrastructure" : "Ad-Hoc",
nm_access_point_get_frequency (ap),
- nm_access_point_get_rate (ap) / 1024,
+ nm_access_point_get_rate (ap) / 1000000,
nm_access_point_get_strength (ap));
if ( !(flags & NM_802_11_AP_FLAGS_PRIVACY)
Index: src/NetworkManagerAP.c
===================================================================
--- src/NetworkManagerAP.c (Revision 2951)
+++ src/NetworkManagerAP.c (Arbeitskopie)
@@ -53,7 +53,7 @@
int mode; /* from IW_MODE_* in wireless.h */
gint8 strength;
guint32 freq; /* Frequency in GHz * 1000; ie 2.412 == 2412 */
- guint16 rate;
+ gint32 rate;
guint32 flags; /* General flags */
guint32 wpa_flags; /* WPA-related flags */
@@ -193,7 +193,7 @@
break;
case PROP_RATE:
dbus_prop = DBUS_PROP_RATE;
- priv->rate = g_value_get_uint (value);
+ priv->rate = g_value_get_int (value);
break;
case PROP_STRENGTH:
dbus_prop = DBUS_PROP_STRENGTH;
@@ -254,7 +254,7 @@
g_value_set_int (value, priv->mode);
break;
case PROP_RATE:
- g_value_set_uint (value, priv->rate);
+ g_value_set_int (value, priv->rate);
break;
case PROP_STRENGTH:
g_value_set_char (value, priv->strength);
@@ -849,9 +849,9 @@
* Get/set functions for rate
*
*/
-guint16 nm_ap_get_rate (NMAccessPoint *ap)
+gint32 nm_ap_get_rate (NMAccessPoint *ap)
{
- guint16 rate;
+ gint32 rate;
g_return_val_if_fail (NM_IS_AP (ap), 0);
@@ -860,7 +860,7 @@
return rate;
}
-void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate)
+void nm_ap_set_rate (NMAccessPoint *ap, gint32 rate)
{
g_return_if_fail (NM_IS_AP (ap));
Index: src/NetworkManagerAP.h
===================================================================
--- src/NetworkManagerAP.h (Revision 2951)
+++ src/NetworkManagerAP.h (Arbeitskopie)
@@ -92,8 +92,8 @@
guint32 nm_ap_get_freq (NMAccessPoint *ap);
void nm_ap_set_freq (NMAccessPoint *ap, guint32 freq);
-guint16 nm_ap_get_rate (NMAccessPoint *ap);
-void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate);
+gint32 nm_ap_get_rate (NMAccessPoint *ap);
+void nm_ap_set_rate (NMAccessPoint *ap, gint32 rate);
gboolean nm_ap_get_invalid (const NMAccessPoint *ap);
void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid);
Index: libnm-glib/nm-access-point.c
===================================================================
--- libnm-glib/nm-access-point.c (Revision 2951)
+++ libnm-glib/nm-access-point.c (Arbeitskopie)
@@ -19,7 +19,7 @@
guint32 frequency;
char *hw_address;
int mode;
- guint32 rate;
+ gint32 rate;
gint8 strength;
} NMAccessPointPrivate;
@@ -134,7 +134,7 @@
g_value_set_int (value, priv->mode);
break;
case PROP_RATE:
- g_value_set_uint (value, priv->rate);
+ g_value_set_int (value, priv->rate);
break;
case PROP_STRENGTH:
g_value_set_char (value, priv->strength);
@@ -255,7 +255,7 @@
g_param_spec_uint (NM_ACCESS_POINT_RATE,
"Rate",
"Rate",
- 0, G_MAXUINT16, 0,
+ 0, G_MAXINT32, 0,
G_PARAM_READABLE));
g_object_class_install_property
@@ -337,8 +337,8 @@
priv->mode = g_value_get_uint (value);
} else if (!strcmp (key, DBUS_PROP_RATE)) {
g_propname = NM_ACCESS_POINT_RATE;
- if (G_VALUE_HOLDS_UINT (value))
- priv->rate = g_value_get_uint (value);
+ if (G_VALUE_HOLDS_INT (value))
+ priv->rate = g_value_get_int (value);
} else if (!strcmp (key, DBUS_PROP_STRENGTH)) {
g_propname = NM_ACCESS_POINT_STRENGTH;
if (G_VALUE_HOLDS_UCHAR (value))
@@ -481,7 +481,7 @@
return priv->mode;
}
-guint32
+gint32
nm_access_point_get_rate (NMAccessPoint *ap)
{
NMAccessPointPrivate *priv;
@@ -490,9 +490,9 @@
priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
if (!priv->rate) {
- priv->rate = nm_object_get_uint_property (NM_OBJECT (ap),
- NM_DBUS_INTERFACE_ACCESS_POINT,
- DBUS_PROP_RATE);
+ priv->rate = nm_object_get_int_property (NM_OBJECT (ap),
+ NM_DBUS_INTERFACE_ACCESS_POINT,
+ DBUS_PROP_RATE);
}
return priv->rate;
Index: libnm-glib/nm-access-point.h
===================================================================
--- libnm-glib/nm-access-point.h (Revision 2951)
+++ libnm-glib/nm-access-point.h (Arbeitskopie)
@@ -33,7 +33,7 @@
guint32 nm_access_point_get_frequency (NMAccessPoint *ap);
const char * nm_access_point_get_hw_address (NMAccessPoint *ap);
int nm_access_point_get_mode (NMAccessPoint *ap);
-guint32 nm_access_point_get_rate (NMAccessPoint *ap);
+gint32 nm_access_point_get_rate (NMAccessPoint *ap);
gint8 nm_access_point_get_strength (NMAccessPoint *ap);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]