cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.68k stars 102 forks source link

Passthrough USB devices #139

Open fkorotkov opened 2 years ago

fkorotkov commented 2 years ago

We need to investigate how to passthough an iPhone connected to the host. This will be useful for running on device integration tests.

edigaryev commented 2 years ago

Doesn't seem to be possible at this point, see https://github.com/docker/for-mac/issues/5263.

Doing something similar to VirtualHere is an option, though, but most involves (1) delving into, most likely, IOUSBHost and IOKit frameworks and (2) installing the agent on each running VM that will forward the USB data packets to and from the host.

Thinking of adb, there's an idb alternative for iOS which can serve emulators and devices over the gRPC, but I'm not sure if Tart can directly help with doing that besides starting a VM and helping to get it's IP address.

fkorotkov commented 2 years ago

Let's keep the issue open for visibility. not possible atm label should do fine.

geerlingguy commented 1 year ago

This can also be useful for things like passing through block devices directly, or in my case passing an optical drive straight through to a VM for isolation/testing purposes.

sheerun commented 1 year ago

What about employing https://gitlab.freedesktop.org/spice/usbredir ?

dinvlad commented 1 year ago

It’d be preferable to use something like usb-ip (but for Mac, as mentioned above) because (unlike USB redirection/pass-through solutions) it would allow sharing one device with multiple guests, from what I understand.

fkorotkov commented 8 months ago

@geerlingguy it is now possible to pass block devices to that VMs via --disk flag. You need to run run tart under sudo though:

sudo TART_HOME="$HOME/.tart" tart run sonoma-xcode --disk=/dev/disk4s1

In the example above /dev/disk4s1 is a USB drive that I have on my machine.

cbreedbfly commented 1 month ago

Looks like USB Support was added to the Virtualization Framework as beta at WWDC last week. https://developer.apple.com/documentation/virtualization/usb_devices?language=objc