rfquack / RFQuack-cli

Command line interface client to RFQuack dongles
https://github.com/trendmicro/RFQuack
GNU General Public License v2.0
10 stars 3 forks source link

Cannot find dongle aka q.dongle(id) ESP32 - CC1101 #8

Open wurst44 opened 2 years ago

wurst44 commented 2 years ago

Hello, nice project. Should the dongle be available automatically? I can see how my MQTT shell is connecting successfully to the ESP32 but I cannot find my dongle.

[01:13:36][RFQK]       4108 T: MQTT connected
[01:13:36][RFQK]       4119 T: Subscribed to topic: RFQUACK/in/#
[01:13:36][RFQK]       4130 T: Subscribed to topic: any/in/#
[01:13:36][RFQK]       4484 T: Module 'guessing' registered.
[01:13:36][RFQK]       4484 T: Module 'frequency_scanner' registered.
[01:13:36][RFQK]       4485 T: Module 'mouse_jack' registered.
[01:13:36][RFQK]       4487 T: Module 'packet_filter' registered.
[01:13:36][RFQK]       4492 T: Module 'packet_modification' registered.
[01:13:36][RFQK]       4497 T: Module 'packet_repeater' registered.
[01:13:36][RFQK]       4503 T: Module 'roll_jam' registered.
[01:13:36][RFQK]       4507 T: Module 'ping' registered.
[01:13:36][RFQK]       4511 T: Module 'radioA' registered.
[01:13:36][RFQK]       4515 T: Setup is over.
[01:13:36][RFQK]       4529 T: Starting main loop.
[01:13:37][RFQK]       5320 W: MQTT transport not connected
[01:13:37][RFQK]       5321 T: Connecting RFQUACK to MQTT broker kerXXX.de:18XX
[01:13:38][RFQK]       6358 T: MQTT connected
[01:13:38][RFQK]       6751 T: Subscribed to topic: RFQUACK/in/#
[01:13:38][RFQK]       6764 T: Subscribed to topic: any/in/#
[01:13:39][RFQK]       7780 W: MQTT transport not connected
[01:13:39][RFQK]       7781 T: Connecting RFQUACK to MQTT broker kerXXX.de:18XX
[01:13:40][RFQK]       8820 T: MQTT connected
[01:13:40][RFQK]       8828 T: Subscribed to topic: RFQUACK/in/#
[01:13:40][RFQK]       8835 T: Subscribed to topic: any/in/#
[01:13:42][RFQK]      10029 W: MQTT transport not connected
[01:13:42][RFQK]      10029 T: Connecting RFQUACK to MQTT broker kerXXX.de:18XX
[01:13:43][RFQK]      11057 T: MQTT connected

What would be my DongleID? Also the radioA object is missing?

        help:
        > q.packet_modification.help()      # use the helper function.
        > q.?                               # tab is your friend

        exit:   just type ctrl-d a couple of times!

  Select a dongle typing: q.dongle(id)

RFQuack(RFQUACK, kerXXX.de:18XX)> q.dongle(id)
Wrong dongle id

RFQuack(RFQUACK, kerXXX.de:18XX)> q.radioA
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-96a3aced6849> in <module>
----> 1 q.radioA

AttributeError: 'RFQuack' object has no attribute 'radioA'

Thank you!

phretor commented 2 years ago

The dongle ID is not needed because the client is able to do auto discovery.

If you don't see any radio object, then it means that auto discovery somehow failed.

The best way to find out what failed is to increase the debug level of the firmware at compile time, so that you'll see a more verbose serial output: you'll find a couple of issues where I mention how to do that, or you could grep for "debug" in the source code.

Could you paste the entire serial output, before the MQTT stuff?

Also, when it says "transport not connected" it may indicate that it's having issues connecting to the broker. Can you try an auto-less, local, plain broker instead of an internet connected one? We've never had issues, but it's better to investigate one thing at a time.

wurst44 commented 2 years ago

ok I will try the debug mode. Is it #define RFQUACK_DEBUG_RADIO_DEFAULT true? (did that)

I thought because of MQTT connected the MQTT transport not connected message could be disregarded. here the full log:

Using 'COM3' as serial port.
Showing logs:
[13:36:12][RFQK]        448 T: Connecting RFQUACK to MQTT broker kerXXX.de:18XX
[13:36:13][E][WiFiGeneric.cpp:739] hostByName(): DNS Failed for kerXXX.de
[13:36:13][RFQK]       1450 W: MQTT error = -3, return = 0
[13:36:14][RFQK]       2604 T: MQTT connected
[13:36:14][RFQK]       2614 T: Subscribed to topic: RFQUACK/in/#
[13:36:14][RFQK]       2627 T: Subscribed to topic: any/in/#
[13:36:14][RFQK]       2981 T: Module 'guessing' registered.
[13:36:14][RFQK]       2981 T: Module 'frequency_scanner' registered.
[13:36:14][RFQK]       2982 T: Module 'mouse_jack' registered.
[13:36:14][RFQK]       2984 T: Module 'packet_filter' registered.
[13:36:15][RFQK]       2989 T: Module 'packet_modification' registered.
[13:36:15][RFQK]       2994 T: Module 'packet_repeater' registered.
[13:36:15][RFQK]       3000 T: Module 'roll_jam' registered.
[13:36:15][RFQK]       3004 T: Module 'ping' registered.
[13:36:15][RFQK]       3008 T: Module 'radioA' registered.
[13:36:15][RFQK]       3012 T: Setup is over.
[13:36:15][RFQK]       3026 T: Starting main loop.

also seems like a DNS resoving issue so I used an IP, but I think that those are the initial retries after finding a WIFI:

Hard Resetting...
Done! Flashing is complete!

Showing logs:
[13:49:50][RFQK]        534 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:49:51][E][WiFiClient.cpp:232] connect(): connect on fd 54, errno: 118, "Host is unreachable"
[13:49:51][RFQK]       1537 W: MQTT error = -3, return = 0
[13:49:53][E][WiFiClient.cpp:232] connect(): connect on fd 55, errno: 118, "Host is unreachable"
[13:49:53][RFQK]       3138 W: MQTT error = -3, return = 0
[13:49:54][RFQK]       4193 T: MQTT connected
[13:49:54][RFQK]       4205 T: Subscribed to topic: RFQUACK/in/#
[13:49:54][RFQK]       4214 T: Subscribed to topic: any/in/#
[13:49:54][RFQK]       4567 T: Module 'guessing' registered.
[13:52:11][RFQK]       2877 T: Module 'frequency_scanner' registered.
[13:52:11][RFQK]       2878 T: Module 'mouse_jack' registered.
[13:52:11][RFQK]       2880 T: Module 'packet_filter' registered.
[13:52:11][RFQK]       2885 T: Module 'packet_modification' registered.
[13:52:11][RFQK]       2890 T: Module 'packet_repeater' registered.
[13:52:11][RFQK]       2896 T: Module 'roll_jam' registered.
[13:52:11][RFQK]       2900 T: Module 'ping' registered.
[13:52:11][RFQK]       2904 T: Module 'radioA' registered.
[13:52:11][RFQK]       2908 T: Setup is over.
[13:52:11][RFQK]       2922 T: Starting main loop.
[13:53:19][RFQK]      70705 W: MQTT transport not connected
[13:53:19][RFQK]      70705 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:20][RFQK]      71739 T: MQTT connected
[13:53:20][RFQK]      71749 T: Subscribed to topic: RFQUACK/in/#
[13:53:20][RFQK]      71759 T: Subscribed to topic: any/in/#
[13:53:21][RFQK]      72855 W: MQTT transport not connected
[13:53:21][RFQK]      72855 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:22][RFQK]      73902 T: MQTT connected
[13:53:23][RFQK]      74184 T: Subscribed to topic: RFQUACK/in/#
[13:53:23][RFQK]      74194 T: Subscribed to topic: any/in/#
[13:53:24][RFQK]      75011 W: MQTT transport not connected
[13:53:24][RFQK]      75011 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:25][RFQK]      76040 T: MQTT connected
[13:53:25][RFQK]      76049 T: Subscribed to topic: RFQUACK/in/#
[13:53:25][RFQK]      76058 T: Subscribed to topic: any/in/#
[13:53:26][RFQK]      77156 W: MQTT transport not connected
[13:53:26][RFQK]      77156 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:27][RFQK]      78188 T: MQTT connected
[13:53:27][RFQK]      78196 T: Subscribed to topic: RFQUACK/in/#
[13:53:27][RFQK]      78207 T: Subscribed to topic: any/in/#
[13:53:28][RFQK]      79306 W: MQTT transport not connected
[13:53:28][RFQK]      79306 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:29][RFQK]      80340 T: MQTT connected
[13:53:29][RFQK]      80349 T: Subscribed to topic: RFQUACK/in/#
[13:53:29][RFQK]      80360 T: Subscribed to topic: any/in/#
[13:53:30][RFQK]      81459 W: MQTT transport not connected
[13:53:30][RFQK]      81459 T: Connecting RFQUACK to MQTT broker 78.34.XX.XX:18XX
[13:53:31][RFQK]      82494 T: MQTT connected
[13:53:31][RFQK]      82506 T: Subscribed to topic: RFQUACK/in/#
[13:53:31][RFQK]      82516 T: Subscribed to topic: any/in/#

So they can see each other because of the serial log scrolling down in the moment I run the PyCLI and stating Subscribed to topic: RFQUACK/in/# every second or so (?) Failure loop?

wurst44 commented 2 years ago

I also had to add a stub for not beeing implemented in RFQCC1101.h?

    int16_t setFrequencyDeviation(float freqDev) override {
      freqDev = CC1101::setFrequencyDeviation(freqDev);
      return ERR_NONE;
    }
wurst44 commented 2 years ago

Same with the CLI over Serial:

ls /dev/ttyUSB*
/dev/ttyUSB0
$ docker run --device /dev/ttyUSB0 --user=root --rm -it rfquack/cli tty -P /dev/ttyUSB0

                   ,-.
               ,--' ~.).
             ,'         `.
            ; (((__   __)))      welcome to rfquack!
            ;  ( (#) ( (#)
            |   \_/___\_/|              the versatile
           ,"  ,-'    `__".             rf-hacking tool that quacks!
          (   ( ._   ____`.)--._        _
           `._ `-.`-' \(`-'  _  `-. _,-' `-/`.
            ,')   `.`._))  ,' `.   `.  ,','  ;   ~~~
          .'  .     `--'  /     ).   `.      ;
         ;     `-        /     '  )         ;           ~~~~
         \                       ')       ,'    ~~  ~
          \                     ,'       ;           ~~
           \               `~~~'       ,'               ~~~  ~~    ~~~~~
            `.                      _,'             ~~~
        hjw   `.                ,--'
        ~~~~~~~~`-._________,--'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        ------------------------------------------------------------------------

        > q.radioA.set_modem_config(
                modulation="OOK",           # Set the modulation

[...]

        exit:   just type ctrl-d a couple of times!

  Select a dongle typing: q.dongle(id)
RFQuack(/dev/ttyUSB0)> q.dongle(id)
Wrong dongle id
wurst44 commented 2 years ago

sry just found the DEBUG flag:

        exit:   just type ctrl-d a couple of times!
2021-08-29 13:14:17 1d3c12303956 rfquack.transport[1] INFO Port opened

  Select a dongle typing: q.dongle(id)2021-08-29 13:14:17 1d3c12303956 rfquack.transport[1] DEBUG b'any/in/set/ping/rfquack_VoidValue/ping' (0 bytes)
2021-08-29 13:14:17 1d3c12303956 rfquack.transport[1] DEBUG Writing packet = b'>any/in/set/ping/rfquack_VoidValue/ping~\x00'

2021-08-29 13:14:17 1d3c12303956 asyncio[1] DEBUG Using selector: EpollSelector
RFQuack(/dev/ttyUSB0)>

but no clue...

wurst44 commented 2 years ago

I removed the MQTT part and now it seems to work:

 - Dongle 0: RFQUACK

 > You have selected dongle 0: RFQUACK