Cannot reconnect USB devices instantly after disconnection
Operating system
Ubuntu 24.04
Description
The USB passthrough works as it should but when I am trying to disconnect and connect the same device to the same usb port even though it has the same vendor and product ID, the device is no longer getting recognized by the macOS in the container.
I couldn't find where the code for the usb connections is and how the usb is forwarded to the container but since the underlying system is Linux and the virtualization is through qemu, I believe it is using a pci-e passthrough.
How can I make sure that even though the device will be reconnected, it will be detected by the macOS it is detected the first time?
I will be happy to provide any more debugging information or am happy to help with this artefact myself given I have some technical knowledge in this domain and am a computer engineer. However I need to know about the internals first.
Docker compose
services: macos: image: dockurr/macos container_name: macos environment: VERSION: "12" RAM_SIZE: "3G" ARGUMENTS: "-device usb-host,vendorid=0x05ac,productid=0x1227" devices: - /dev/kvm - /dev/net/tun - /dev/bus/usb cap_add: - NET_ADMIN ports: - 8006:8006 - 5900:5900/tcp - 5900:5900/udp volumes: - ./macos:/storage restart: always stop_grace_period: 2m
Docker log
❯ Starting macOS for Docker v2.10... ❯ For support visit https://github.com/dockur/macos ❯ CPU: Intel Core i3 3217U | RAM: 4/6 GB | DISK: 17 GB (ext4) | KERNEL: 6.11.0-19...
❯ Building boot image... ❯ ❯ Model: iMacPro1,1 ❯ Rom: 0016cb44aacd ❯ Serial: C02YD0JSHX87 ❯ Board: C029101044NJG36A8 ❯ ❯ Booting macOS using QEMU v9.2.2... BdsDxe: failed to load Boot0080 "Mac OS X" from PciRoot(0x0)/Pci(0xA,0x0)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,D9B5FE3F4FD906418026493ADF1B69A8)/\ADCCB9CE-1820-4920-A56F-12E26213D00D\System\Library\CoreServices\boot.efi: Not Found BdsDxe: failed to load Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0xA,0x0): Not Found BdsDxe: loading Boot0002 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x5,0x0) BdsDxe: starting Boot0002 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x5,0x0) #[EB|LOG:EXITBS:END] _ #[EB.BST.FBS|-] #[EB|B:BOOT] #[EB|LOG:HANDOFF TO XNU] _ ======== End of efiboot serial output. ======== qemu-system-x86_64: libusb_release_interface: -4 [NO_DEVICE]
Screenshots (optional)
No response
See https://github.com/qemus/qemu/issues/694
I tried this but this won't have the same effect as originally passing the usb.
This is the result of running docker compose exec macos bash -c 'echo "device_add usb-host,vendorid=0x05a c,productid=0x1227" | nc -U -q0 /var/run/qemu-monitor-socket'
However I want it to be the same state as the original which is:
As you can see, after the reconnection Apple Mobile device DFU mode doesn't show up anymore.