uinput: configurable device identity with fallback to built-in defaults

Add vmctl_uinput_id and an optional vmctl_config.uinput_id pointer. NULL keeps the built-in identity verbatim; a non-NULL config supplies all numeric fields literally, with the device name suffixed -A/-B for the dual-device mode.
This commit is contained in:
2026-06-17 14:42:25 +03:00
parent bb757b64cf
commit 329b12bf07
2 changed files with 41 additions and 7 deletions
+9
View File
@@ -19,11 +19,20 @@ typedef enum {
#define VMCTL_PTR_REL 2 /* uinput: relative mouse */
#define VMCTL_PTR_BOTH 3 /* uinput: two devices A=abs B=rel */
typedef struct {
unsigned bustype; /* HID bus type, e.g. 0x0003 (USB) */
unsigned vendor; /* vendor id */
unsigned product; /* product id */
unsigned version; /* device version */
const char* name; /* device name; library copies it */
} vmctl_uinput_id;
typedef struct {
vmctl_driver driver;
const char* qmp_path; /* QMP unix socket; required for QMP, optional (passthrough) for UINPUT */
const char* input_bus; /* virtio-input-host-pci bus "pci.0" for passthrough; "" = none */
int ptr_mode; /* UINPUT VMCTL_PTR_*; 0 for QMP */
const vmctl_uinput_id* uinput_id; /* UINPUT only; NULL = built-in defaults */
} vmctl_config;
vmctl_t* vmctl_open (const vmctl_config* cfg); /* NULL on error */