Quick installation.
-------------------
	install OpenWebRx
	install elad-firmware
	install elad-local
	launch the script postinstall

Installation details
--------------------

	OpenWebRx can be downloaded from here:

		DEBIAN
		https://www.openwebrx.de/download/debian.php
		UBUNTU
		https://www.openwebrx.de/download/ubuntu.php
		RASPBERRY PI IMAGES
		https://www.openwebrx.de/download/rpi.php

	Then follow the instructions that can be found at OpenWebRx site.

	DISCLAIMER:
		from here use your normal user for the downloads, but all the other commands require root permissions.
		feel free to use real root accound or the "sudo" command.

	At the end of the installation use the command
		systemctl stop openwebrx
		because you have to work with OpenWebRx configuration files

	elad-firmware can be downloaded from here:

		DEBIAN/UBUNTU INTEL PROCESSOR
			http://www.eladit.com/download/sdr/Linux/elad-firmware-2.0-intel
			http://www.eladit.com/download/sdr/Linux/elad-firmware-2.4-ubuntu-32
		MAC OS
			http://www.eladit.com/download/sdr/Linux/elad-firmware-2.0-mac
		RASPBERRY PI
			http://www.eladit.com/download/sdr/Linux/elad-firmware-2.0-rpi

		then copy the program elad-firmware in /usr/local/bin
			as, for example:
				cp elad-firmware-2.0-intel /usr/local/bin/elad-firmware
				chmod 755 /usr/local/bin/elad-firmware

	elad-local can be downloaded from here:

		ALL PLATFORM SOURCE PACKAGE
			http://www.eladit.com/download/sdr/Linux/elad-local-1.0.tgz

		then go to a folder of your preference and untar the file
			tar xvzf Linux/elad-local-1.0.tgz
		go to the inside folder elad-local-1.0
			if you are not on a DEBIAN/UBUNTU INTEL platform compile using:
			make clean all
		copy the program to the correct folder:
			cp elad-local /usr/local/bin/elad-local
			chmod 755 /usr/local/bin/elad-local

		if you experience problems into compilation probably you need to install libusb1.1-dev
			this can be solved using
			apt-get install libusb-1.0-0-dev
		another library that is needed is libpthread
			this can be installed using:
			apt-get install libpthread-stubs0-dev libpthread-workqueue-dev libpthread-workqueue0

	postinstall

		simply launch the command: it save a copy of the relevant files and then add the new modified ones.

		at the end restart OpenWebRx with the command:
			systemctl start openwebrx

		next, you can see the status with
			systemctl status openwebrx
				this should display something similar to the following lines:
					● openwebrx.service - OpenWebRX WebSDR receiver
					Loaded: loaded (/lib/systemd/system/openwebrx.service; enabled; vendor preset: enabled)
					Active: active (running) since Wed 2020-12-09 18:06:19 CET; 7s ago
					Main PID: 9040 (openwebrx)
					Tasks: 1 (limit: 9346)
					Memory: 35.6M
					CGroup: /system.slice/openwebrx.service
					└─9040 /usr/bin/python3 /usr/bin/openwebrx

					dic 09 18:06:19 aurora systemd[1]: Started OpenWebRX WebSDR receiver.
					dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,840 - owrx.__main__ - INFO - OpenWebRX version v0.20.1 starting up...
					dic 09 18:06:19 aurora openwebrx[9077]: rtl_connector: symbol lookup error: rtl_connector: undefined symbol: rtlsdr_set_bias_tee
					dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,849 - owrx.sdr - ERROR - The SDR source type "rtl_sdr" is not available. please check requirements.
					dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,865 - owrx.sdr - ERROR - The SDR source type "airspyhf" is not available. please check requirements.
					dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,878 - owrx.sdr - ERROR - The SDR source type "sdrplay" is not available. please check requirements.
					dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,883 - owrx.sdr - INFO - SDR sources loaded. Available SDRs: Elad

		Then you'll be able to use the radio opening a browser onto http://localhost:8073


Some internal hints
-------------------

	/etc/udev/rules.d/70-ELAD.rules
		is used to load firmware into S1 / S2 samplers when they are added (connected) to the system
		and to give world read/write access permissions to he device

	/etc/openwebrx/config_webrx.py
		contains the configuration of the samplers used (band/samplerate/filters/names)

	/usr/lib/python3/dist-packages/owrx/feature.py
		contains the declarations for the ELAD samplers (executables positions and declarations)

	/usr/lib/python3/dist-packages/owrx/source/eladsdr.py
		contains the link for the ELAD samplers 
		
	elad-local.sh
		is a stub progam the make mostly parameter conversion


Some troubleshooting
--------------------

	Testing OpenWebRx daemon:
	-------------------------

		you can see the status with
			systemctl status openwebrx
			this should display something similar to the following lines:
			● openwebrx.service - OpenWebRX WebSDR receiver
			Loaded: loaded (/lib/systemd/system/openwebrx.service; enabled; vendor preset: enabled)
			Active: active (running) since Wed 2020-12-09 18:06:19 CET; 7s ago
			Main PID: 9040 (openwebrx)
			Tasks: 1 (limit: 9346)
			Memory: 35.6M
			CGroup: /system.slice/openwebrx.service
			└─9040 /usr/bin/python3 /usr/bin/openwebrx

			dic 09 18:06:19 aurora systemd[1]: Started OpenWebRX WebSDR receiver.
			dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,840 - owrx.__main__ - INFO - OpenWebRX version v0.20.1 starting up...
			dic 09 18:06:19 aurora openwebrx[9077]: rtl_connector: symbol lookup error: rtl_connector: undefined symbol: rtlsdr_set_bias_tee
			dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,849 - owrx.sdr - ERROR - The SDR source type "rtl_sdr" is not available. please check requirements.
			dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,865 - owrx.sdr - ERROR - The SDR source type "airspyhf" is not available. please check requirements.
			dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,878 - owrx.sdr - ERROR - The SDR source type "sdrplay" is not available. please check requirements.
			dic 09 18:06:19 aurora openwebrx[9040]: 2020-12-09 18:06:19,883 - owrx.sdr - INFO - SDR sources loaded. Available SDRs: Elad


	Testing S1/S2 and firmware loading:
	-----------------------------------

		export ELAD_DEBUG=1
		/usr/local/bin/elad-firmware

		You have to see something like:

			Operations init elad-firmware version 2.4
			Usage /usr/local/bin/elad-firmware SERIAL SPEED
			SERIAL='+' or none => first available device
			( SERIAL='+' must be used when programming samplerate is needed )
			SPEED={1 .. 6} => {192kS/s .. 6.144 MS/s} for both S1 and S2
			0 vid 05e3 pid 0732 0
			1 vid 1d6b pid 0003 0
			2 vid 1721 pid 061c 0
			FDM Device Opened
			libusb devices list freed
			Interface claimed
			S2 selected 192kS/s
			USB Driver Version: 3.0
			HW Version: 1.3
			Serial: SF02QF
			ADC set
			External filter set
			XYLINX reset
			programming XYLINX: wait 1 second
			programming XYLINX:....................................................................................
			final programming XYLINX (802294)
			XYLINX programming complete (802295)
			XYLINX programming correct
			read XYLINX status (01)
			Stop FIFO
			Init FIFO

		This means that your device has been seen by the computer and the firmware has been uploaded to the device

		If you experience an error as "unable to claim interface" this means that another program is using the device.
			Most of the times this is because it is locked by OpemWebRx, try
			systemctl stop openwebrx
			and retry the command /usr/local/bin/elad-firmware


	Testing S1/S2 reception:
	------------------------

		/usr/local/bin/elad-local + 14200000 10 1 >/dev/null

		and you have to see something like:

			Operations init elad-local version 1.1
			Central Frequency: 14200000
			filter: 1 atten: 0
			resampling: 1
			0 vid 05e3 pid 0732 0
			1 vid 1d6b pid 0003 1
			2 vid 1721 pid 061c 2
			FDM Device Opened
			Interface claimed
			USB Driver Version: 3.0
			HW Version: 1.3
			FDM S2 Serial: SF02QF
			Device caught
			libusb devices list freed
			SYN Enabled
			Global Offset: -7.800000
			LP Offset: 0.000000
			ATT Offset: 12.400000
			Sample Rate Correction: 0
			S1/S2 set freq 14200000
			S2 Filters set (1)
			libusb_alloc_transfer succedeed
			libusb_submit_transfer succedeed
			SYN transfer starting
			thread=0,length=12288,time= 0.000000 mSec
			thread=0,length=12288,time= 31.859000 mSec
			thread=0,length=12288,time= 31.887000 mSec
			thread=0,length=12288,time= 31.945000 mSec
			...

		Stop this with a CTRL-C

		If you experience an error as "unable to claim interface" this means that another program is using the device.
			Most of the times this is because it is locked by OpemWebRx, try
			systemctl stop openwebrx
			and retry the command /usr/local/bin/elad-local + 14200000 10 1 >/dev/null


		If you experienced an error like "callback timeout" this means that the firmware should not be uploaded,
			Try to force upload the fisrmware as in the previous step.


	Verify USB udev programming:
	----------------------------
	
		Disconnect S1/S2
		clean dmesg queue using the command
			dmesg -C
		Connect the S1/S2 now the command
			dmesg
			should display something like:
				[29277.264067] usb 1-3: new high-speed USB device number 8 using xhci_hcd
				[29277.908579] usb 1-3: New USB device found, idVendor=1721, idProduct=061c, bcdDevice= 0.00
				[29277.908583] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
				[29277.908587] usb 1-3: Product: FDMS2 USB FW V3.0
				[29277.908590] usb 1-3: Manufacturer: FDMS2 USB FW v3.0

			it can be other, confusing and unnecessary rows due to libmtp rules (autodiscovery and program andtroid (?) devices.
				in case edit /lib/udev/rules.d/69-libmtp.rules
					adding, after the very initial section:
						LABEL="libmtp_usb_rules"

						# Some sensitive devices we surely don't wanna probe
						# Color instruments

					the line:
						ATTR{idVendor}=="1721", GOTO="libmtp_rules_end"

		to see if the firmware loader has been launched, try, as previously, the command:
			/usr/local/bin/elad-local + 14200000 10 1 >/dev/null
				that must display the same output.
				(remember to kill with CTRL C)

				If not, and you see something like:

					Operations init elad-local version 1.1
					Central Frequency: 14200000
					filter: 1 atten: 0
					resampling: 1
					0 vid 05e3 pid 0732 0
					1 vid 1d6b pid 0003 1
					2 vid 1721 pid 061c 2
					FDM Device Opened
					Cannot claim Interface

				simply wait a moment and redo the command: the error is due to the fact that the firmware is loading.

				If you see sometring like:

					Operations init elad-local version 1.1
					Central Frequency: 14200000
					filter: 1 atten: 0
					resampling: 1
					0 vid 05e3 pid 0732 0
					1 vid 1d6b pid 0003 1
					2 vid 1721 pid 061c 2
					FDM Device Opened
					Interface claimed
					USB Driver Version: 3.0
					HW Version: 1.3
					FDM S2 Serial: SF02QF
					Device caught
					libusb devices list freed
					SYN Enabled
					Global Offset: -7.800000
					LP Offset: 0.000000
					ATT Offset: 12.400000
					Sample Rate Correction: 0
					S1/S2 set freq 14200000
					S2 Filters set (1)
					libusb_alloc_transfer succedeed
					libusb_submit_transfer succedeed
					SYN transfer starting
					thread=0,length=0,time= 0.000000 mSec
					CB result: Timedout 0
					CB result: Timedout 1
					CB result: Timedout 2
					CB result: Timedout 3
					.....
					(remember to kill with CTRL C)

				the timeout at the end signals that the data transfer is not possible, the main cause is an error in firmware loading.

					To see if there are errors you can take a look at /var/log/syslog

						For example this is was seen if /usr/local/bin/elad-firmware has not the correct parameters:

							Dec 12 02:35:23 aurora kernel: [30733.212102] usb 1-3: new high-speed USB device number 14 using xhci_hcd
							Dec 12 02:35:24 aurora kernel: [30733.856643] usb 1-3: New USB device found, idVendor=1721, idProduct=061c, bcdDevice= 0.00
							Dec 12 02:35:24 aurora kernel: [30733.856648] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
							Dec 12 02:35:24 aurora kernel: [30733.856651] usb 1-3: Product: FDMS2 USB FW V3.0
							Dec 12 02:35:24 aurora kernel: [30733.856654] usb 1-3: Manufacturer: FDMS2 USB FW v3.0
							Dec 12 02:35:24 aurora mtp-probe: checking bus 1, device 14: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3"
							Dec 12 02:35:24 aurora mtp-probe: bus: 1, device: 14 was not an MTP device
							Dec 12 02:35:24 aurora systemd-udevd[12612]: 1-3: Process '/usr/local/bin/elad-firmware + 2' failed with exit code 1.
							Dec 12 02:35:24 aurora systemd-udevd[12612]: 1-3:1.0: Process '/usr/local/bin/elad-firmware + 2' failed with exit code 1.
							Dec 12 02:35:24 aurora mtp-probe: checking bus 1, device 14: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3"
							Dec 12 02:35:24 aurora mtp-probe: bus: 1, device: 14 was not an MTP device

						(see the stupid and confusing MTP messages)

					If the permissions are correct and the MTP bug is fixed the output is something like:

						Dec 12 02:39:05 aurora kernel: [30955.315224] usb 1-3: new high-speed USB device number 15 using xhci_hcd
						Dec 12 02:39:06 aurora kernel: [30955.959761] usb 1-3: New USB device found, idVendor=1721, idProduct=061c, bcdDevice= 0.00
						Dec 12 02:39:06 aurora kernel: [30955.959767] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
						Dec 12 02:39:06 aurora kernel: [30955.959770] usb 1-3: Product: FDMS2 USB FW V3.0
						Dec 12 02:39:06 aurora kernel: [30955.959773] usb 1-3: Manufacturer: FDMS2 USB FW v3.0

					nothing more than the fact that the usb device is loaded


