Description: Use integers instead of strings for some QMP values
 This is necessary so usbdev-attach and usbctrl-attach works at all.
 Apparently, Xen and QMP are not in sync and Xen insists on sending some
 numerical values quoted as strings.

Author: David Martínez Moreno <ender@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: other
Bug-Debian: https://bugs.debian.org/<bugnumber>
Forwarded: no
Last-Update: 2025-11-05

Index: xen-4.20.0+68-g35cb38b222/tools/libs/light/libxl_usb.c
===================================================================
--- xen-4.20.0+68-g35cb38b222.orig/tools/libs/light/libxl_usb.c
+++ xen-4.20.0+68-g35cb38b222/tools/libs/light/libxl_usb.c
@@ -365,12 +365,9 @@ static int libxl__device_usbctrl_add_hvm
                                     "driver", "usb-ehci");
         break;
     case 3:
-        libxl__qmp_param_add_string(gc, &qmp_args,
-                                    "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_string(gc, &qmp_args, "driver", "nec-usb-xhci");
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2", usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3", usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +408,10 @@ static int libxl__device_usbdev_add_hvm(
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+        usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+        usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
