libnm-glib: print HW address of generic devices in test tool
authorBeniamino Galvani <bgalvani@redhat.com>
Tue, 10 Nov 2015 20:46:06 +0000 (21:46 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Wed, 25 Nov 2015 10:39:57 +0000 (11:39 +0100)
This is not particularly useful per se, but allows to check that
generic devices are instantiated properly.

libnm-glib/libnm-glib-test.c

index 3b8f6ca..9c8085d 100644 (file)
@@ -36,6 +36,7 @@
 #include "nm-device.h"
 #include "nm-device-ethernet.h"
 #include "nm-device-wifi.h"
+#include "nm-device-generic.h"
 #include "nm-utils.h"
 #include "nm-active-connection.h"
 #include "nm-vpn-connection.h"
@@ -211,6 +212,12 @@ dump_wireless (NMDeviceWifi *device)
        }
 }
 
+static void
+dump_generic (NMDeviceGeneric *device)
+{
+       g_print ("HW address: %s\n", nm_device_generic_get_hw_address (device));
+}
+
 static void
 dump_wired (NMDeviceEthernet *device)
 {
@@ -253,6 +260,8 @@ dump_device (NMDevice *device)
                dump_wired (NM_DEVICE_ETHERNET (device));
        else if (NM_IS_DEVICE_WIFI (device))
                dump_wireless (NM_DEVICE_WIFI (device));
+       else if (NM_IS_DEVICE_GENERIC (device))
+               dump_generic (NM_DEVICE_GENERIC (device));
 
        dump_dhcp4_config (nm_device_get_dhcp4_config (device));
 }