USB With QUEMU

About Qemu-system-ppc, 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

Citroenaap
Student Driver
Posts: 13
Joined: Sun Jul 16, 2017 8:57 am

USB With QUEMU

Post by Citroenaap »

Dear all,

I want USB support in my OS 9.2 where i got Archicad 6.5 on installed. This USB is a dongle with the license on it for archicad. i have found this command line on the forum:

-device usb-mouse -device usb-host,vendorid=0x04b9,productid=0x0300

Does this work for my situation, how can i find the vendorid and productid?

hope someone can help me out.

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

Re: USB With QUEMU

Post by adespoton »

What is your host OS? Under OS X, you can open the System Information app, click on USB, and select the device when it's plugged in, and those details will be provided. Under Windows, you need to go to the device management plugin, I believe. Under Linux, I think it's in /dev/usb/
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

You can use the device manager in Windows and roughly follow the steps described here:

https://support.shippingeasy.com/hc/en- ... tegration-

(click to open the windows 7 guidelines)

Best,
cat_7
Citroenaap
Student Driver
Posts: 13
Joined: Sun Jul 16, 2017 8:57 am

Re: USB With QUEMU

Post by Citroenaap »

i am emulating OS9.2 host os is windows 10
Citroenaap
Student Driver
Posts: 13
Joined: Sun Jul 16, 2017 8:57 am

Re: USB With QUEMU

Post by Citroenaap »

(1) You told QEMU to execute a kernel for the wrong machine type, and it crashed on startup (eg trying to run a raspberry pi kernel on a versatilepb QEMU machine)
(2) You didn't give QEMU a kernel or BIOS filename at all, and QEMU executed a ROM full of no-op instructions until it fell off the end
(3) Your guest kernel has a bug and crashed by jumping off into nowhere

This is almost always one of the first two, so check your command line and that you are using the right type of kernel for this machine.
If you think option (3) is likely then you can try debugging your guest with the -d debug options; in particular -d guest_errors will cause the log to include a dump of the guest register state at this point.

Execution cannot continue; stopping here.


tryed using the id's and archicad created a different error then usual, so i think it worked. But i gues that this dongle can't be installed on this version of os9.2. resulting in the error above?
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

I know that, and I gave you a link to a generic method of finding the vendor/dev id's of a usb device in windows. Windows 10 doesn't differ much from Windows 7 in finding the information:
insert your usb stick, find it in the device manager (apparaatbeheer if you windows version is in Dutch, as I assume), and follow the appropriate steps in that guide.

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

Re: USB With QUEMU

Post by Cat_7 »

You cannot use just some values for vendor/device. You need to find the correct data to pass through to Qemu and Mac OS 9.2
Citroenaap
Student Driver
Posts: 13
Joined: Sun Jul 16, 2017 8:57 am

Re: USB With QUEMU

Post by Citroenaap »

i think i found the VID and PID of the usb. underneath is the code i used.

-device usb-host,vendorid=0x064F,productid=0x0BD7

Now it doesn't crash and archicad still says it can't find the hardware key.

Is it possible to acces the USB in OS 9.2 like i did in windows 10 trough a mac version of device manager?
i have my windows 10 on english.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

Does the usb device show up in the system profiler in Mac OS 9.2?

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

Re: USB With QUEMU

Post by Cat_7 »

I tried usb passthough with a simple 2Gb USB stick and couldn´t get it to work in Windows. The documentation says it only works on Linux as host. I tried that, but also failed. If passthrough doesn´t work, you're out of luck with both SheepShaver and Qemu.

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

Re: USB With QUEMU

Post by adespoton »

Hmm... I wonder how passthrough works in the VirtualBox code; it could be there's something there that could be forward-ported to modern qemu. If they're doing it all on the virtualization side though, it's probably not going to be of much help.
Citroenaap
Student Driver
Posts: 13
Joined: Sun Jul 16, 2017 8:57 am

Re: USB With QUEMU

Post by Citroenaap »

thank you all for helping, i will keep looking and trying but we also bought a powermac g4 so we can run the required software on a real pc.

again thank you all for the effort put into helping me!
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: USB With QUEMU

Post by darthnvader »

USB passthrough works on OS X, but you have to compile QEMU with it's dependancies for USB support, lsusb or something. I've done it before, it works fine.
mcayland
Mac Mechanic
Posts: 152
Joined: Sun Nov 01, 2015 10:33 pm

Re: USB With QUEMU

Post by mcayland »

darthnvader wrote:USB passthrough works on OS X, but you have to compile QEMU with it's dependancies for USB support, lsusb or something. I've done it before, it works fine.
Yeah, I presume that's libusb. I see support for Windows is now available too: http://libusb.info/. Normally if the headers/libraries are in the right place then it should automatically get detected by QEMU's configure script.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

All builds provided here are compiled with libusb and usbredirect support.
But it seems mounting some standard (non-driver) devices require additional rights on the host, which OSX doesn't provide:

https://github.com/libusb/libusb/wiki/F ... the_device
How can I run libusb applications under Mac OS X if there is already a kernel extension installed for the device?

If there is no existing kernel extension installed for the device, libusb will run out of the box, you do not even need to have root privilege and there is no need to set up udev rules like Linux. However, if there is an existing kernel extension installed for the device, then it is more troublesome. There are ways to get libusb working and they all require some interventions as root.

1) You can use kextunload to unload the kernel extension. You need to run the command as root. Take note this may not be possible for drivers like USB HID since it may be used by other USB HID device. Take note that the kextunload command will lose its effect in the next boot.

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

Re: USB With QUEMU

Post by adespoton »

That seems to imply that you should be able to pass dongles through for example by listing loaded usb drivers before/after inserting the device, diffing the results, and then kextunloading the kext for the dongle.

VirtualBox allows for automatic capture that unloads the USB device from the host -- seems like we should also be able to use that method here...?
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: USB With QUEMU

Post by darthnvader »

mcayland wrote:
darthnvader wrote:USB passthrough works on OS X, but you have to compile QEMU with it's dependancies for USB support, lsusb or something. I've done it before, it works fine.
Yeah, I presume that's libusb. I see support for Windows is now available too: http://libusb.info/. Normally if the headers/libraries are in the right place then it should automatically get detected by QEMU's configure script.
Yes, that was it, libusb.
mePy2
Tinkerer
Posts: 58
Joined: Fri Dec 29, 2017 3:43 pm

Re: USB With QUEMU

Post by mePy2 »

Hi guys, I’m running Mac OS 9.2 on QEMU 3.0.0 downloaded from Homebrew. I’m on macOS 10.14 Mojave. I need to pass through a USB scanner to the guest machine. How Can I do?
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

Qemu needs to be compiled with libusb support. I don't know about the brew version, but the version you can download from this site has that enabled.

Next, you need to find the vendor and product IDs. You can find them through the system info application in OSX after you plugged in the scanner.

You need to use -device usb-host in your command line like this:
-device usb-host,vendorid=0x064F,productid=0x0BD7 (adjust to the ids you found)

You can then see if the system profiler in 9.2 shows the scanner.

This still does not guarantee that it will work in OSX host. See my message above in this thread about OSX support.

Best,
Cat_7
mePy2
Tinkerer
Posts: 58
Joined: Fri Dec 29, 2017 3:43 pm

Re: USB With QUEMU

Post by mePy2 »

Thank you. I’ll try.

Do you know if there is a way to check if my QEMU installation was made with or without libusb support?
Also I don’t know if I’m using Qemu correctly, I simply have made a copy paste of the qemu-system-ppc file in a folder with the hdd image and the .command file. (Instead the folder I downloaded from here was full of stuff, folder, files).

Checking the brew formula it shows that `libsub` is a dependency, so it should mean that the Homebrew version is build with libusb support.
https://formulae.brew.sh/formula/qemu

UPDATE:
I downloaded the fresh new build from here. QEMU 3.1 and it works like a charm!
On Mac OS 9.2 it recognize the Scanner. It’s great. But it blocked when I tried to scan.

Now I’m testing using Mac OS X Tiger. Always with this build.

Q: In my .command file I wrote `-usb -device usb-host, etc.` is it correct? Or I have to omit the `-usb` option?


II UPDATE:
I’m getting this in the Terminal Window while using the Scanner software:

Code: Select all

libusb: warning [darwin_transfer_status] transfer error: device not responding (value = 0xe00002ed)
libusb: warning [darwin_release_interface] USBInterfaceClose: no connection to an IOService
libusb: warning [darwin_close] USBDeviceClose: no connection to an IOService
libusb: warning [darwin_transfer_status] transfer error: timed out
libusb: warning [darwin_transfer_status] transfer error: timed out
Last edited by mePy2 on Wed Dec 26, 2018 1:25 pm, edited 2 times in total.
mePy2
Tinkerer
Posts: 58
Joined: Fri Dec 29, 2017 3:43 pm

Re: USB With QUEMU

Post by mePy2 »

Another question...
1. Is it possible, and if yes, how, to connect a disk/image to QEMU while it is running. Using the compact monitor? Like a pendrive. connect it, use it, remove it.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: USB With QUEMU

Post by Cat_7 »

about -usb: it creates an additional usb bus.

I have no idea whether/how many Mac OS 9.2 can handle, and whether you would need to tell qemu which bus to use.

And as said above, if (in your case) the scanner is recognised by a driver in OSX, it might be that the OSX host cannot release the device for use in Mac OS 9.2.

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

Re: USB With QUEMU

Post by adespoton »

That said, if you can figure out which driver is being used with the device in OS X (for example, suing lsof), you can manually tear down the driver and then QEMU should be able to grab the device.

I seem to recall problems with some USB hubs and Mac OS 9.2; I'd recommend attempting without -usb at first and only adding it if you need to.
mePy2
Tinkerer
Posts: 58
Joined: Fri Dec 29, 2017 3:43 pm

Re: USB With QUEMU

Post by mePy2 »

Hi adespoton, do you have a solution for the darwin problem about the driver?

I had a similar problem using libusb with sane-backends (scanimage). “libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access”
I think it could be the same problem. Also QEMU usb uses libusb.

Have a nice day and a happy new year,
mePy2
Last edited by mePy2 on Mon Dec 31, 2018 1:16 pm, edited 1 time in total.
mePy2
Tinkerer
Posts: 58
Joined: Fri Dec 29, 2017 3:43 pm

Re: USB With QUEMU

Post by mePy2 »

About the USB problem...

Just to recap:
It works. (I removed the -usb option remaining only the -device option with vendor and product ids). The Scanner appears in System Profiler and it is recognized by the HP Software.

When I try to actually do a scan, everything freezes! Not only the HP Software but also Mac OS! When I unplug the USB from the Mac, all is freed again. Only the scanner itself remains unusable (I have to unplug the power supply).

So I was wondering if there is some kind of debug to know what happen during this phase.

I have a Parallels Desktop Lite Ubuntu VM and the Scanner works with Simple Scan, so it’s a software problem; I mean, the Scanner works.
Post Reply