X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Ftest%2Fdiscover-test.c;h=6fb14dec2059b9c83c0184174b885e1219e1c5d1;hp=faf1d893677936fc9307b9329df8244ee33260d2;hb=5f8fa2c151b8f0e568dc4015b7d307250b354a04;hpb=bad9baa8794ed0c31b7f93b110815d98db7b2d7a diff --git a/ui/test/discover-test.c b/ui/test/discover-test.c index faf1d89..6fb14de 100644 --- a/ui/test/discover-test.c +++ b/ui/test/discover-test.c @@ -8,10 +8,16 @@ static const char *device_type_string(enum device_type type) switch (type) { case DEVICE_TYPE_DISK: return "disk"; + case DEVICE_TYPE_USB: + return "usb"; case DEVICE_TYPE_NETWORK: return "network"; case DEVICE_TYPE_OPTICAL: return "optical"; + case DEVICE_TYPE_ANY: + return "any"; + case DEVICE_TYPE_LUKS: + return "encrypted"; case DEVICE_TYPE_UNKNOWN: return "unknown"; } @@ -71,22 +77,50 @@ static void print_device_remove(struct device *device, printf("\tname: %s\n", device->name); } -static void print_status(struct boot_status *status, +static void print_status(struct status *status, void __attribute__((unused)) *arg) { printf("status:\n"); printf("\ttype: %d\n", status->type); printf("\tmessage: %s\n", status->message); - printf("\tdetail: %s\n", status->detail); - printf("\tprogress: %d\n", status->progress); } +static void print_sysinfo(struct system_info *sysinfo, + void __attribute__((unused)) *arg) +{ + unsigned int i; + + printf("sysinfo:\n"); + printf("\ttype: %s\n", sysinfo->type); + printf("\tid: %s\n", sysinfo->identifier); + + if (sysinfo->n_interfaces == 0) + printf("\tno interfaces.\n"); + else + printf("\tinterfaces:\n"); + + for (i = 0; i < sysinfo->n_interfaces; i++) { + struct interface_info *if_info = sysinfo->interfaces[i]; + uint8_t *m = if_info->hwaddr; + + printf("\t\tname: %s\n", if_info->name); + + if (if_info->hwaddr_size == 6) + printf("\t\tmac: %02x:%02x:%02x:%02x:%02x:%02x\n", + m[0], m[1], m[2], m[3], m[4], m[5]); + else + printf("\t\tmac: unknown hwaddr size %d\n", + if_info->hwaddr_size); + } +} + static struct discover_client_ops client_ops = { .device_add = print_device_add, .boot_option_add = print_boot_option_add, .device_remove = print_device_remove, .update_status = print_status, + .update_sysinfo = print_sysinfo, }; int main(void)