blob: b6c2119435f0d2c37ab159b42edd75de53f3488f [file] [log] [blame]
Brad Bishop77390492016-04-13 10:47:19 -04001#include "interfaces/openbmc_intf.h"
2#include "openbmc.h"
3
4
5/* ------------------------------------------------------------------------- */
6
7gint
8main(gint argc, gchar *argv[])
9{
10 GMainLoop *loop;
11 GDBusConnection *c;
12 GDBusProxy *p;
13 GError *error;
14 GVariant *parm;
Brad Bishop77390492016-04-13 10:47:19 -040015
16 loop = g_main_loop_new(NULL, FALSE);
17
18 error = NULL;
19 c = g_bus_get_sync(DBUS_TYPE, NULL, &error);
20
21 error = NULL;
22 p = g_dbus_proxy_new_sync(c,
23 G_DBUS_PROXY_FLAGS_NONE,
24 NULL, /* GDBusInterfaceInfo* */
25 "org.openbmc.managers.Inventory", /* name */
26 "/org/openbmc/inventory/items/system/io_board", /* object path */
27 "org.openbmc.InventoryItem", /* interface name */
28 NULL, /* GCancellable */
29 &error);
30 g_assert_no_error(error);
31
32 //TODO: Read actual vpd
33 g_print("Reading VPD\n");
34 GVariantBuilder *b;
35 GVariant *dict;
36
37 b = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
38 g_variant_builder_add(b, "{sv}", "manufacturer", g_variant_new_string("ibm"));
39 g_variant_builder_add(b, "{sv}", "part_num", g_variant_new_string("3N0001"));
40 dict = g_variant_builder_end(b);
41
42 //proxy_call wants parm as an array
43 parm = g_variant_new("(v)",dict);
44
45 error = NULL;
Brad Bishop0c82c602016-04-13 13:36:49 -040046 g_dbus_proxy_call_sync(p,
Brad Bishop77390492016-04-13 10:47:19 -040047 "update",
48 parm,
49 G_DBUS_CALL_FLAGS_NONE,
50 -1,
51 NULL,
52 &error);
53 g_assert_no_error(error);
54
55 g_object_unref(p);
56 g_object_unref(c);
57 g_main_loop_unref(loop);
58 return 0;
59}