aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libqos/usb.c')
-rw-r--r--tests/libqos/usb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c
index 2a476049a8..49e2f4bc0a 100644
--- a/tests/libqos/usb.c
+++ b/tests/libqos/usb.c
@@ -37,13 +37,14 @@ void uhci_port_test(struct qhc *hc, int port, uint16_t expect)
g_assert((value & mask) == (expect & mask));
}
-void usb_test_hotplug(const char *hcd_id, const int port,
+void usb_test_hotplug(const char *hcd_id, const char *port,
void (*port_check)(void))
{
- char *id = g_strdup_printf("usbdev%d", port);
+ char *id = g_strdup_printf("usbdev%s", port);
+ char *bus = g_strdup_printf("%s.0", hcd_id);
- qtest_qmp_device_add("usb-tablet", id, "'port': '%d', 'bus': '%s.0'",
- port, hcd_id);
+ qtest_qmp_device_add("usb-tablet", id, "{'port': %s, 'bus': %s}",
+ port, bus);
if (port_check) {
port_check();
@@ -51,5 +52,6 @@ void usb_test_hotplug(const char *hcd_id, const int port,
qtest_qmp_device_del(id);
+ g_free(bus);
g_free(id);
}