Brad Bishop | 7739049 | 2016-04-13 10:47:19 -0400 | [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; |
| 20 | c = g_bus_get_sync(DBUS_TYPE, NULL, &error); |
| 21 | |
| 22 | error = NULL; |
| 23 | p = g_dbus_proxy_new_sync(c, |
| 24 | G_DBUS_PROXY_FLAGS_NONE, |
| 25 | NULL, /* GDBusInterfaceInfo* */ |
| 26 | "org.openbmc.managers.Inventory", /* name */ |
| 27 | "/org/openbmc/inventory/items/system/io_board", /* object path */ |
| 28 | "org.openbmc.InventoryItem", /* interface name */ |
| 29 | NULL, /* GCancellable */ |
| 30 | &error); |
| 31 | g_assert_no_error(error); |
| 32 | |
| 33 | //TODO: Read actual vpd |
| 34 | g_print("Reading VPD\n"); |
| 35 | GVariantBuilder *b; |
| 36 | GVariant *dict; |
| 37 | |
| 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; |
| 47 | result = g_dbus_proxy_call_sync(p, |
| 48 | "update", |
| 49 | parm, |
| 50 | G_DBUS_CALL_FLAGS_NONE, |
| 51 | -1, |
| 52 | NULL, |
| 53 | &error); |
| 54 | g_assert_no_error(error); |
| 55 | |
| 56 | g_object_unref(p); |
| 57 | g_object_unref(c); |
| 58 | g_main_loop_unref(loop); |
| 59 | return 0; |
| 60 | } |