Skip to content

Commit

Permalink
FMO-92: fmo-tool, add ability to passthrough with vendorid
Browse files Browse the repository at this point in the history
- Allow passthrough device with exactly-matched vendorid and regex-matched productid
- Update fmo-tool version with vendorname in ddp, allow passthrough device with vendorname using fmo-tool option -vn
- Add default passthrough for device with vendorid "1050"

Signed-off-by: Anh Huy Bui <[email protected]>
  • Loading branch information
buianhhuy96 committed Dec 20, 2024
1 parent 3686159 commit 8b9ecac
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hardware/fmo-os-rugged-laptop-7330.nix
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@
vendorid = "1546";
productid = "01a9";
}
{
bus = "usb";
vendorid = "1050";
productid = ".*";
}
];
}; # services.fmo-dynamic-device-passthrough
fmo-dci = {
Expand Down
5 changes: 5 additions & 0 deletions hardware/fmo-os-rugged-tablet-7230.nix
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@
vendorid = "1546";
productid = "01a9";
}
{
bus = "usb";
vendorid = "1050";
productid = ".*";
}
];
}; # services.fmo-dynamic-device-passthrough
fmo-dci = {
Expand Down
2 changes: 1 addition & 1 deletion modules/custom-packages/fmo-tool/fmo-tool.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pkgs.python3Packages.buildPythonApplication {

src = builtins.fetchGit {
url = "[email protected]:tiiuae/fmo-tool.git";
rev = "4cdb772a104893ecf2d15333bad0f335040c3be9";
rev = "ed1ba0debd766a07efb14b59401d9ae8b2c5093e";
ref = "refs/heads/main";
};
}
13 changes: 13 additions & 0 deletions modules/custom-packages/vhotplug/vendorid.patch
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions modules/custom-packages/vhotplug/vhotplug.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ in

doCheck = false;

patches = [ ./vendorid.patch ];

src = fetchFromGitHub {
owner = "tiiuae";
repo = "vhotplug";
Expand Down

0 comments on commit 8b9ecac

Please sign in to comment.