I am trying to emulate an mtp device with virt-manager. I see at https://qemu-project.gitlab.io/qemu/system/devices/usb.html that usb-mtp,rootdir=dir as in -device usb-mtp,rootdir=dir could be used to do this with qemu. How can I configure virt-manager to do this (custom xml welcome)?
I wasn't able to find an xml equivalent of the command, but I was able to change the xml to run the command directly. I needed to insert
xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" in the beginning
<domain> element and kept the existing
type="kvm" and put
<qemu:commandline> <qemu:arg value="-device"/> <qemu:arg value="usb-mtp,rootdir=dir"/> </qemu:commandline>
as the last element before the closing
</domain>. https://blog.vmsplice.net/2011/04/how-to-pass-qemu-command-line-options.html and #virt irc on OFTC was helpful with this. Warning: if a change doesn't parse correctly when saving via the virt-manager xml editing pane then it may be removed so take necessary precautions before saving and to check after.