From 7832d10c59cfe7f06e19bc6f0b6acaac1a552618 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 18 Oct 2013 10:31:03 +0800 Subject: config: Implement config messages On client connect, send a PB_PROTOCOL_ACTION_CONFIG message. Signed-off-by: Jeremy Kerr --- ui/common/discover-client.c | 18 ++++++++++++++++++ ui/common/discover-client.h | 1 + 2 files changed, 19 insertions(+) (limited to 'ui/common') diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c index fea8c57..de210bd 100644 --- a/ui/common/discover-client.c +++ b/ui/common/discover-client.c @@ -126,6 +126,13 @@ static void update_sysinfo(struct discover_client *client, talloc_free(sysinfo); } +static void update_config(struct discover_client *client, + struct config *config) +{ + if (client->ops.update_config) + client->ops.update_config(config, client->ops.cb_arg); +} + static int discover_client_process(void *arg) { struct discover_client *client = arg; @@ -133,6 +140,7 @@ static int discover_client_process(void *arg) struct system_info *sysinfo; struct boot_status *status; struct boot_option *opt; + struct config *config; struct device *dev; char *dev_id; int rc; @@ -194,6 +202,16 @@ static int discover_client_process(void *arg) } update_sysinfo(client, sysinfo); break; + case PB_PROTOCOL_ACTION_CONFIG: + config = talloc_zero(ctx, struct config); + + rc = pb_protocol_deserialise_config(config, message); + if (rc) { + pb_log("%s: invalid config message?\n", __func__); + return 0; + } + update_config(client, config); + 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 feca63b..6aa0432 100644 --- a/ui/common/discover-client.h +++ b/ui/common/discover-client.h @@ -27,6 +27,7 @@ struct discover_client_ops { 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 (*update_config)(struct config *sysinfo, void *arg); void *cb_arg; }; -- cgit v1.2.1