Connect QEMU OS9.2.2 to Host Devices?

About QEMU, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Is there a way to connect the OS running within QEMU to external devices attached to the host machine via USB or Firewire?

I'm trying to create a "link" from QEMU to an external MIDI interface which is currently connected to the hosts Firewire socket, is this possible?
User avatar
adespoton
Forum All-Star
Posts: 3235
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by adespoton »

pmj wrote: Tue Jan 19, 2021 3:50 pm Is there a way to connect the OS running within QEMU to external devices attached to the host machine via USB or Firewire?

I'm trying to create a "link" from QEMU to an external MIDI interface which is currently connected to the hosts Firewire socket, is this possible?
Yes; you'll need to poll your USB for attached device names on the host system, and then add the desired devices to your QEMU launch line. I don't believe Firewire is supported. Detailed instructions are elsewhere in this QEMU forum for attaching USB devices.
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Thanks, I've done some searching here and am evidently using the wrong terms as I didn't turn much up.

I gather it's "-device usb-audio" and something related to the networking instructions here:

https://www.emaculation.com/doku.php/pp ... networking

But how to strap that together isn't clear I'm afraid, would be grateful for any noob pointers.
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Hi,

What you would be looking for is usb pass-through into your guest. -device usb-audio only presents an usb audio device to the guest, and that is not what you want.
Every usb device has a unique combination of vendor id and device id. You need to find those id values for your usb midi device.
Your host is macOS, so in that case go to the system profiler and find your device under the usb devices. It should tell you both values.

Next, boot qemu with an additional command line argument like this: (change the vendorid and productid to what you found).
-device usb-host,vendorid=0x06cd,productid=0x0110

This should, in theory, give the guest access to the device. However, usb passthrough only works when macOS does not have a driver loaded for your device.... and that can be an obstacle. Some devices need you to install a driver. Such a driver can be uninstalled and thus might give you a chance to load a driver in the guest. But some devices use drivers already available in macOS and access is then claimed by macOS. These are not easily disabled, or cannot be disabled without issues.

Good luck!

Best,
Cat_7
User avatar
adespoton
Forum All-Star
Posts: 3235
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by adespoton »

Cat_7 wrote: Tue Jan 19, 2021 8:05 pm Hi,

What you would be looking for is usb pass-through into your guest. -device usb-audio only presents an usb audio device to the guest, and that is not what you want.
Every usb device has a unique combination of vendor id and device id. You need to find those id values for your usb midi device.
Your host is macOS, so in that case go to the system profiler and find your device under the usb devices. It should tell you both values.

Next, boot qemu with an additional command line argument like this: (change the vendorid and productid to what you found).
-device usb-host,vendorid=0x06cd,productid=0x0110

This should, in theory, give the guest access to the device. However, usb passthrough only works when macOS does not have a driver loaded for your device.... and that can be an obstacle. Some devices need you to install a driver. Such a driver can be uninstalled and thus might give you a chance to load a driver in the guest. But some devices use drivers already available in macOS and access is then claimed by macOS. These are not easily disabled, or cannot be disabled without issues.

Good luck!

Best,
Cat_7
One possible solution might be to configure the MIDI interface on the host, and then pass the virtual MIDI device through to the guest instead of the raw USB. I haven't tried this however, so I don't know how well it would work.

What I do regularly is use the Audio MIDI Setup app to subscribe to network MIDI devices; you might be able to do this in the guest if you can figure out how to make the host system advertise the device and subscribe to it with the guest system.
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Thanks for stepping me through it Cat_7, much appreciated. Sadly, I only have a couple of MIDI boxes here that are not already hogged by the Host.

One is an old Tascam that has no drivers compatible with the Host but I know runs very well when used with a Mac OS9 machine. Sadly it's not showing up in QEMU with the drivers loaded. Seems invisible to both Host and Guest.

The other is a MIDISport 2x2 which does not have the drivers loaded on the Host but still seems to be conflicted:

libusb: warning [darwin_transfer_status] transfer error: device not responding (value = 0xe00002ed)

This is a shame as my principle use for QEMU was to run older MIDI packages that still have a use (Unisyn etc).
adespoton wrote: Tue Jan 19, 2021 9:19 pm What I do regularly is use the Audio MIDI Setup app to subscribe to network MIDI devices; you might be able to do this in the guest if you can figure out how to make the host system advertise the device and subscribe to it with the guest system


I'd have to read up on this, never done it. I'll report back if I get anywhere with it.
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Hi,

Have you tried running Qemu as root? Perhaps the pass-through requires root access?

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

I haven't, how would one do that? I searched the forum but again, I clearly don't know how to get good results from doing that...
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Hi,

Add sudo in front of ./qemu-system-ppc on your command line. macOS will then ask for your root password

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Thanks but no difference I'm afraid
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

You might want to try with the following Qemu build:
Build removed, see some posts below

No guarantee, but it seems our latest builds did not include usbhost support ....

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Thanks, this version does at least let you choose the soundcard in the Sound Preferences as the audio in / out option but doesn't actually pass anything to the interface.

Cheers anyway
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Hi,

Can you please explain what you see and what you mean by choosing a sound card? Which OS are you running as guest?
Does the device pass-through work?

This latest build does not support sound itself, I would have to compile that in separately.

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

So, Guest OS is 9.2.2 (MacOS9Lives ISO), Host is High Sierra 10.13.6

The USB Soundcard I'm trying to use is a Tascam US-122 which works very well under an actual Mac OS9.2.2 machine and has a pretty stable driver set and control panel. I'm trying this box in particular as the Host machine has no drivers for it, so it doesn't latch on leaving it free for the Guest.

This is my qemu.command with the Tascam's vendorid and productid

#!/bin/bash
cd "$(dirname "$0")"

sudo ./qemu-system-ppc -L pc-bios -boot c -M mac99,via=pmu -m 512 \
-prom-env 'auto-boot?=true' -prom-env 'boot-args=-v' -prom-env 'vga-ndrv?=true' \
-drive file=MacOS9.2.iso,format=raw,media=cdrom \
-drive file=MacOS9.2.img,format=raw,media=disk \
-device usb-host,vendorid=0x1604,productid=0x8007
-netdev user,id=network01 -device sungem,netdev=network01 \
-device VGA,edid=on \

What normally happens is just after bootup on an actual Mac OS9.2.2 machine the USB light comes on the interface indicating it's ready for use. This doesn't happen under QEMU.

When I go to the driver panel I get this:

Image

So, not available here... But when I go to the Sound Preferences I get this:

Image

Image

Which gives an indication that it is (perhaps) being presented to the Guest in some way? No sound or MIDI is passed to the box and the indicator lights remain off.

Hope that lets you see what I can see?
Last edited by pmj on Sat Jan 23, 2021 6:52 pm, edited 1 time in total.
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Cat_7 wrote: Wed Jan 20, 2021 5:46 pm This latest build does not support sound itself, I would have to compile that in separately.
I'd settle for the MIDI in and out part working to be honest, the sound is far less important
User avatar
Ronald P. Regensburg
Expert User
Posts: 6556
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Ronald P. Regensburg »

We cannot see your images. You cannot link to images like this. If you want to show an image, you need to upload the file to a publicly accessible place and link to the image file itself.
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Apologies, should be fixed now. Thanks.
User avatar
adespoton
Forum All-Star
Posts: 3235
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by adespoton »

I still can't see the images (network block for that image host I think), but I do have a question... does the device normally require a system extension under 9.2.2? If so, is that loading properly in QEMU?
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

adespoton wrote: Mon Jan 25, 2021 3:46 pm does the device normally require a system extension under 9.2.2? If so, is that loading properly in QEMU
It does and it appears in the QEMU extensions folder as normal.

These are the images from the original post, hopefully you can see them?

Control panel showing the interface as unavailable:

Image

Yet the Sound Preferences seem to be able to detect it, maybe...

Image
Image

Trying to check the "Play sound through output device" doesn't work, I can check it but it unchecks itself after a second or so.
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Hi,

It seems Qemu has an issue with this USB pass-through setup. Unfortunately I cannot fix it.
I did build a sound enabled Qemu for you to test.
Build removed, see some posts below.

Please note you should keep this qemu build separated from your earlier download as it also relies on changes in the pc-bios folder. However, the same command line should work.

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Thanks Cat_7, that's kind of you. Some errors I'm afraid...

Firstly when I try to run:

sudo ./allow_qemu_to_run.command

I get:

xattr: No such file: ./libusbredirhost.1.dylib
xattr: No such file: ./libusbredirparser.1.dylib

Then when I try to run qemu.command I get:

qemu-system-ppc-screamer: could not load PowerPC bios 'openbios-ppc'

I had to rename the "qemu-system-ppc" as "qemu-system-ppc-screamer" as the qemu.command was looking for the "-screamer" bit on the end.
shaketuna
Student Driver
Posts: 14
Joined: Tue Jan 26, 2021 10:11 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by shaketuna »

Dear Cat_7,

Greetings, and my sincere respects and thanks to you for your contributions!
Until a couple of days ago when I came across QEMU, I didn’t think I’d ever come so close to emulating my OS9 work environment on my MacBook Pro 16-inch running Catalina.

I am confronting a situation somewhat similar to that of pmj, where I can get the guest OS9.2.2 System Profiler and OMS to recognize and configure my Roland UM-880 USB MIDI interface (thanks to your recent USB-enabled build), but unable to get MIDI signals in or out of it.
Additionally, despite the fact that proper driver software for the interface is installed on the guest OS, the interface hardware does not recognize it. (no indication light)
I shall look forward to the possibility of this issue being resolved in a future version of QEMU.

Meanwhile, I’d like to point out a number of problems in your recent temporary builds (I think pmj will find this useful too):
- In “allow_qemu_to_run.command”, lines for the 2 new USB related Libs are missing “/Libs”.
- In “qemu.command”, the “./qemu-system-ppc” or “./qemu-system-ppc-screamer” identification doesn’t match the enclosed qemu-system-ppc / -screamer filename respectively.
- In the Qemu-5.2-OSX-Screamer-26-01-2021 package, many of the files in the pc-bios folder are aliases instead of actual files.

I think that resolving these issues should avoid many confusions.

Thanks again for your work, and I excitingly look forward to future improvements of QEMU.
Also I wish pmj luck for our common quest of getting our MIDI interfaces to work on it!
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

Firstly when I try to run:

sudo ./allow_qemu_to_run.command

I get:

xattr: No such file: ./libusbredirhost.1.dylib
xattr: No such file: ./libusbredirparser.1.dylib
Ah yes, this build is not tested at all, so it seems some older instructions were included. Did you get it going in the end?
Or should I try again.. ;-)

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 5239
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by Cat_7 »

This download should correct the errors....

https://surfdrive.surf.nl/files/index.p ... Z/download

Best,
Cat_7
pmj
Inquisitive Elf
Posts: 27
Joined: Tue Jan 19, 2021 10:07 am

Re: Connect QEMU OS9.2.2 to Host Devices?

Post by pmj »

Afraid not:

2021-01-26 12:24:25.505 qemu-system-ppc-screamer[2698:104156] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
2021-01-26 12:24:25.510 qemu-system-ppc-screamer[2698:104156] pid(2698)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
Post Reply