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/common/discover-client.c | 19 +++++++++++++++++++ ui/common/discover-client.h | 1 + 2 files changed, 20 insertions(+) (limited to 'ui/common') diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c index c3f3f38..90cd3b4 100644 --- a/ui/common/discover-client.c +++ b/ui/common/discover-client.c @@ -118,10 +118,19 @@ static void update_status(struct discover_client *client, talloc_free(status); } +static void update_sysinfo(struct discover_client *client, + struct system_info *sysinfo) +{ + if (client->ops.update_sysinfo) + client->ops.update_sysinfo(sysinfo, client->ops.cb_arg); + talloc_free(sysinfo); +} + static int discover_client_process(void *arg) { struct discover_client *client = arg; struct pb_protocol_message *message; + struct system_info *sysinfo; struct boot_status *status; struct boot_option *opt; struct device *dev; @@ -175,6 +184,16 @@ static int discover_client_process(void *arg) } update_status(client, status); break; + case PB_PROTOCOL_ACTION_SYSTEM_INFO: + sysinfo = talloc_zero(client, struct system_info); + + rc = pb_protocol_deserialise_system_info(sysinfo, message); + if (rc) { + pb_log("%s: invalid sysinfo message?\n", __func__); + return 0; + } + update_sysinfo(client, sysinfo); + break; default: pb_log("%s: unknown action %d\n", __func__, message->action); } diff --git a/ui/common/discover-client.h b/ui/common/discover-client.h index ed1f504..feca63b 100644 --- a/ui/common/discover-client.h +++ b/ui/common/discover-client.h @@ -26,6 +26,7 @@ struct discover_client_ops { void *arg); void (*device_remove)(struct device *device, void *arg); void (*update_status)(struct boot_status *status, void *arg); + void (*update_sysinfo)(struct system_info *sysinfo, void *arg); void *cb_arg; }; -- cgit v1.2.1