2007-10-26 Dan Williams <dcbw@redhat.com>

Patch from Helmut Schaa <hschaa@suse.de> (and more bits from me)

	* src/NetworkManagerAP.c
	  src/NetworkManagerAP.h
	  libnm-glib/nm-access-point.c
	  libnm-glib/nm-access-point.h
		- Make 'rate' property a guint32 to better match with WEXT and
			wpa_supplicant and to allow representation of higher bitrates

	* src/nm-device-802-11-wireless.c
	  introspection/nm-device-802-11-wireless.xml
	  libnm-glib/nm-device-802-11-wireless.c
	  libnm-glib/nm-device-802-11-wireless.h
		- Make 'bitrate' property a guint32 to match AP 'rate' property type

	* src/nm-device-802-3-ethernet.c
	  src/nm-device-802-3-ethernet.h
	  introspection/nm-device-802-3-ethernet.xml
	  libnm-glib/nm-device-802-3-ethernet.c
	  libnm-glib/nm-device-802-3-ethernet.h
		- Make 'speed' property a guint32 to match other speed/rate types
		- Make nm_device_802_3_ethernet_get_speed() static

	* test/nm-tool.c
		- Update for the changes above



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3030 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-10-27 02:58:32 +00:00
parent fb7e6b461a
commit 792b14dec4
14 changed files with 77 additions and 44 deletions

View File

@@ -43,7 +43,7 @@ typedef struct
int mode; /* from IW_MODE_* in wireless.h */
gint8 strength;
guint32 freq; /* Frequency in GHz * 1000; ie 2.412 == 2412 */
guint16 rate;
guint32 rate;
guint32 flags; /* General flags */
guint32 wpa_flags; /* WPA-related flags */
@@ -965,9 +965,9 @@ nm_ap_set_freq (NMAccessPoint *ap,
* Get/set functions for rate
*
*/
guint16 nm_ap_get_rate (NMAccessPoint *ap)
guint32 nm_ap_get_rate (NMAccessPoint *ap)
{
guint16 rate;
guint32 rate;
g_return_val_if_fail (NM_IS_AP (ap), 0);
@@ -977,7 +977,7 @@ guint16 nm_ap_get_rate (NMAccessPoint *ap)
}
void
nm_ap_set_rate (NMAccessPoint *ap, guint16 rate)
nm_ap_set_rate (NMAccessPoint *ap, guint32 rate)
{
NMAccessPointPrivate *priv;

View File

@@ -93,8 +93,8 @@ void nm_ap_set_strength (NMAccessPoint *ap, gint8 strength);
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);
guint32 nm_ap_get_rate (NMAccessPoint *ap);
void nm_ap_set_rate (NMAccessPoint *ap, guint32 rate);
gboolean nm_ap_get_invalid (const NMAccessPoint *ap);
void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid);

View File

@@ -124,7 +124,7 @@ struct _NMDevice80211WirelessPrivate
GSList * ap_list;
NMAccessPoint * current_ap;
int rate;
guint32 rate;
gboolean scanning;
GTimeVal scheduled_scan_time;
@@ -185,7 +185,7 @@ static void cleanup_supplicant_interface (NMDevice80211Wireless * self);
static void device_cleanup (NMDevice80211Wireless *self);
static int nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self);
static guint32 nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self);
static void
@@ -562,7 +562,7 @@ periodic_update (NMDevice80211Wireless *self, gboolean honor_scan)
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
NMDeviceState state;
NMAccessPoint *new_ap;
int new_rate;
guint32 new_rate;
/* BSSID and signal strength have meaningful values only if the device
is activated and not scanning */
@@ -1298,10 +1298,10 @@ nm_device_802_11_wireless_set_ssid (NMDevice80211Wireless *self,
* nm_device_802_11_wireless_get_bitrate
*
* For wireless devices, get the bitrate to broadcast/receive at.
* Returned value is rate in Mb/s.
* Returned value is rate in b/s.
*
*/
static int
static guint32
nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self)
{
NMSock *sk;
@@ -1318,7 +1318,7 @@ nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self)
nm_dev_sock_close (sk);
}
return ((err >= 0) ? wrq.u.bitrate.value / 1000000 : 0);
return ((err >= 0) ? wrq.u.bitrate.value : 0);
}
/*
@@ -2881,7 +2881,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_int (value, nm_device_802_11_wireless_get_mode (device));
break;
case PROP_BITRATE:
g_value_set_int (value, priv->rate);
g_value_set_uint (value, priv->rate);
break;
case PROP_CAPABILITIES:
g_value_set_uint (value, priv->capabilities);
@@ -2949,10 +2949,10 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_BITRATE,
g_param_spec_int (NM_DEVICE_802_11_WIRELESS_BITRATE,
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_BITRATE,
"Bitrate",
"Bitrate",
0, G_MAXINT32, 0,
0, G_MAXUINT32, 0,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_ACTIVE_ACCESS_POINT,

View File

@@ -61,6 +61,8 @@ enum {
LAST_PROP
};
static guint32 nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self);
static gboolean supports_mii_carrier_detect (NMDevice8023Ethernet *dev);
static gboolean supports_ethtool_carrier_detect (NMDevice8023Ethernet *dev);
@@ -435,7 +437,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, &hw_addr_buf[0]);
break;
case PROP_SPEED:
g_value_set_int (value, nm_device_802_3_ethernet_get_speed (device));
g_value_set_uint (value, nm_device_802_3_ethernet_get_speed (device));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -479,10 +481,10 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass)
g_object_class_install_property
(object_class, PROP_SPEED,
g_param_spec_int (NM_DEVICE_802_3_ETHERNET_SPEED,
g_param_spec_uint (NM_DEVICE_802_3_ETHERNET_SPEED,
"Speed",
"Speed",
0, G_MAXINT32, 0,
0, G_MAXUINT32, 0,
G_PARAM_READABLE));
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
@@ -551,14 +553,15 @@ out:
}
int
/* Returns speed in Mb/s */
static guint32
nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self)
{
NMSock * sk;
struct ifreq ifr;
struct ethtool_cmd edata;
const char * iface;
int speed = 0;
guint32 speed = 0;
g_return_val_if_fail (self != NULL, FALSE);
@@ -575,7 +578,7 @@ nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self)
ifr.ifr_data = (char *) &edata;
if (ioctl (nm_dev_sock_get_fd (sk), SIOCETHTOOL, &ifr) == -1)
goto out;
speed = edata.speed;
speed = edata.speed > 0 ? (guint32) edata.speed : 0;
out:
nm_dev_sock_close (sk);

View File

@@ -59,8 +59,6 @@ NMDevice8023Ethernet *nm_device_802_3_ethernet_new (int index,
void nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *dev,
struct ether_addr *addr);
int nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self);
G_END_DECLS
#endif /* NM_DEVICE_802_3_ETHERNET_H */