Replies: 8 comments 4 replies
-
I believe this is not possible, unless something has changed with USB support for qemu on macOS during the last couple of months. |
Beta Was this translation helpful? Give feedback.
-
I just realized that I have no idea if this would be possible when using the Virtualization.Framework on Ventura, but I suspect it would require additional support in Lima, even if it would be theoretically possible. |
Beta Was this translation helpful? Give feedback.
-
@jandubois Thank you for answering. Could you clarify what was wrong with USB support for qemu driver? Someone reported in this StackOverflow answer its possible, but sudo is needed: https://stackoverflow.com/questions/65816169/how-to-use-usb-with-qemu-on-a-mac-host As for Virtualization.Framework, maybe using https://gitlab.freedesktop.org/spice/usbredir or porting it to go-lang would be OK workaround? AFAIK there is no official documentation how to do it in Virtualization.Framework? This could also work for QEMU I guess In principle it should be possible as shown by https://www.virtualhere.com/osx_server_software maybe reverse engineering is an option, but possibly it's not stable API. Or maybe they are using QEMU underneath who knows |
Beta Was this translation helpful? Give feedback.
-
I've just learned there is something like QEMU TCI: "QEMU TCI (Target-Core-Infrastructure) is a set of Linux kernel modules and userspace libraries that allows QEMU to access storage devices using SCSI commands via the Linux kernel's TCM (Target Core Modules) subsystem. It allows QEMU to act as a SCSI target and provide storage to other systems via SCSI commands. TCI is a way to expose storage devices to QEMU in a more efficient way than using a file-based image or a block device. This allows QEMU to access storage devices directly, bypassing the file system layer and improving performance. TCI also provides advanced features such as thin provisioning and snapshots, and it's intended for use cases like storage virtualization, cloud and data center storage, and backup and disaster recovery." https://github.com/utmapp/UTM is using it to implement USB Sharing (please search for WITH_QEMU_TCI in https://github.com/utmapp/UTM). From what I can read it should be something like let maxDevices = input.maximumUsbShare
let buses = (maxDevices + 2) / 3
if input.usbBusSupport == .usb3_0 {
var controller = "qemu-xhci"
if system.target.rawValue.hasPrefix("pc") || system.target.rawValue.hasPrefix("q35") {
controller = "nec-usb-xhci"
}
for i in 0..<buses {
f("-device")
f("\(controller),id=usb-controller-\(i)")
}
} else {
for i in 0..<buses {
f("-device")
f("ich9-usb-ehci1,id=usb-controller-\(i)")
f("-device")
f("ich9-usb-uhci1,masterbus=usb-controller-\(i).0,firstport=0,multifunction=on")
f("-device")
f("ich9-usb-uhci2,masterbus=usb-controller-\(i).0,firstport=2,multifunction=on")
f("-device")
f("ich9-usb-uhci3,masterbus=usb-controller-\(i).0,firstport=4,multifunction=on")
}
}
// set up usb forwarding
for i in 0..<maxDevices {
f("-chardev")
f("spicevmc,name=usbredir,id=usbredirchardev\(i)")
f("-device")
f("usb-redir,chardev=usbredirchardev\(i),id=usbredirdev\(i),bus=usb-controller-\(i/3).0")
} "The nec-usb-xhci device in QEMU is a virtual USB 3.0 host controller that emulates the NEC uPD720201/uPD720202 USB 3.0 host controllers. It is used to provide USB 3.0 support to virtual machines running on QEMU." Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Right, I haven't tried it |
Beta Was this translation helpful? Give feedback.
-
I've sent POC that needs further work: #1317 |
Beta Was this translation helpful? Give feedback.
-
I assume the OP is just talking about exposing Run mounts:
- location: "/Voumes/USBDISKNAME`
writable: true https://github.com/lima-vm/lima/blob/v0.14.2/examples/default.yaml#L51 |
Beta Was this translation helpful? Give feedback.
-
Maybe you can run https://www.qemu.org/docs/master/tools/qemu-nbd.html |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to flash USB from lima on MacOS, is it possible? Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions