From bc4114e2235163bd88456c25cc0a908d86151f93 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 9 Oct 2013 12:02:08 +0800 Subject: Add system info messages Add a little infrastructure for communicating information about the system to the petitboot UIs. We just send some identifying info (type and identifier), as well as the interfaces. Signed-off-by: Jeremy Kerr --- ui/test/discover-test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'ui/test') diff --git a/ui/test/discover-test.c b/ui/test/discover-test.c index faf1d89..576f293 100644 --- a/ui/test/discover-test.c +++ b/ui/test/discover-test.c @@ -82,11 +82,41 @@ static void print_status(struct boot_status *status, } +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) -- cgit v1.2.1