如何让Qemu USB Passthrough在iPad/iPhone上运行? [英] How do I get Qemu USB Passthrough to work for iPad / iPhone?

查看:207
本文介绍了如何让Qemu USB Passthrough在iPad/iPhone上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置Mac OS虚拟机来进行iPad开发.主机系统是Ubuntu 18.04,我正在使用Ubuntu回购中的库存qemu软件包.

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.

我已经使用这些说明启动了Mojave VM,并在其中运行了启动虚拟机的脚本,我添加了这一行:

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 \

据lsusb称,所涉及的设备是iPad Air 2和iPad Mini 4,它们似乎共享相同的产品ID.

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.

这是问题所在:当我启动Mojave VM时,当我插入iPad时,我看到它出现在ioreg -p IOUSB中几秒钟,然后消失了.其他设备(我尝试过USB LTE调制解调器和USB RS232接口)则无法执行此操作;它似乎特定于iDevices.

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.

在主机端,我看到该设备似乎以环路连接和断开连接.这是我在dmesg -w中看到的内容:

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

请注意,以上内容并不是我实际进行的连接和断开连接-某些事情是自己完成的.还要注意的是,如果我的VM未运行(或者如果我删除了设置USB直通的线路),则不会出现此连接/断开循环.

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)

我尝试过的事情

我一直在假设主机(可能是udevd)正在执行此操作,这会阻止qemu(好吧,libusb,我想)能够控制设备.为此,我一直在研究并禁用所有可能涉及的udev规则.具体来说,我为以下udev文件创建了指向/dev/null的符号链接:

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

我还尝试禁用gphoto2服务,如下所示:

I also tried disabling the gphoto2 service, like so:

systemctl --user stop gvfs-gphoto2-volume-monitor.service

尽管所有这些事情,其行为本质上都是相同的.还值得注意的是:即使禁用了所有这些功能,当我连接iPad时,内核仍会以某种方式检测到iPad,并将其序列号等记录到syslog中,并且我已经达到了如何在Linux上禁用硬件的知识极限. !

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!

如何让我的iPad出现(并留在我的qemu虚拟机中?)

How can I get my iPad to appear (and stay) in my qemu virtual machine?

推荐答案

您需要在/dev/bus/usb/[bus]/[device]中添加与总线和设备相对应的文件,也许还添加id=iphone,但主要是更改所有权.

You need to chown the file corresponding to the bus and device in /dev/bus/usb/[bus]/[device] and maybe also add id=iphone but the main thing is to change the ownership.

这篇关于如何让Qemu USB Passthrough在iPad/iPhone上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆