fosatech/Raven

When trying to select a frequency: AttributeError: 'NoneType' object has no attribute 'send'

Closed this issue · 4 comments

n0xa commented

I have two RTL-SDRs:

Found 2 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
1: Realtek, RTL2838UHIDIR, SN: 00000004

00000001 is used by the main STK Sweep process, which seems to work well.

I set the RTL TCP to use 127.0.0.1 1234, since that's the default port most tools expect. I then start the rtl_tcp server.

When I control-click in the pane to select a frequency, the terminal window gets this output:

127.0.0.1 - - [09/Dec/2023 12:38:44] "POST /rtl_tcp_frequency HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 1478, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask_socketio/__init__.py", line 43, in __call__
    return super(_SocketIOMiddleware, self).__call__(environ,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/engineio/middleware.py", line 74, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 1458, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/venv/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/axon/source/STK-Sweep/webapp/routes.py", line 86, in rtl_tcp_frequency
    current_server.send_command(set_frequency)
  File "/home/axon/source/STK-Sweep/webapp/rtl_tcp_server.py", line 178, in send_command
    self.forward.send(cmd)
AttributeError: 'NoneType' object has no attribute 'send'
{'currentTCPFreq': 1667601051}
[*] Sent

I'm on Manjaro Linux if that matters. It shouldn't make much difference in a venv.

The tcp proxy that STK Sweep uses to connect to rtl_tcp uses 127.0.0.1 and 1234 as the default IP:port. The IP and Port on the web interface is what your SDR software connects to. Try using a different port number there.

I'll add in an option to change the default IP:Port when I add a settings window.

When you click "Start Server" with '1234' as the port, you should see rtl_tcp bind error: Address already in use in the console.

I'd recommend downloading the most recent version of the repo, I just pushed some additional fixes related to the tcp proxy.

n0xa commented

That, plus the fresh git pull helped. GQRX is still being a little bitch with tcp, but SDRAngel is jumping the tuner and picking up things with the second SDR fine. The tuner frequency display doesn't change in SDRAngel, but we are doing "weird" stuff with rtl_tcp. Thanks again. Great work!

Yeah, that's the downside of rtl_tcp. Eventually we'd like to either directly interface with the SDR software, or have our own which displays the live data stream in the browser.