I have created an OSX Mojave virtual machine and am attempting to pass an iPhone to it, so that I can use XCode. I have tested passing a keyboard through to the guest, and this works fine. However, the iPhone does not.
When I use virt-manager to add the USB Host Device, the iPhone makes a sound to indicate it has been connected, however, it does not appear to be connected to the guest.
Some things I have noticed that may help with resolving this:
If I add the USB Host Device, and then very quickly switch to the VM and run system_profiler SPUSBDataType
, the iPhone is shown as connected. This only lasts for a few seconds though. Running system_profiler SPUSBDataType
after a few seconds shows the iPhone is no longer connected.
I have tested passing the iPhone to a Linux guest. When passing it to a Linux guest, it does seem to stay connected.
People have reported success passing an iPhone to a VMWare virtual machine by adding usb.quirks.device0 = "0x05ac:0x12a8 skip-reset, skip-refresh, skip-setconfig"
to their VMWare VMX file, I mention this as I think replicating these settings in libvirt somehow may resolve the issue.
When I add the USB Host Device, I get this in dmesg on the host:
[178165.281031] audit: type=2501 audit(1540468134.413:1654): pid=604 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=cgroup reason=allow vm="macos-high-sierra" uuid=2aca0dd6-cec9-4717-9ab2-0b7b13d111c3 cgroup="/sys/fs/cgroup/devices/machine.slice/machine-qemu\x2d34\x2dmacos\x2dhigh\x2dsierra.scope/" class=path path="/dev/bus/usb/003/050" rdev=BD:131 acl=rw exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'
[178165.284135] audit: type=2501 audit(1540468134.417:1655): pid=604 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=dev reason=attach vm="macos-high-sierra" uuid=2aca0dd6-cec9-4717-9ab2-0b7b13d111c3 bus=usb device="003.050" exe="/usr/bin/libvirtd" hostname=? addr=? terminal=? res=success'
[178165.562355] usb 3-11: reset high-speed USB device number 50 using xhci_hcd
[178165.702290] usb 3-11: device firmware changed
[178165.702489] usb 3-11: USB disconnect, device number 50
[178165.825523] usb 3-11: new high-speed USB device number 51 using xhci_hcd
[178165.966944] usb 3-11: New USB device found, idVendor=05ac, idProduct=12a8, bcdDevice= 6.01
[178165.966946] usb 3-11: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[178165.966948] usb 3-11: Product: iPhone
[178165.966949] usb 3-11: Manufacturer: Apple Inc.
[178165.966950] usb 3-11: SerialNumber: 71e8245949fde7db02fa88199e22c939196f3ec1
It seems like the iPhone is reconnecting (maybe it's changing connection mode?) and that libvirt is then not passing it back to the guest?