Skip to content

Instantly share code, notes, and snippets.

@edwinclement08
Created April 22, 2021 09:52
Show Gist options
  • Save edwinclement08/39cabc2478a0cd092b4eb91a16fd282d to your computer and use it in GitHub Desktop.
Save edwinclement08/39cabc2478a0cd092b4eb91a16fd282d to your computer and use it in GitHub Desktop.
Get list of usb ids that are connected to a domain using virsh and xq(installed with yq)
virsh dumpxml Manjaro | xq '.domain.devices.hostdev | .[] | select( ."@type" == "usb") | .source | (.vendor."@id" + ":" + .product."@id") '
@edwinclement08
Copy link
Author

ssh eve "virsh dumpxml Manjaro | xq '.domain.devices.hostdev | .[] | select( .\"@type\" == \"usb\")  | .source | (.vendor.\"@id\" + \":\" + .product.\"@id\")'"

For getting the list via ssh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment