blob: f7a87d6fc91f97569cefe14ecb0236444060f584 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001#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;
15 GVariant *result;
16
17 loop = g_main_loop_new (NULL, FALSE);
18
19 error = NULL;
20 c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
21
22 error = NULL;
23 p = g_dbus_proxy_new_sync (c,
24 G_DBUS_PROXY_FLAGS_NONE,
25 NULL, /* GDBusInterfaceInfo* */
Norman James1a93d082015-10-06 11:24:34 -050026 "org.openbmc.managers.Inventory", /* name */
27 "/org/openbmc/inventory/items/system/io_board", /* object path */
28 "org.openbmc.InventoryItem", /* interface name */
Norman James362a80f2015-09-14 14:04:39 -050029 NULL, /* GCancellable */
30 &error);
31 g_assert_no_error (error);
Norman James6f8d0422015-09-14 18:48:00 -050032
33 //TODO: Read actual vpd
34 g_print("Reading VPD\n");
Norman James1a93d082015-10-06 11:24:34 -050035 GVariantBuilder *b;
36 GVariant *dict;
Norman James6f8d0422015-09-14 18:48:00 -050037
Norman James1a93d082015-10-06 11:24:34 -050038 b = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
39 g_variant_builder_add (b, "{sv}", "manufacturer", g_variant_new_string ("ibm"));
40 g_variant_builder_add (b, "{sv}", "part_num", g_variant_new_string("3N0001"));
41 dict = g_variant_builder_end (b);
42
43 //proxy_call wants parm as an array
44 parm = g_variant_new("(v)",dict);
45
46 error = NULL;
Norman James362a80f2015-09-14 14:04:39 -050047 result = g_dbus_proxy_call_sync (p,
Norman James1a93d082015-10-06 11:24:34 -050048 "update",
Norman James362a80f2015-09-14 14:04:39 -050049 parm,
50 G_DBUS_CALL_FLAGS_NONE,
51 -1,
52 NULL,
53 &error);
54 g_assert_no_error (error);
Norman James6f8d0422015-09-14 18:48:00 -050055
Norman James32e74e22015-09-15 21:28:06 -050056 g_object_unref(p);
57 g_object_unref(c);
Norman James362a80f2015-09-14 14:04:39 -050058 g_main_loop_unref (loop);
59 return 0;
60}