From d98cfa2d23a0de75c0d9755a8b1084b91de0244c Mon Sep 17 00:00:00 2001 From: buianhhuy96 Date: Tue, 17 Dec 2024 11:10:37 +0200 Subject: [PATCH] FMO-92: fmo-tool, add ability to passthrough with vendorid and regex-productid Signed-off-by: Anh Huy Bui --- modules/custom-packages/vhotplug/vendorid.patch | 13 +++++++++++++ modules/custom-packages/vhotplug/vhotplug.nix | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 modules/custom-packages/vhotplug/vendorid.patch diff --git a/modules/custom-packages/vhotplug/vendorid.patch b/modules/custom-packages/vhotplug/vendorid.patch new file mode 100644 index 0000000..fb24a03 --- /dev/null +++ b/modules/custom-packages/vhotplug/vendorid.patch @@ -0,0 +1,13 @@ +diff --git a/vhotplug/config.py b/vhotplug/config.py +index 689d243..c1e7300 100644 +--- a/vhotplug/config.py ++++ b/vhotplug/config.py +@@ -32,7 +32,7 @@ class Config: + logger.debug(f"Rule {usb_description}") + logger.debug(f"Checking {vid}:{pid} against {usb_vid}:{usb_pid}") + vidMatch = usb_vid and vid.casefold() == usb_vid.casefold() +- pidMatch = usb_pid and pid.casefold() == usb_pid.casefold() ++ pidMatch = (usb_pid and pid.casefold() == usb_pid.casefold()) or re.match(usb_pid, pid, re.IGNORECASE) + if vidMatch and pidMatch: + logger.info(f"Found VM {vm_name} by vendor id / product id, description: {usb_description}") + matches = True diff --git a/modules/custom-packages/vhotplug/vhotplug.nix b/modules/custom-packages/vhotplug/vhotplug.nix index ac34c1f..985dfd4 100644 --- a/modules/custom-packages/vhotplug/vhotplug.nix +++ b/modules/custom-packages/vhotplug/vhotplug.nix @@ -19,6 +19,8 @@ in doCheck = false; + patches = [ ./vendorid.patch ]; + src = fetchFromGitHub { owner = "tiiuae"; repo = "vhotplug";