# WaveForms for Analog Discovery 2, almost working



## Nicola Mingotti (Jul 6, 2018)

Hi all,

I tried to run "WaveForms" for Digilent "Analog Discovery 2" in FreeBSD-11.2 and I almost succeded.

I say almost because the software hangs after a short time of analysis, about after 2 seconds.
So, there is something wich is not working but it goes far out of may area of expertise.

I report here my procedure, so maybe somebody good at libusb con move on forward.
It is necessary to enable the Linux Binary Compatibility, see here.

0] install: linux_base-c7                                                                                        
   #> pkg install linux_base-c7                                                                                  

1] download and install waveforms                                                                                
  #> rpm2cpio < /home/p/download/digilent.waveforms_3.8.2.x86_64.rpm | cpio -id                                                                                                                                      
  #> brandelf -t Linux /compat/linux/usr/lib/digilent/waveforms/waveforms                                        
2] download and install Adept2
   #> rpm2cpio < /home/p/download/digilent.adept.runtime-2.17.1.x86_64.rpm | cpio -id

Now starts a long sequence of packages to install, some of them you can find
as FreeBSD packages, some others must be taken as RPM from the internet.

I looked for packages using Google queries similar to this:
"linux centos libgsm.so.1 64bit rpm"
I mostly used RPMfind page list, and got packages for Centos 7.5.XXX.

3] #> pkg install linux-c7-pulseaudio-libs-10.0

4] -- empty line --

5] #> pkg install linux_libusb-11.0r261448_2
    ==> can't find libusb-1.0.so.0
    ==> Get libusb RPM from the web

6] #> rpm2cpio < /home/p/download/libusbx-1.0.21-1.el7.x86_64.rpm | cpio -id

7] #> rpm2cpio < /home/p/download/systemd-libs-219-57.el7.x86_64.rpm | cpio -id

8] #> rpm2cpio < /home/p/download/lz4-1.7.5-2.el7.x86_64.rpm  | cpio -id

9] #> pkg install linux-c7-libgcrypt-1.5.3_4

10] #> rpm2cpio < /home/p/download/elfutils-libs-0.170-4.el7.x86_64.rpm  | cpio -id

11] #> rpm2cpio < /home/p/download/gsm-1.0.13-11.el7.x86_64.rpm  | cpio -id

12] #> Modify the script running Waveforms:
---------------- /compat/linux/usr/bin/waveforms ----------
#!/bin/sh

# ORIGINAL
# export LD_LIBRARY_PATH=/usr/lib/digilent/waveforms/qtlibs
# /usr/lib/digilent/waveforms/waveforms "$@"

export LD_LIBRARY_PATH=/usr/lib/digilent/waveforms/qtlibs:/usr/lib64/digilent/adept/:/usr/bin/usr/lib64
/compat/linux/usr/lib/digilent/waveforms/waveforms "$@"
-----------------------------------------------------------

12] Now the program "waveforms" starts !
      ... but it does not find the usb-device.

This is because we are using libusb from the RPM and not
the one provided from FreeBSD, see informations in
#> pkg show linux_libusb-11.0r261448_2

To make it work i did the following
1] #> cd /compat/linux/usr/bin/usr/lib64
2] #> mv libusb-1.0.so.0 libusb-1.0.so.0-ORIGINAL
3] #> ln -s /compat/linux/usr/lib/libusb.so libusb-1.0.so.0

#  you still are root here, without root I could not access the device.
#> cd /compat/linux/usr/bin
#> ./waveforms                             
# ==> You should see a usable interface

Oook, it seems to work, and indeed if you select the tool "Voltmeter" it runs smoothly.
But, once you try to run the tool "Scope", it hangs. It hangs after making some correct measurements.

Hope somebody can move forward !
It would be great to have this tool in FreeBSD, for people who use it as a desktop OS and like to hack electronics.

Bye
Nicola


----------

