jopohl / urh

Universal Radio Hacker: Investigate Wireless Protocols Like A Boss
GNU General Public License v3.0
10.85k stars 862 forks source link

LimeSDR in Docker #536

Closed 1am closed 6 years ago

1am commented 6 years ago

Hi,

I'm trying to use LimeSDR in URH from docker but it seems not to be working with spectrum analyser so far. It works ok on my host (Ubuntu 18) when I start the pip3 installed URH.

My Docker symptoms are the following:

Is it possible that it's a UI issue with X forwarding to Docker or maybe I should install all Lime tools inside of the docker container? Anybody experienced this issue before? If I remember correctly I had no issues with HackRF with Dockerized URH.

This is my URH SA on host in-host

This is my URH SA in Docker in-docker

I'm not trying to run both at the same time :)

jopohl commented 6 years ago

Strange, I cannot reproduce this behaviour. My LimeSDR runs fine in both, native and docker. I have, however, no LimeSDR mini for testing, just a normal one, so that might be the issue. Since the Docker Image is based on Ubuntu 18 I am very surprised that the Lime mini does not work in your case. What version of LimeSuite you have installed on the host? In Docker Image it is 17.12.

1am commented 6 years ago

My hos LimeUtil gives the following output:

LimeUtil --info   
######################################################
## LimeSuite information summary
######################################################

Version information:
  Library version:  v18.04.1-myriadrf1~bionic
  Build timestamp:  2018-04-29
  Interface version:    v2018.3.0
  Binary interface: 18.04-1
...
Supported connections:
   * FT601
   * FX3
   * PCIEXillybus

When I opened bash in urh image i couldn't find LimeUtil command so I've searched for it and have the following output:

# find / -name '*Lime*'
/usr/local/lib/python3.6/dist-packages/urh/dev/native/__pycache__/LimeSDR.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/urh/dev/native/LimeSDR.py
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.18.06-1
/usr/lib/x86_64-linux-gnu/libLimeSuite.so
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.17.12.0
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.18.06.0
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.17.12-1

Where on my host it's:

...
/usr/lib/x86_64-linux-gnu/cmake/LimeSuite
/usr/lib/x86_64-linux-gnu/cmake/LimeSuite/LimeSuiteConfig.cmake
/usr/lib/x86_64-linux-gnu/cmake/LimeSuite/LimeSuiteConfigVersion.cmake
/usr/lib/x86_64-linux-gnu/libLimeSuite.so
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.18.04.1
/usr/lib/x86_64-linux-gnu/libLimeSuite.so.18.04-1
/usr/lib/x86_64-linux-gnu/pkgconfig/LimeSuite.pc
...

So maybe the coexistence of 18.06 and 17.12 could cause problems?

Looked into the Dockerfile and can't find the LimeUtil installation part. I'm using the FROM jopohl/urh:latest in my own Dockerfile which doesn't have anything more yet so the source image is downloaded from DockerHub.

jopohl commented 6 years ago

Thanks for your research. I just saw that limesuite17.12 is installed in the docker container. Does it help if you run apt-get remove limesuite17.12 and start URH after that?

Furthermore, on your host you have libLimeSuite.so.18.04.1, while in docker container it is the more recent one libLimeSuite.so.18.06.0. You mind compiling libLimeSuite.so.18.06 on your host and see if the Mini still work?

jopohl commented 6 years ago

Update: I just made some tweaks in the Dockerfile. Could you build it locally (available here: https://github.com/jopohl/urh/pull/537) and see if the Lime mini works? Normal LimeSDR works fine on my end.

1am commented 6 years ago

I've tested the new dockerfile and there is a change, though it hasn't started correctly. Now I've got this error in the SA UI:

LimeSDR-OPEN (LimeSDR Mini, media=USB 2.0, module=uLimeSDR, addr=24607:1027, serial=1D424078480CB5): Success
LimeSDR-INIT: Error Code: -1 (-1)
LimeSDR: failed to start rx mode

In terminal I'm getting this message which I don't really know where to look at for solution:

[INFO::SettingsProxy.py::get_receive_buffer_size] Try to allocate receive buffer with size 262.144kB
[INFO::Device.py::start_rx_mode] LimeSDR: Starting RX Mode
Claimed Interface
Estimated reference clock 40.0018 MHz
Selected reference clock 40.000 MHz
[INFO::Device.py::log_retcode] LimeSDR-OPEN (LimeSDR Mini, media=USB 2.0, module=uLimeSDR, addr=24607:1027, serial=1D424078480CB5): Success
CGEN: Freq=80 MHz, VCO=2.56 GHz, INT=63, FRAC=0, DIV_OUTCH_CGEN=15
[ERROR::Device.py::log_retcode] LimeSDR-INIT: Error Code: -1 (-1)
libusb: warning [libusb_exit] application left some devices open

Logs on my host URH are a bit different:

[INFO::SettingsProxy.py::get_receive_buffer_size] Try to allocate receive buffer with size 262,144kB
[INFO::Device.py::start_rx_mode] LimeSDR: Starting RX Mode
Reference clock 40.00 MHz
[INFO::Device.py::log_retcode] LimeSDR-OPEN (LimeSDR Mini, media=USB 2.0, module=FT601, addr=24607:1027, serial=1D424078480CB5): Success
[INFO::Device.py::log_retcode] LimeSDR-INIT: Success
[INFO::Device.py::log_retcode] LimeSDR-SET_CHANNEL_INDEX to 0: Success
LNAL has no connection to RF ports
[INFO::Device.py::log_retcode] LimeSDR-SET_ANTENNA_INDEX to 2: Success
[INFO::Device.py::log_retcode] LimeSDR-SET_FREQUENCY to 2402000000.0: Success
[INFO::Device.py::log_retcode] LimeSDR-SET_SAMPLE_RATE to 2500000.0: Success
RX LPF configured
[INFO::Device.py::log_retcode] LimeSDR-SET_BANDWIDTH to 20000000.0: Success
[INFO::Device.py::log_retcode] LimeSDR-SET_RF_GAIN to 0.5: Success
[INFO::Device.py::log_retcode] LimeSDR-Initialize stream: Success
[INFO::Device.py::stop_rx_mode] LimeSDR: Stopping RX Mode: Dialog closed. Killing recording process.
[INFO::Device.py::log_retcode] LimeSDR-CLOSE: Success
[INFO::Device.py::read_device_messages] Exiting read device message thread due to 
[INFO::Device.py::read_receiving_queue] EOF Error: Ending receive thread
[DEBUG::Device.py::read_device_messages] Exiting read device errors thread
[DEBUG::Device.py::read_receiving_queue] Exiting read_receive_queue thread.
[DEBUG::SendRecvDialog.py::closeEvent] Device stopped successfully.
[DEBUG::SendRecvDialog.py::closeEvent] Cleaning up device
[DEBUG::SendRecvDialog.py::closeEvent] Successfully cleaned up device

The biggest diference could be the module=uLimeSDR in Docker while host selects module=FT601.

jopohl commented 6 years ago

Alright, seems like we are getting somewhere. I just pushed another update to the Dockerfile (#537). Now I use the liblimesuite version of the myriadrf repos, which should exactly match the version on your host.

Could you test it again?

1am commented 6 years ago

Works like a charm! Thank you