cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.9k stars 116 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 2 years 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 1 year 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 5 months 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

ink-splatters commented 3 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.

Do I understand right that it's not possible (yet?) to use block device for storing macOS VM data?

edigaryev commented 3 months ago

Do I understand right that it's not possible (yet?) to use block device for storing macOS VM data?

By "storing macOS VM data" you mean the root filesystem (which is currently stored in TART_HOME as a disk image), or just any other auxiliary data (which is possible using --disk)?

danielmahon commented 2 months ago

I assume even though block devices are supported, passing through a connected iPhone for debugging isn't supported yet?

jupe commented 2 months ago

would be super useful to have iphone passthrough to VM