MorphOS runs on QEmu
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @jacadcaps
    Yes, it's just fun for me
    I am very happy to use morphos on real machine and am having a lot of fun.
    I went back in time only now I have a much more powerful "amiga" that works with everything I try :-)

    I noticed that on a real machine the USB-audio and associated have:
    usb.audioclass and hid.class with poseidon

    while on qemu:
    usb.audioclass only

    also at the moment i get this error in the qemu window:
    qemu-system-ppc libusb_set_interface_alt_settings -5: notfound

    even if in the compilation of qemu the support is active for:
    libusb-1.0-0 libusb-1.0-0-dev

    it would be nice to make it work
    but if you've tried it and it doesn't work
    then most likely my hopes are nil :-)
  • »19.09.21 - 18:41
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    I tried to get close to the actual hardware setup.
    Now somehow the audio stick seems to "work"
    poseidon recognizes the hardware and rescan morphos works fine too.
    the device no longer receives "device death" but is not classified for example with: hid.class or other
    and also in qemu the libusb error disappears
    The only drawback is that in the audio settings it is not recognized as "usb audio" and therefore I cannot select it to enable it.

    If, on the other hand, someone wants to try this is the new UDEV rule I used:
    SUBSYSTEM == "usb", DRIVER == "snd-usb-audio", ATTRS {idVendor} == "0d8c", ATTRS {idProduct} == "0014", ATTR {authorized} = "0"

    then not to use sudo:
    ACTION == "add", SUBSYSTEM == "usb", ATTR {idVendor} == "0d8c", ATTR {idProduct} == "0014", OWNER = "white"

    this instead the previous UDEV that was recognized directly in MUSIC as USB-AUDIO:
    ACTION == "add", ATTR {idVendor} == "0d8c", ATTR {idProduct} == "0014", RUN + = "/ bin / sh -c 'echo 0> / sys / \ $ devpath / authorized'"

    but he had problems with the "death of the device"

    now I'm not an expert in this maybe someone can help.
    Thanks :-)

    maybe some parameters are missing in UDEV but I can't do better

    here instead the new log:
    16: 38: 19 | 0-poseidon.library: Welcome to poseidon 4.4 (15.3.18) © 2002-2018 by Chris Hodges (20090807)!
    16: 38: 19 | 0-poseidon.library: This is the PPC native MorphOS version.
    16: 38: 19 | 0-poseidon.library: Event broadcaster started.
    16: 38: 19 | 0-poseidon.library: Say hello to massstorage.class V4.9 (Supports storage devices via usbscsi.device (MOS)).
    16: 38: 19 | 0-poseidon.library: Whoah! hub.class V4.4 surprised as Root / external hub base class (MOS).
    16: 38: 19 | 0-poseidon.library: The door bell rang for hid.class V4.6 (Generic support for human interface devices (MOS)).
    16: 38: 19 | 0-poseidon.library: New hardware pciusb.device / 0 added (PCI OHCI USB 1.1 Host Controller (NEC)).
    16: 38: 19 | 0-poseidon.library: Root hub has been enumerated.
    16: 38: 19 | 20-poseidon.library: Opening pciusb.device unit 1 failed device / unit failed to open (-1).
    16: 38: 19 | 0-hub.class: Hub with 3 ports successfully configured.
    16: 38: 19 | 0-hub.class: I'm in love with hub 'PCI Root Hub Unit 0'.
    16: 38: 20 | 0-hub.class: Detected device 'QEMU USB Keyboard' at port 1. I like it.
    16: 38: 20 | 0-hub.class: Detected device 'QEMU USB Mouse' at port 2. I like it.
    16: 38: 20 | 0-hub.class: Detected device 'QEMU USB Hub' at port 3. I like it.
    16: 38: 20 | 0-hub.class: Hub has added 3 device (s). That'll be fun!
    16: 38: 20 | 0-hid.class: Using HID Descriptor from initial configuration run.
    16: 38: 20 | 0-hid.class: HID the road, 'QEMU USB Keyboard'!
    16: 38: 20 | 0-hid.class: Using HID Descriptor from initial configuration run.
    16: 38: 20 | 0-hid.class: HID the road, 'QEMU USB Mouse'!
    16: 38: 20 | 0-hub.class: Hub with 8 ports successfully configured.
    16: 38: 20 | 0-hub.class: I'm in love with hub 'QEMU USB Hub'.
    16: 38: 20 | 10-poseidon.library: SET_CONFIGURATION failed: endpoint stall (4)
    16: 38: 20 | 10-poseidon.library: No current configuration, huh?
    16: 38: 20 | 0-hub.class: Detected device 'USB Audio Device ??????????????' at port 1. I like it.
    16: 38: 20 | 0-hub.class: Hub has added 1 device (s). That'll be fun!
    16: 38: 20 | 10-poseidon.library: SET_CONFIGURATION failed: endpoint stall (4)
    16: 38: 20 | 10-poseidon.library: No current configuration, huh?
    16: 38: 20 | 10-poseidon.library: SET_CONFIGURATION failed: endpoint stall (4)
    16: 38: 20 | 10-poseidon.library: No current configuration, huh?
    16: 38: 24 | 10-poseidon.library: Forced device binding of USB Audio Device ?????????????? to hub.class failed.


    I put a video maybe the concept is clearer maybe you can configure it manually and be of help to those who want to try:
    https://www.youtube.com/watch?v=jJSZilWXe-Y

    [ Edited by white 20.09.2021 - 15:52 ]
  • »20.09.21 - 14:13
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    cip060
    Posts: 137 from 2010/7/30
    tanto non SUONA
  • »20.09.21 - 14:52
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Georg
    Posts: 106 from 2004/4/7
    I would first try getting this to work by running some Linux live cd with qemu. As long as that causes similiar problems you know it's not related to MorphOS/Poseidon.

    If you get it to work with Linux live cd, but still not with MorphOS, maybe try some AROS Live CD (uses Poseidon USB Stack, too).
  • »20.09.21 - 15:55
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @Georg
    Thanks for the advice,
    i tried "aros 440 live" with sam460ex
    actually the problem is the same "death of the device"
    or it is recognized but no class.hid is associated for example.
    at this point it seems to be UDEV the problem I probably have the parameters are wrong or the USB-audio is not completely disabled on the host.
    I had also tested morphos with sam460ex and pegasos2 but the problems are the same,
    or it's simply not possible I don't know :-)

    [ Edited by white 20.09.2021 - 19:01 ]
  • »20.09.21 - 17:55
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    I am tenacious I wanted to get back on the test
    now works
    I have disabled all UDEV rules
    and I just did:
    "stop pulseaudio.socket"
    this is what creates the problem with libusb as well
    the only drawback is that qemu remains frozen
    once the usb-audio is recognized
    if instead I remove the usb-audio stick everything works again
    and is perfectly recognized with:
    usbaudio.class and hid.class as in "real hardware"

    here the video with the test:
    https://www.youtube.com/watch?v=nH1_b3gwxc0

    I hope it will be useful for qemu and add any improvements
  • »23.09.21 - 15:21
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    liquidbit
    Posts: 407 from 2003/10/12
    I want to buy MOS and use it through QEmu... does anyone know if this is possible ?
    ..there will be only one left.
  • »27.09.21 - 15:49
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2972 from 2003/3/5
    From: Canada
    You can use it in demo mode. It is not possible to register MorphOS running on QEmu.
  • »27.09.21 - 16:38
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Minuous
    Posts: 161 from 2010/2/13
    And consequently, since the SDK will not install in the allowed time, programmers wishing to support MorphOS can't use such a system for development.

    [ Edited by Minuous 28.09.2021 - 23:19 ]
  • »28.09.21 - 13:19
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2972 from 2003/3/5
    From: Canada
    Quote:

    Minuous wrote:
    And consequently, since the SDK will not install in the allowed time, programmers wishing to support MorphOS can't use such a system for development.


    I can install it just fine though. Perhaps your CPU is too slow for emulation. Then again, you really want to cross-compile in such case. QEmu's PPC emulation just isn't good enough and GCC will ICE / crash / crash QEmu eventually when compiling bigger projects.
  • »28.09.21 - 14:09
    Profile Visit Website
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Georg
    Posts: 106 from 2004/4/7
    Well ... theoretically an emulator does not need to have 1:1 mapping between real time and emulated time. If for example in an emulator timing ran at half speed compared to real life, you could use it twice as long. To the OS in the emulated machine it would look like it's running on a machine that is twice as fast and being used by an hyper active user which is also twice as fast (for example at typing) as a normal user.

    ...
  • »28.09.21 - 14:17
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    @Georg
    It may depend on the RTC which is independent of the speed.
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »28.09.21 - 17:33
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Georg
    Posts: 106 from 2004/4/7
    The emulator can lie about everything if it wants to. Depending on what user wants to do inside the emulated OS, he may not care about whether anything time related inside the emulation matches real world or not.
  • »28.09.21 - 17:47
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2972 from 2003/3/5
    From: Canada
    Quote:

    The emulator can lie about everything if it wants to.


    Which is precisely why we are not allowing QEmu registrations.
  • »28.09.21 - 20:13
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @All
    Today I wanted to go back to qemu, to pass some time.

    Now qemu sam460ex (morphos) recognizes the audio-usb-stick without any blocking.
    It also allows you to choose it as an audio device and save it.
    The only problem is that no sound is heard afterwards.

    Same thing for sam460ex (ArosPPC) everything is regularly recognized.

    My question is:
    in reality there is a driver for sam460ex audio-usb Morphos side?
    or is there just the original sam460ex sound chip driver without support for a sam460ex audio-usb in real hardware?
    this information would be very useful to understand if it still doesn't work or at this point a driver written for sam460ex is missing for the USB-audio with Morphos?

    Thank you. :-)
  • »29.01.22 - 17:11
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Andreas_Wolf
    Posts: 12077 from 2003/5/22
    From: Germany
    > there is a driver for sam460ex audio-usb Morphos side? or is there
    > just the original sam460ex sound chip driver without support for a
    > sam460ex audio-usb in real hardware? […] a driver written for
    > sam460ex is missing for the USB-audio with Morphos?

    MorphOS 3.10 introduced USB audio support, regardless of hardware platform, so no reason why it shouldn't work on real Sam460. Note that MorphOS probably only supports USB Audio specification 1.0, not 2.0 or later.
    MorphOS Library has a list of tested USB audio devices.
  • »29.01.22 - 19:07
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @Andreas_Wolf
    The usb-audio stick is among those compatible in the list and:
    "c-media electronics"
    I made a short video where you can see that everything is recognized but the sound is not reproduced.
    Maybe it can help others who may be interested in it.

    here the video of a few minutes:
    https://we.tl/t-LMxlsyj9tt
  • »29.01.22 - 21:06
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    In summary what I'm trying to do is this:

    lsmod

    snd_usb_audio 356 352 0
    snd_usbmidi_lib 45056 1 snd_usb_audio
    snd_rawmidi 45056 1 snd_usbmidi_lib
    mc 65536 1 snd_usb_audio

    because something seems to work but I still can't understand the right procedure is always if this exists

    then example:
    sudo modprobe -f snd_usb_audio
    and so on:
    sudo modprobe -f snd_usbmidi_lib

    some of these loaded modules conflict with the following error:
    qemu-system-ppc: libusb_release_interface: -4 [NO_DEVICE]

    But not always
    I can also avoid it

    but this involves the freezing of Morphos and therefore I cannot complete the saving of the peripheral.

    I will try other solutions
    If anyone is interested any suggestions would be nice :-)

    I still don't know Morphos well to see this

    the saving of my real hardware with the usb-audio stick where do I find it once I have configured my PowerBook with the usb-audio stick in Morphos?

    Thank you. :-)


    [ Edited by white 30.01.2022 - 21:29 ]
  • »30.01.22 - 21:20
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    Here is the test carried out on Sam460ex with ArosPPC,

    here too the usb-audio stick is recognized by Poseidon
    but even in this case no sound is heard.

    https://we.tl/t-dIoDLeN0Dv

    separate note:
    these are the two usb-audio sticks that I am using for the tests
    both are recognized on real hardware with Morphos and work flawlessly.
    If it could be useful:

    Amazon:
    https://tinyurl.com/yaakns4p
    https://tinyurl.com/5n7ue6xd


    [ Edited by white 31.01.2022 - 12:27 ]
  • »31.01.22 - 07:43
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    Here instead pegasos2 which now no longer crashes even with the usb-audio stick inserted.
    In this case the device is recognized as usb
    but not with exact specifications.

    (I have no idea if the controller ( VIA INTEL ALI etc. is the correct one )

    here the little test:

    https://we.tl/t-8g8a74FGN2
  • »31.01.22 - 23:19
    Profile
  • MorphOS Developer
    zukow
    Posts: 642 from 2005/2/9
    From: Poland
    You should contact author of this fix and tell him that it doesn't work very well :)

    2021-12-14 QEMU 6.2.0 is now available Fixed USB emulation and some small enhancements in pegasos2
  • »01.02.22 - 13:29
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @zukow,
    Hi,

    The fix I guess is due to the error
    libusb_release_interface: -4 [NO_DEVICE]
    which occurred before effectively blocking Morphos when the audio-usb was inserted
    and now it no longer occurs.

    For the rest I don't understand why those who develop qemu don't buy this:
    AMAZON:
    https://tinyurl.com/5n7ue6xd <---- 7.99 EUR

    and debug or something else.

    I have not used linux for 20 years and I do my best to spend a few hours of time.

    here the author's answer:
    It turns out there's a limitation in QEMU's OHCI emulation that likely causes problems for devices with multiple endpoints such as audio interfaces with buttons (like when you see both audio and hid classes attached to the USB device) or maybe audio interfaces in general so these likely won't work with machines using OHCI (eg mac99 and sam460ex) until somebody fixes this in the QEMU device emulation. (This was discussed on the qemu-devel list end of last year but I don't have a link now.)
    The pegasos2 uses a different USB controller (UHCI) which had a separate problem but I've fixed that in latest 6.2.0 version so you may try with that instead as it may work better or at least have better chnace of working than the known incomplete OHCI emulation. So if you're still interested, please test with the pegasos2 machine and let us know.

    for Pegasos 2 here are some tips from the author:
    You definitely don't have to do modprobe on your host OS, in fact you need to do the opposite and make sure NO driver is loaded by the host foir the device so the guest driver can fully control it. Otherwise host and guest drivers may both access it which will not work. Maybe try to do lshw as root on your host OS and check that the device is claimed by any driver then unload that driver with modprobe -r or rmmod and once it's unclaimed then try to use it from QEMU. If you cannot unload the driver because the audio device is opened by some service such as pulsaudio you may need to stop those first or better add an udev rule to ignore the device so when you plug it in no driver is loaded then the guest can use it excusively.

    In fact I have blacklisted the UDEV device and also disabled pulse on the usb-audio device
    but it doesn't seem to work.

    It's probably not clear to me what he means by the advice he probably gave me.
    Because the problem remains, the device is connected but in fact it is not seen as a usb-audio device as opposed to Sam460ex which actually recognizes it and saves the device but then the sound is not heard.

    Some idea?

    I always remain of the idea that if the thing is feasible, the purchase of the usb-audio stick by the developer is the best choice
    AMAZON:
    https://tinyurl.com/5n7ue6xd <---- 7.99 EUR
    :-)

    since there are,
    thank's for your job,
    I find Morphos a really nice system :-)

    [ Edited by white 01.02.2022 - 16:14 ]
  • »01.02.22 - 16:10
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    I wanted to deepen the disabling of modules in the kernel of the usb-audio stick

    I believe it is the correct procedure
    here I put the whole procedure to disable kernel modules that are loaded at boot
    in this case a video is much more efficient in practical terms is faster where there are all the steps step by step

    disabling modules in the kernel:

    https://we.tl/t-23jL168zyf

    here instead the use of the usb-audio stick after the reboot with the modules disabled:

    https://we.tl/t-fDkXo0Nfb5

    I hope someone more experienced can possibly tell me if I have made any mistakes.

    Because the result does not change unfortunately the usb-audio stick is recognized in the same way with Pegasos2.

    Thanks again.
  • »02.02.22 - 11:25
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Georg
    Posts: 106 from 2004/4/7
    Why do you want to get audio working through usb-audio stick? Isn't it easier to get it to work through qemu-emulated sound card for which Morphos has drivers? I doubt audio stick would end up working better even if MorphOS would directly speaking to hw instead of going through qemu, because on the other hand inside MorphOS there may be more overhead for running cpu code for usb stack and usb driver.
  • »05.02.22 - 08:10
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 158 from 2019/4/6
    @Georg
    I just got the idea when I was using qemu with morphos and I wanted to move some data to do some tests
    then I tried to mount a usb stick that contained data
    with:
    -usb -device usb-host, vendorid = 0xeba4, productid = 0x7588

    in this case the pen is recognized by morphos and can be used without problems.

    So since there is no audio emulation in qemu

    I said then it should also recognize a usb-audio stick in the same way.

    but it actually seems more complicated than I thought.

    And every now and then I do tests to pass the time.

    Qemu does not currently support audio with morphos
    I can't tell you the reason for this. :-)
  • »05.02.22 - 12:44
    Profile