Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passthrough USB devices #139

Open
fkorotkov opened this issue Jun 27, 2022 · 11 comments
Open

Passthrough USB devices #139

fkorotkov opened this issue Jun 27, 2022 · 11 comments
Labels
enhancement New feature or request not possible atm Not possible at the moment

Comments

@fkorotkov
Copy link
Contributor

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

@fkorotkov fkorotkov added the enhancement New feature or request label Jun 27, 2022
@edigaryev
Copy link
Collaborator

Doesn't seem to be possible at this point, see docker/for-mac#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.

@edigaryev edigaryev added the not possible atm Not possible at the moment label Jul 1, 2022
@fkorotkov
Copy link
Contributor Author

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

@fkorotkov fkorotkov reopened this Jul 1, 2022
@edigaryev edigaryev removed their assignment Jul 4, 2022
@geerlingguy
Copy link

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
Copy link

sheerun commented Jan 22, 2023

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

@dinvlad
Copy link

dinvlad commented Jan 30, 2023

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
Copy link
Contributor Author

@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
Copy link

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
Copy link

@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
Copy link
Collaborator

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
Copy link

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

@jupe
Copy link

jupe commented Sep 14, 2024

would be super useful to have iphone passthrough to VM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request not possible atm Not possible at the moment
Projects
None yet
Development

No branches or pull requests

9 participants