QA402 Software on Linux and Mac

The QA402 software binaries are hosted on GitHub here. Theoretically, the images should run as-in on Linux and Mac under Mono. Most of the time, we’re all used to downloading different images based on our platform (and sometimes there’s even an image for x32 and x64 machines). But the tools folks (Android, Java and DotNet) are working hard to make single image a real thing, from phones to desktop–it just all works with a single image. Now, that’s still some ways off (see MSFT MAUI for what is next up in the queue) but it’s helpful on background to understand where things are headed.

Right now, the idea is a single image that works on desktops (Win, Linux, Mac). The executable is the same for all. This requires some up-front planning, mostly related to file system differences and also making sure that libraries are not being used that aren’t replicated on other platforms.

C# and DotNet and mono enable most of this. And LibUSB is the other piece of the puzzle. On Windows, LibUsb relies on WinUSB. And with the QA402, we’ve moved to a driverless install (the OS knows what to do based on advanced descriptors). And then for non-Windows platforms, LibUSB switches out the bottom half of the stack and just works.

OK, so what are going to be the issues? We’ll, the first are UI artifacts. We’ll need to address these as they come up (and you can see this in the Ubuntu image below). But those hopefully aren’t too hard but it will take time to get things cleaned up. Second, there are going to be weird issue that are hard to replicate. Finally, there will be issues related to refinement and polish (things like installers). Windows will have them from the start, but other platforms might not.

For now, if you’d like to try the QA402 software on Linux or Mac, you can try the following steps:

  1. Download the EXE and install it on a PC (if you don’t have any way to do this, we could send a zip of the directory). The aim here is to get an image that you can put on your non-Windows machine. The app doesn’t use the registry or config files. It’s just a single EXE, a PDF and some sample files.

  2. Install Mono. The install starting point is located here

  3. With the QA402 unplugged, open a command shell/terminal and navigate to the install directory you made above. Type

mono QA40x.exe

The application should launch. Go to Help->Generate Linux USB Install Script

image

This will ask for a location where a .README file can be saved. The readme contents are also shown below:

# The steps needed to make the Audio Analyzer known to 
# Linux are shown below. You might need to tweak 
# depending on your platform
# 
# Install MONO
# See https://www.mono-project.com/docs/getting-started/install/linux/
# 
# Install LibUSB. This might be already installed.
# sudo apt-get install libusb-1.0-0
# 
# Make the hardware known to the OS. The QA402 VID:PID is 0x16C0:4E37
# sudo sh -c 'echo "SUBSYSTEM ==\"usb\", ATTRS{idVendor}==\"16c0\", ATTRS{idProduct}==\"4e37\", MODE=\"0666\"" > /etc/udev/rules.d/51 - qa402.rules'
# cat /etc/udev/rules.d/51-qa402.rules
# sudo udevadm control --reload-rules

You will probably need to tweak the above based on your platform (this field has been plowed before by others, and their experiences for the QA401H application are here which might help.

Plugging in the QA402 and re-starting the app on Ubuntu shows the following:

You can see the this ran for ~350 updates before I stopped it. It’s still very fragile, but the fragility isn’t so much the USB as it is the UI. In the screenshot above, you can see the command bar is tiled (and partially replicated). Also, you need to click a control before you can scroll the control panel with your mouse (which is different than the PC version).

But you should see the REST server seems to work fine and automated tests run (but the graph doesn’t display for some reason). But it’s not a bad starting point.

In any case, give it a try and share your thoughts.

2 Likes

Got QA402 yesteday and it looks good, and it run on Archlinux still alot of crash but hell it beeding edge :stuck_out_tongue: Thanks Matt for your hard work

I’ve attached a zip of the directory structure for those on mac/linux that would like to try.

The procedure below is only for those that wish to try and run the application under Mono. If you are on Windows, you don’t need to do that as you can run it natively If you are on Mac or Linux, then you will need to run under Mono.

On Windows, you can download the Mono installer HERE. I have not had good luck with the x64 install as it doesn’t install GTK by default and the environment isn’t correct when I install that separately. But, on Win10 x64 you can install the x32 version of Mono and it seems to runs fine thought it does appear to exhibit more sensitivity than the native dotnet in terms of acquisitions hanging while changing control settings. But left alone it ran 50k acquisitions before I stopped it.

Once mono is installed on your platform, open a mono command prompt and navigate to your QA40x unzip location as shown below. The type mono qa40x.exe to launch the app

On Windows under Mono the current release has giant status bar region, but that has been fixed already for the next release. Plug-ins should work–attached is a plot from a frequency response chirp.

Remote access via REST appears to work.

For folks not familiar with what Mono is doing, they have re-created the WinForms experience in GTK–no small feat. DotNet used to be very, very tightly tied to the Windows UI. That has been evolving over the last decade as Microsoft ventures out new directions. But what Mono has done is very impressive. Since they use GTK as the gui, and gtk exists cross platform, that means there should be a lot of commonality between the platforms. That is, quirks seen on Windows should also be seen on other platforms when running on Mono.

In any case, those on Linux/Mac, please try and and share what you see. For the next release the directory structure will be posted as a separate zip on github.

QA40x.zip (3.2 MB)

It’s really nice to see the progress of the Linux version.
I was not able to get it to recognize the QA401, so I assume support for that is not available in QA40x yet?

The QA40x doesn’t yet know about the QA401, but hopefully soon.

1 Like

I’ve been attempting to run a few of the different QA40X exes on OSX - admittedly an older version (High Sierra). This is the first version I got to actually run and load, though it crashed pretty fast. The software wasn’t able to recognize the QA402 when it was running.
In order to actually run QA40X from Mono I have to run it in 32bit mode. An easy way to do this is ‘mono32 qa40x.exe’. Mono on Mac uses Carbon for Windows.Forms and doesn’t support 64bit operation. I’m not sure if thats part of the stability issues or not as I’m way out of my wheelhouse with Mono and Win.Forms.

A potential customer (no hardware) wrote in to say they had gotten the app running under Mono in a Docker container on MacOS nd gave permission to post to forum. Docker containers are lightweight VMs. So, you get the isolation provided by a VM but all the Docker apps share the same VM so you aren’t looking at a crush of resources for every container you have running. You can also just run the QA40x app natively using Mono on Linux/Mac. A reason for running in a virtualized container might be if you didn’t want to install Mono or the QA40x app, for example, on your main machine.

The steps reported were:

  1. Download and install Docker
  2. Download and install XQuartz
  3. Launch XQuartz; enable Preferences → Security → ‘Allow connections from network clients’. Quit XQuartz for settings to take effect on next launch
  4. Launch XQuartz; open Applications → xterm and enter
$ export DISPLAY=:0
$ xhost +
  1. Build docker image with the docker file below $ docker build --tag qa402
  2. Launch the container with: $ docker run -it -e DISPLAY=host.docker.internal:0 --name qa402 qa402

Docker File:

FROM mono

RUN apt-get update && \
    apt-get upgrade && \
    apt-get install -y libgtk2.0-0 libusb-1.0-0 x11-apps

# optional if you want to 'docker exec' into the container and do some work:
RUN apt-get install -y file procps vim sox libsox-fmt-all

RUN adduser --shell /bin/bash qa402

WORKDIR /home/qa402

# unzip QA40x.zip dir prior to copy
COPY QA40x/ ./

RUN chown -R qa402: .

USER qa402
ENV DISPLAY :0

ENTRYPOINT [ "mono", "QA40x.exe" ]

Remember, this isn’t with hardware connected and so not clear what other bugs might be lurking. But it starts and any other issues can likely be fixed as they are surfaced.

There appears to be a few typos that I needed to fix in order to get things to build the docker image:

  1. in the first docker command above (its missing a dot at the end) so it should be: “docker build --tag qa402 .”
  2. The Docker file (which to be explicit should be in the directory where the QA40x directory is created from the unzipped version from github (or above), needs a few additions (-y in the first two apt-get commands) to work on OS X 10.15.7:

RUN apt-get update -y &&
apt-get upgrade -y &&
apt-get install -y libgtk2.0-0 libusb-1.0-0 x11-apps

  1. Finally, docker recommends doing scans of newly created images, so you might want to run “docker scan qa402” to run the scan on the newly created image.

Also note that there is no space between the hyphens in the “name” argument, which is to say, it should be entered as "–name "

Did you (or anybody else) successfully get it to connect to the QA402 hardware running in Docker on macOS? the software says “Connect the hardware…” for me.

I’d imagine the docker container needs some type of permissions or changed settings in order to talk to USB devices?

thanks @matt for posting the docker solution!

I’m concerned that MacOS support for the ARM-based M1 and beyond processors doesn’t appear to to be very robust. M1 and beyond are going to be ubiquitous in Apple world. Or have I missed or mis-read something on the Mono and or Docker sites?

I experienced the same as you. I am positive there is some USB-to-container setup needed but I ran out of time getting the container working, so I left it for this coming weekend. :slight_smile:

Hi Matt,

I am trying to install QA40x.exe on Ubntu 20.04.3 LTS

  • install MONO
  • copy QA40x.exe(v0.9999) from QuantAsylum folder of Windows10 ProgramFiles(x86)
    to /home of Ubuntu
  • run "mono QA40x.exe
  • run “Linux USB install script”
  • connect my QA402 to PC

Result: Software dispalyed well, but hardware(myQA402) did not be recognized; .
“Connect hardware” → not changed to “Connected”

I checked VID and PID of QA402 at the usb list of Ubuntu.

Also I checked VID at the usb list of Windows10.
(QA402 works well on Windows10/11. Win10 and Ubuntu have been installed
at same PC, by multi-booting. It means Win10 and Ubuntu share same PC hardware.)

What am I doing wrong?
I’m not familiar with Linux.

Hi @sohon23m ,For linux, the script might need to be tweaked depending on the particular flavor (also every line is commented out, so if you just run the script, nothing will happen unless you uncomment the lines you need to run). See the link below for the QA401 and much of this will apply. In particular, Step 2, 3, 4 and 5. Those will show how to install LibUSB, make the device known to the OS, etc.

Hi Matt,

Thank you.
I’ve aleady uncommented lines that need to run of the script.
But I didn’t notice that there are gpath error messages,
because the terminal window was hidden behind QA40x app’s window,
and mono stopped as following screen shot.

Can it be a hint?

Try: lsusb -v

Do you get a permission denied message or similar right when it starts to print details about the QA402?

Hi bluepy,
Thank you.
There is no message related permission when it starts,
but there are two error message when it comes to ending,
as follows(some omitted).

----start----
Script started on 2021-09-17 17:22:14+09:00 [TERM=“xterm-256color” TTY="/dev/pts/0" COLUMNS=“93” LINES=“53”]
e]0;song@song-MS-7C67: ~ae[01;32msong@song-MS-7C67e[00m:e[01;34m~e[00m$ exitlsusb -v -a e[Ke[Ks 001:007

Bus 001 Device 007: ID 16c0:4e37 Van Ooijen Technische Informatica QA402 Audio Analyzer
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x16c0 Van Ooijen Technische Informatica
idProduct 0x4e37
bcdDevice 1.00
iManufacturer 1 QUANTASYLUM
iProduct 2 QA402 Audio Analyzer
iSerial 3 8431_A2FD
:
:
:
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
can’t get device qualifier: Resource temporarily unavailable
can’t get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
e]0;song@song-MS-7C67: ~ae[01;32msong@song-MS-7C67e[00m:e[01;34m~e[00m$ exit
exit
---------------end-----------

I can’t understand the meanings of error messages :
“can’t get device qualifier” and
“can’t get debug descriptor”.

(If you need full script of lsusb, I’ll add again.)

Here is an example when I don’t have the correct permissions:

$ lsusb -v

...
Bus 001 Device 012: ID 16c0:4e37 Van Ooijen Technische Informatica QA402 Audio Analyzer
Couldn't open device, some information will be missing
...

So if you don’t get that message then perhaps it’s not a permission problem.
Have you tried a reboot? The QA40x software has a tendency to not exit cleanly, so a fresh start might help.

I tried lsusb -v several times, but there was no message related permission.
Some of other usb devices start with the “Couldn’t open device …” messages.
I also tried reboot,log out - log in, and pug/unplug QA402.

Does the QA40x console reveal anything interesting?
Add -C to the command line: mono QA40x.exe -C

Btw, are you running Ubuntu directly on hardware or in a virtual machine?