NetworkManager r3565 - in trunk: . libnm-glib



Author: dcbw
Date: Wed Apr 16 14:41:56 2008
New Revision: 3565
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3565&view=rev

Log:
2008-04-15  Dan Williams  <dcbw redhat com>

	* libnm-glib/nm-device.c
		- (get_product_and_vendor): handle serial devices correctly
		- (nm_device_update_description): pass device to get_product_and_vendor()



Modified:
   trunk/ChangeLog
   trunk/libnm-glib/nm-device.c

Modified: trunk/libnm-glib/nm-device.c
==============================================================================
--- trunk/libnm-glib/nm-device.c	(original)
+++ trunk/libnm-glib/nm-device.c	Wed Apr 16 14:41:56 2008
@@ -496,7 +496,8 @@
 }
 
 static char *
-get_product_and_vendor (DBusGConnection *connection,
+get_product_and_vendor (NMDevice *device,
+                        DBusGConnection *connection,
                         const char *udi,
                         gboolean want_origdev,
                         gboolean warn,
@@ -539,8 +540,13 @@
     }
 
 	if (want_origdev) {
+		gboolean serial = FALSE;
+
+		if (NM_IS_GSM_DEVICE (device) || NM_IS_CDMA_DEVICE (device))
+			serial = TRUE;
+
 		dbus_g_proxy_call (proxy, "GetPropertyString", NULL,
-		                   G_TYPE_STRING, "net.originating_device",
+		                   G_TYPE_STRING, serial ? "serial.originating_device" : "net.originating_device",
 		                   G_TYPE_INVALID,
 		                   G_TYPE_STRING, &parent,
 		                   G_TYPE_INVALID);
@@ -548,7 +554,7 @@
 		if (!parent) {
 			/* Older HAL uses 'physical_device' */
 			dbus_g_proxy_call (proxy, "GetPropertyString", &err,
-			                   G_TYPE_STRING, "net.physical_device",
+			                   G_TYPE_STRING, serial ? "serial.physical_device" : "net.physical_device",
 			                   G_TYPE_INVALID,
 			                   G_TYPE_STRING, &parent,
 			                   G_TYPE_INVALID);
@@ -603,9 +609,10 @@
 	connection = nm_object_get_connection (NM_OBJECT (device));
 	g_return_if_fail (connection != NULL);
 
-	/* First, get the originating device info */
+	/* First, get the udi of the originating device */
 	udi = nm_device_get_udi (device);
-	orig_dev_udi = get_product_and_vendor (connection, udi, TRUE, FALSE, &priv->product, &priv->vendor);
+	orig_dev_udi = get_product_and_vendor (device, connection, udi, TRUE, FALSE,
+	                                       &priv->product, &priv->vendor);
 
 	/* Ignore product and vendor for the Network Interface */
 	if (priv->product || priv->vendor) {
@@ -616,7 +623,8 @@
 	}
 
 	/* Get product and vendor off the originating device if possible */
-	pd_parent_udi = get_product_and_vendor (connection,
+	pd_parent_udi = get_product_and_vendor (device,
+	                                        connection,
 	                                        orig_dev_udi,
 	                                        FALSE,
 	                                        FALSE,
@@ -629,8 +637,8 @@
 	 */
 	if (!priv->product || !priv->vendor) {
 		char *ignore;
-		ignore = get_product_and_vendor (connection, pd_parent_udi, FALSE, TRUE,
-		                                 &priv->product, &priv->vendor);
+		ignore = get_product_and_vendor (device, connection, pd_parent_udi,
+		                                 FALSE, TRUE, &priv->product, &priv->vendor);
 		g_free (ignore);
 	}
 	g_free (pd_parent_udi);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]