jayofelony / pwnagotchi-torch-plugins

Custom plugin repository
GNU General Public License v3.0
55 stars 4 forks source link

gpsdeasy fails to connect #6

Closed Helinos closed 1 month ago

Helinos commented 1 month ago

From the debug log:

INFO:root:[gpsdeasy] Connecting to gpsd socket at 192.168.44.1:6000
[2024-10-10 11:53:50,806] [INFO] [gpsdeasy] Connecting to gpsd socket at 192.168.44.1:6000
Exception ignored in thread started by: <function locked_cb at 0x7f94eb54e0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/plugins/__init__.py", line 85, in locked_cb
    cb(*args, *kwargs)
  File "/usr/local/share/pwnagotchi/custom-plugins/gpsdeasy.py", line 272, in on_loaded
    self.gpsd = GPSD(self.host, self.port, self)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/share/pwnagotchi/custom-plugins/gpsdeasy.py", line 64, in __init__
    self.connect(host=gpsdhost, port=gpsdport)
  File "/usr/local/share/pwnagotchi/custom-plugins/gpsdeasy.py", line 87, in connect
    welcome = json.loads(welcome_raw)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm attempting to use the gpsdRelay app, as it's the most recently updated gpsd app I could find on F-Droid

jayofelony commented 1 month ago

@rai68 your cup of tea I think.

Helinos commented 1 month ago

This is probably a problem with the app that I'm using as what welcome_raw is being set to is most certainly not valid JSON. I presume that this plugin could be improved if there was a proper error message in the case that this happens.

If it's useful, welcome_raw is being set to this is my case: $GPRMC,######.00,A,#####.######,N,#####.######,W,0.0,0.0,#######,,,A,V*## I replaced the numbers that I presume represent my exact location with pound signs.

rai68 commented 1 month ago

If your gpsdRelay, is some how sending raw nmea sentences then the plugin isnt gonna work at all.

rai68 commented 1 month ago

Looking at gpsdRelay, your .device = "" config should be

"tcp://192.168.44.1:6000" and .host/port should be defaults

Helinos commented 1 month ago

That did the trick, thanks for the help.