From bad9baa8794ed0c31b7f93b110815d98db7b2d7a Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 18 Sep 2013 11:44:41 +0800 Subject: discover: populate udev device types Now that we have device types, populate from the udev info. Signed-off-by: Jeremy Kerr --- ui/test/discover-test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ui') diff --git a/ui/test/discover-test.c b/ui/test/discover-test.c index 45a4c74..faf1d89 100644 --- a/ui/test/discover-test.c +++ b/ui/test/discover-test.c @@ -3,6 +3,21 @@ #include "ui/common/discover-client.h" +static const char *device_type_string(enum device_type type) +{ + switch (type) { + case DEVICE_TYPE_DISK: + return "disk"; + case DEVICE_TYPE_NETWORK: + return "network"; + case DEVICE_TYPE_OPTICAL: + return "optical"; + case DEVICE_TYPE_UNKNOWN: + return "unknown"; + } + return "invalid"; +} + static int print_device_add(struct device *device, void __attribute__((unused)) *arg) { @@ -10,6 +25,7 @@ static int print_device_add(struct device *device, printf("new device:\n"); printf("\tid: %s\n", device->id); + printf("\ttype: %s\n", device_type_string(device->type)); printf("\tname: %s\n", device->name); printf("\tdesc: %s\n", device->description); printf("\ticon: %s\n", device->icon_file); -- cgit v1.2.1