qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mac OS real USB device support issue


From: Programmingkid
Subject: Re: Mac OS real USB device support issue
Date: Tue, 6 Apr 2021 15:28:59 -0400


> On Apr 6, 2021, at 12:53 PM, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> 
> On Tue, 6 Apr 2021, Programmingkid wrote:
>>> On Apr 6, 2021, at 10:01 AM, Howard Spoelstra <hsp.cat7@gmail.com> wrote:
>>> On Tue, Apr 6, 2021 at 3:44 PM Programmingkid <programmingkidx@gmail.com> 
>>> wrote:
>>>> 
>>>> Hi Gerd,
>>>> 
>>>> I was wondering if you had access to a Mac OS 10 or Mac OS 11 machine to 
>>>> test USB support. I am on Mac OS 11.1 and cannot make USB devices work 
>>>> with any of my guests. So far these are the guests I have tested with:
>>>> 
>>>> - Windows 7
>>>> - Mac OS 9.2
>>>> - Windows 2000
>>>> 
>>>> I have tried using USB flash drives, USB sound cards, and an USB headset. 
>>>> They all show up under 'info usb', but cannot be used in the guest. My 
>>>> setup does use a USB-C hub so I'm not sure if this is a bug with QEMU or 
>>>> an issue with the hub. Would you have any information on this issue?
>>> 
>>> Hi John,
>>> 
>>> As far as the Mac OS 9.2 guest is concerned on a mac OS host, it does
>>> not support USB 2.0. I was successful only in passing through a USB
>>> flash drive that was forced into USB 1.1 mode by connecting it to a
>>> real USB 1.1 hub and unloading the kext it used.
>>> 
>>> Best,
>>> Howard
>> 
>> Hi Howard, I was actually thinking about CC'ing you for this email. Glad you 
>> found it. Unloading kext files does not sound pleasant. Maybe there is some 
>> better way of doing it.
> 
> In any case, until you make sure nothing tries to drive the device on the 
> host, passing it to a guest likely will fail because then two drivers from 
> two OSes would try to access it simultaneously which likely creates a mess as 
> the device and drivers don't expect this. So you can't just pass a device 
> through that the host has recognised and is driving without somehow getting 
> the host to leave it alone first before you can pass it through. Unloading 
> the driver is one way to do that (although it probably breaks all other 
> similar devices too). Maybe there's another way to unbind a device from the 
> host such as ejecting it first but then I'm not sure if the low level USB 
> needed for accessing the device still works after that or it's completely 
> forgotten. There's probably a doc somewhere that describes how it works and 
> how can you plug a device without also getting higher level drivers to load 
> or if there's no official ways for that then you'll need to do some 
> configuration on the host to avoid it grabbing devices that you want to pass 
> through. On Linux you can add an udev rule to ignore the device (maybe also 
> adding TAG+="uaccess" to allow console users to use it without needing root 
> access) but not sure how USB works on macOS.
> 
> Regards,
> BALATON Zoltan

Being able to dissociate a real USB device from its Mac OS driver would be very 
useful in this situation. IOKit might be one place to look for such a feature. 
The Mach kernel documentation is another place that might have what we want.

I have one theory. What if we introduce a middleman. A pseudo-USB device that 
the guest operating system could apply its configuration data to and will also 
talk directly with to the real USB device. 
So this:

USB device <-> Host <-> QEMU USB middleman <-> Guest

This could make USB 2.0 and 3.0 flash drives compatible with an older operating 
system like Mac OS 9. The USB middleman could fully accept Mac OS 9's 
configuration and make it think it is talking to a USB 1.1 device. Parameters 
like data packet payload size would no longer be a problem. Host driver 
unloading would no longer be needed (in theory). 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]