@@ -16,34 +16,32 @@
static void usb_hcd_hotplug(const char *hcd, const char *id)
{
QDict *response;
+ char *bus;
qtest_start("");
/* hotplug an usb host adapter */
- response = qmp("{\"execute\": \"device_add\","
- " \"arguments\": {"
- " \"driver\": \"%s\","
- " \"id\": \"%s\""
- "}}", hcd, id);
+ response = qmp("{ 'execute': 'device_add',"
+ " 'arguments': { 'driver': %s,"
+ " 'id': %s } }", hcd, id);
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
QDECREF(response);
/* hotplug an usb-tablet to the usb host adapter, bus=$id.0 */
- response = qmp("{\"execute\": \"device_add\","
- " \"arguments\": {"
- " \"driver\": \"usb-tablet\","
- " \"bus\": \"%s.0\""
- "}}", id);
+ bus = g_strdup_printf("%s.0", id);
+ response = qmp("{ 'execute': 'device_add',"
+ " 'arguments': { 'driver': 'usb-tablet',"
+ " 'bus': %s } }", bus);
+ g_free(bus);
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
QDECREF(response);
/* delete the usb host adapter */
- response = qmp("{\"execute\": \"device_del\","
- " \"arguments\": {"
- " \"id\": \"%s\""
- "}}", id);
+ response = qmp("{ 'execute': 'device_del',"
+ " 'arguments': {"
+ " 'id': %s } }", id);
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
QDECREF(response);