Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 1 | #include "interfaces/openbmc_intf.h"
|
| 2 | #include "openbmc.h"
|
| 3 |
|
| 4 |
|
| 5 | /* ---------------------------------------------------------------------------------------------------- */
|
| 6 |
|
| 7 | gint
|
| 8 | main (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;
|
Norman James | 5e792e3 | 2015-10-07 17:36:17 -0500 | [diff] [blame] | 20 | c = g_bus_get_sync (DBUS_TYPE, NULL, &error);
|
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21 |
|
| 22 | error = NULL;
|
| 23 | p = g_dbus_proxy_new_sync (c,
|
| 24 | G_DBUS_PROXY_FLAGS_NONE,
|
| 25 | NULL, /* GDBusInterfaceInfo* */
|
Norman James | 1a93d08 | 2015-10-06 11:24:34 -0500 | [diff] [blame] | 26 | "org.openbmc.managers.Inventory", /* name */
|
| 27 | "/org/openbmc/inventory/items/system/io_board", /* object path */
|
| 28 | "org.openbmc.InventoryItem", /* interface name */
|
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29 | NULL, /* GCancellable */
|
| 30 | &error);
|
| 31 | g_assert_no_error (error);
|
Norman James | 6f8d042 | 2015-09-14 18:48:00 -0500 | [diff] [blame] | 32 |
|
| 33 | //TODO: Read actual vpd
|
| 34 | g_print("Reading VPD\n");
|
Norman James | 1a93d08 | 2015-10-06 11:24:34 -0500 | [diff] [blame] | 35 | GVariantBuilder *b;
|
| 36 | GVariant *dict;
|
Norman James | 6f8d042 | 2015-09-14 18:48:00 -0500 | [diff] [blame] | 37 |
|
Norman James | 1a93d08 | 2015-10-06 11:24:34 -0500 | [diff] [blame] | 38 | 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 James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 47 | result = g_dbus_proxy_call_sync (p,
|
Norman James | 1a93d08 | 2015-10-06 11:24:34 -0500 | [diff] [blame] | 48 | "update",
|
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 49 | parm,
|
| 50 | G_DBUS_CALL_FLAGS_NONE,
|
| 51 | -1,
|
| 52 | NULL,
|
| 53 | &error);
|
| 54 | g_assert_no_error (error);
|
Norman James | 6f8d042 | 2015-09-14 18:48:00 -0500 | [diff] [blame] | 55 |
|
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 56 | g_object_unref(p);
|
| 57 | g_object_unref(c);
|
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 58 | g_main_loop_unref (loop);
|
| 59 | return 0;
|
| 60 | }
|