summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-05-25 10:52:25 -0700
committerDan Williams <dcbw@redhat.com>2010-05-25 10:52:25 -0700
commitfea6431a20674ab4d732b9e1ecd2839ea0939f6a (patch)
tree7f2a7b16ecf49ed3fded91856bebca0bf7273cda /libnm-glib
parentba1717479835577b0f416b3465f7edd767a61762 (diff)
downloadNetworkManager-fea6431a20674ab4d732b9e1ecd2839ea0939f6a.tar.gz
core/libnm-glib: implement better missing firmware support (rh #594578)
Track missing firmware and ensure the device can't be used when firmware is missing. Add a property for missing firmware so that clients can do something intelligent with this information.
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/Makefile.am2
-rw-r--r--libnm-glib/libnm-glib.ver1
-rw-r--r--libnm-glib/nm-device.c67
-rw-r--r--libnm-glib/nm-device.h28
4 files changed, 74 insertions, 24 deletions
diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am
index 8f03b0abda..e230a7c149 100644
--- a/libnm-glib/Makefile.am
+++ b/libnm-glib/Makefile.am
@@ -132,7 +132,7 @@ libnm_glib_la_LIBADD = \
$(GUDEV_LIBS)
libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib.ver \
- -version-info "4:2:2"
+ -version-info "5:0:3"
noinst_PROGRAMS = libnm-glib-test
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 6d48fb38eb..2b84dace1e 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -68,6 +68,7 @@ global:
nm_device_get_capabilities;
nm_device_get_dhcp4_config;
nm_device_get_driver;
+ nm_device_get_firmware_missing;
nm_device_get_iface;
nm_device_get_ip4_config;
nm_device_get_ip6_config;
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index a24eb06efa..b07c9b0dcb 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2008 Red Hat, Inc.
+ * Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#include <string.h>
@@ -53,6 +53,7 @@ typedef struct {
char *driver;
guint32 capabilities;
gboolean managed;
+ gboolean firmware_missing;
NMIP4Config *ip4_config;
gboolean null_ip4_config;
NMDHCP4Config *dhcp4_config;
@@ -75,6 +76,7 @@ enum {
PROP_DRIVER,
PROP_CAPABILITIES,
PROP_MANAGED,
+ PROP_FIRMWARE_MISSING,
PROP_IP4_CONFIG,
PROP_DHCP4_CONFIG,
PROP_IP6_CONFIG,
@@ -268,15 +270,16 @@ register_for_property_changed (NMDevice *device)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
const NMPropertiesChangedInfo property_changed_info[] = {
- { NM_DEVICE_UDI, _nm_object_demarshal_generic, &priv->udi },
- { NM_DEVICE_INTERFACE, _nm_object_demarshal_generic, &priv->iface },
- { NM_DEVICE_DRIVER, _nm_object_demarshal_generic, &priv->driver },
- { NM_DEVICE_CAPABILITIES, _nm_object_demarshal_generic, &priv->capabilities },
- { NM_DEVICE_MANAGED, _nm_object_demarshal_generic, &priv->managed },
- { NM_DEVICE_IP4_CONFIG, demarshal_ip4_config, &priv->ip4_config },
- { NM_DEVICE_DHCP4_CONFIG, demarshal_dhcp4_config, &priv->dhcp4_config },
- { NM_DEVICE_IP6_CONFIG, demarshal_ip6_config, &priv->ip6_config },
- { NM_DEVICE_DHCP6_CONFIG, demarshal_dhcp6_config, &priv->dhcp6_config },
+ { NM_DEVICE_UDI, _nm_object_demarshal_generic, &priv->udi },
+ { NM_DEVICE_INTERFACE, _nm_object_demarshal_generic, &priv->iface },
+ { NM_DEVICE_DRIVER, _nm_object_demarshal_generic, &priv->driver },
+ { NM_DEVICE_CAPABILITIES, _nm_object_demarshal_generic, &priv->capabilities },
+ { NM_DEVICE_MANAGED, _nm_object_demarshal_generic, &priv->managed },
+ { NM_DEVICE_FIRMWARE_MISSING, _nm_object_demarshal_generic, &priv->firmware_missing },
+ { NM_DEVICE_IP4_CONFIG, demarshal_ip4_config, &priv->ip4_config },
+ { NM_DEVICE_DHCP4_CONFIG, demarshal_dhcp4_config, &priv->dhcp4_config },
+ { NM_DEVICE_IP6_CONFIG, demarshal_ip6_config, &priv->ip6_config },
+ { NM_DEVICE_DHCP6_CONFIG, demarshal_dhcp6_config, &priv->dhcp6_config },
{ NULL },
};
@@ -408,6 +411,9 @@ get_property (GObject *object,
case PROP_MANAGED:
g_value_set_boolean (value, nm_device_get_managed (device));
break;
+ case PROP_FIRMWARE_MISSING:
+ g_value_set_boolean (value, nm_device_get_firmware_missing (device));
+ break;
case PROP_IP4_CONFIG:
g_value_set_object (value, nm_device_get_ip4_config (device));
break;
@@ -516,6 +522,20 @@ nm_device_class_init (NMDeviceClass *device_class)
G_PARAM_READABLE));
/**
+ * NMDevice:firmware-missing:
+ *
+ * When %TRUE indicates the device is likely missing firmware required
+ * for its operation.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_FIRMWARE_MISSING,
+ g_param_spec_boolean (NM_DEVICE_FIRMWARE_MISSING,
+ "FirmwareMissing",
+ "Firmware missing",
+ FALSE,
+ G_PARAM_READABLE));
+
+ /**
* NMDevice:ip4-config:
*
* The #NMIP4Config of the device.
@@ -830,6 +850,33 @@ nm_device_get_managed (NMDevice *device)
}
/**
+ * nm_device_get_firmware_missing:
+ * @device: a #NMDevice
+ *
+ * Indicates that firmware required for the device's operation is likely
+ * to be missing.
+ *
+ * Returns: %TRUE if firmware required for the device's operation is likely
+ * to be missing.
+ **/
+gboolean
+nm_device_get_firmware_missing (NMDevice *device)
+{
+ NMDevicePrivate *priv;
+
+ g_return_val_if_fail (NM_IS_DEVICE (device), 0);
+
+ priv = NM_DEVICE_GET_PRIVATE (device);
+ if (!priv->firmware_missing) {
+ priv->firmware_missing = _nm_object_get_boolean_property (NM_OBJECT (device),
+ NM_DBUS_INTERFACE_DEVICE,
+ "FirmwareMissing");
+ }
+
+ return priv->firmware_missing;
+}
+
+/**
* nm_device_get_ip4_config:
* @device: a #NMDevice
*
diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h
index 64694ec833..5a47ff9a63 100644
--- a/libnm-glib/nm-device.h
+++ b/libnm-glib/nm-device.h
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2008 Red Hat, Inc.
+ * Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#ifndef NM_DEVICE_H
@@ -49,6 +49,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_DRIVER "driver"
#define NM_DEVICE_CAPABILITIES "capabilities"
#define NM_DEVICE_MANAGED "managed"
+#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
#define NM_DEVICE_IP4_CONFIG "ip4-config"
#define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
#define NM_DEVICE_IP6_CONFIG "ip6-config"
@@ -83,18 +84,19 @@ GType nm_device_get_type (void);
GObject * nm_device_new (DBusGConnection *connection, const char *path);
-const char * nm_device_get_iface (NMDevice *device);
-const char * nm_device_get_udi (NMDevice *device);
-const char * nm_device_get_driver (NMDevice *device);
-guint32 nm_device_get_capabilities (NMDevice *device);
-gboolean nm_device_get_managed (NMDevice *device);
-NMIP4Config * nm_device_get_ip4_config (NMDevice *device);
-NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device);
-NMIP6Config * nm_device_get_ip6_config (NMDevice *device);
-NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
-NMDeviceState nm_device_get_state (NMDevice *device);
-const char * nm_device_get_product (NMDevice *device);
-const char * nm_device_get_vendor (NMDevice *device);
+const char * nm_device_get_iface (NMDevice *device);
+const char * nm_device_get_udi (NMDevice *device);
+const char * nm_device_get_driver (NMDevice *device);
+guint32 nm_device_get_capabilities (NMDevice *device);
+gboolean nm_device_get_managed (NMDevice *device);
+gboolean nm_device_get_firmware_missing (NMDevice *device);
+NMIP4Config * nm_device_get_ip4_config (NMDevice *device);
+NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device);
+NMIP6Config * nm_device_get_ip6_config (NMDevice *device);
+NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
+NMDeviceState nm_device_get_state (NMDevice *device);
+const char * nm_device_get_product (NMDevice *device);
+const char * nm_device_get_vendor (NMDevice *device);
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);