问题
I'm trying to setup a Mac OS virtual machine to do iPad development. The host system is Ubuntu 18.04, and I'm using the stock qemu packages from the Ubuntu repo.
I've got a Mojave VM up and running using these instructions, and in the script to boot the VM, I've added this line:
-device usb-host,vendorid=0x05ac,productid=0x12ab \
The devices in question are an iPad Air 2, and an iPad Mini 4, which seem to share the same product ids, according to lsusb.
Here's the issue: when I boot into my Mojave VM, when I plug the iPad in, I see it appear in ioreg -p IOUSB
for a few seconds, then it disappears. Other devices (I tried a USB LTE modem and a USB RS232 interface) don't do this; it appears to be specific to iDevices.
On the host side, I see the device appear to connect and disconnect in a loop. Here's what I see in dmesg -w
:
[ 483.734771] usb 1-2.4.1: new high-speed USB device number 39 using xhci_hcd
[ 483.849408] usb 1-2.4.1: New USB device found, idVendor=05ac, idProduct=12ab
[ 483.849416] usb 1-2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 483.849420] usb 1-2.4.1: Product: iPad
[ 483.849425] usb 1-2.4.1: Manufacturer: Apple Inc.
[ 483.849435] usb 1-2.4.1: SerialNumber: <xxx>
[ 484.543671] usb 2-2.1.4.1.3.3: reset SuperSpeed USB device number 9 using xhci_hcd
[ 488.616849] usb 1-2.4.1: reset high-speed USB device number 39 using xhci_hcd
[ 488.732805] usb 1-2.4.1: device firmware changed
[ 488.733301] usb 1-2.4.1: USB disconnect, device number 39
[ 488.824694] usb 1-2.4.1: new high-speed USB device number 40 using xhci_hcd
[ 488.938611] usb 1-2.4.1: New USB device found, idVendor=05ac, idProduct=12ab
[ 488.938613] usb 1-2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 488.938614] usb 1-2.4.1: Product: iPad
[ 488.938615] usb 1-2.4.1: Manufacturer: Apple Inc.
[ 488.938616] usb 1-2.4.1: SerialNumber: <xxx>
[ 490.961709] usb 1-2.4.1: reset high-speed USB device number 40 using xhci_hcd
[ 491.076908] usb 1-2.4.1: usbfs: process 2557 (gvfs-gphoto2-vo) did not claim interface 0 before use
[ 494.579362] usb 2-2.1.4.1.3.3: reset SuperSpeed USB device number 9 using xhci_hcd
[ 531.110536] usb 1-2.4.1: USB disconnect, device number 40
[ 533.905116] usb 1-2.4.1: new high-speed USB device number 41 using xhci_hcd
[ 534.019231] usb 1-2.4.1: New USB device found, idVendor=05ac, idProduct=12ab
[ 534.019237] usb 1-2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 534.019241] usb 1-2.4.1: Product: iPad
[ 534.019244] usb 1-2.4.1: Manufacturer: Apple Inc.
[ 534.019247] usb 1-2.4.1: SerialNumber: <xxx>
[ 534.602098] usb 1-2.1.4.4: USB disconnect, device number 17
Note that the above is not me physically connecting and diconnecting -- something is doing it on its own. Also of note, I don't get this connect / disconnect loop if my VM isn't running (or if I remove the line setting up the USB passthrough)
Things I've tried
I've been operating on the assumption that this is something that the host (probably udevd) is doing which is preventing qemu (well, libusb, I presume) from being able to keep hold of the device. To that end I've been going through and disabling any udev rules that look like they might be implicated. Specifically, I've created symlinks to /dev/null
for the following udev files:
- /etc/udev/rules.d/39-usbmuxd.rules
- /etc/udev/rules.d/60-libgphoto2-6.rules
- /etc/udev/rules.d/90-libgpod.rules
I also tried disabling the gphoto2 service, like so:
systemctl --user stop gvfs-gphoto2-volume-monitor.service
Despite all of these things, the behavior is essentially the same. Also noteworthy: even after disabling all these things, the kernel is still somehow detecting the iPad when I connect it, and logs its serial number, etc to syslog, and I've reached the limit of my knowledge on how to disable things on Linux!
How can I get my iPad to appear (and stay) in my qemu virtual machine?
来源:https://stackoverflow.com/questions/52617634/how-do-i-get-qemu-usb-passthrough-to-work-for-ipad-iphone