MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _try_gpsd

Function _try_gpsd

gps_manager.py:108–127  ·  view source on GitHub ↗

Return an open gpsd socket if gpsd is running and responsive, else None.

(host='127.0.0.1', port=2947, timeout=2)

Source from the content-addressed store, hash-verified

106 minutes = float(raw[2:])
107 else:
108 degrees = int(raw[:3])
109 minutes = float(raw[3:])
110 decimal = degrees + minutes / 60.0
111 if direction in ('S', 'W'):
112 decimal = -decimal
113 return round(decimal, 7)
114 except (ValueError, IndexError):
115 return None
116
117
118def _port_is_espressif(port):
119 """Return True iff udev reports an Espressif device on `port`.
120
121 Used to distinguish ESP32 companions (Huginn/Piglet) from other serial
122 devices that share USB-UART bridge chips (CP210x, CH340) — the chip alone
123 isn't enough to identify ESP32, the device-level strings are.
124 """
125 try:
126 import subprocess
127 r = subprocess.run(
128 ['udevadm', 'info', '-a', port],
129 capture_output=True, text=True, timeout=3
130 )

Callers 4

detect_gps_deviceFunction · 0.85
_start_gpsdMethod · 0.85
attachMethod · 0.85
_reconnect_gpsdMethod · 0.85

Calls 3

connectMethod · 0.45
decodeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected