First I would like to mention that I am a beginner. Also, sorry for any english mistakes.
I tried to pass my Android phone to a Windows 10 guest machine using QEMU/KVM in an Ubuntu 22 host machine, but the guest machine shows as if there is a Driver error. Here is what the Device Manager shows:
This seems to be something related to the MTP protocol used by Android phones, as my flash drives work normally when I pass them to the guest machine.
I also would like to note that I tried this with different phones, so the problem is not the phone.
I went to the QEMU documentation (https://qemu-project.gitlab.io/qemu/system/devices/usb.html), but I confess it is a little advanced for me. The only clue I had is copied below, but I didn't understand where should I change it in the XML file (IF this is changed there...). "usb-mtp,rootdir=dir Media transfer protocol device, using dir as root of the file tree that is presented to the guest."
I have configured my virtual machine using the Virtual Machine Manager, not the Terminal. Is there a way to edit the virtual machine XML to correctly connect my phone, even if the workaround can only be done through the terminal?
Thanks in advance.
I don't know if someone will ever have the same problem, but this is how It worked for me:
After booting the host machine (Ubuntu 22), boot your virtual machine (Windows 10)
Plug your android phone via usb to your PC
Go to your android phone, and a notification from USB Preferences will appear. There, the default values are: "USB controlled by" --> "This device" and "Use USB for" --> "No Data Transfer"
Change "Use USB for" to "File Transfer".
When the android phone icon appears at the ubuntu dock*, right-click it and press "Mount". *the dock is the bar that by default is on the left side of the screen, it is analogous to the windows taskbar
Now, right-click it again and press "Unmount"
Go to the Virtual Machine Manager, choose the Windows 10 virtual machine you are using and double-click it. Click the "i" icon ("Show virtual hardware details") and then "Add Hardware". Select "USB Host Device", and choose your android phone on the list. Then, click Finish.
Now you may go to your Windows 10 virtual machine and you will see your android phone when you open the File Explorer (under "This PC").
I normally remove it from the "Virtual Hardware details" after I transfer my files, so the Virtual Machine Manager won't ask for it whenever I try to start my virtual machine again.