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

Method _attach_device

wardriving.py:2042–2057  ·  view source on GitHub ↗

Attach the right handler for a newly-classified device.

(self, role, node)

Source from the content-addressed store, hash-verified

2040 active = subprocess.run(
2041 ['systemctl', 'is-active', '--quiet', 'gpsd.socket'],
2042 timeout=5).returncode == 0
2043
2044 try:
2045 from gps_manager import detect_gps_device
2046 dev = detect_gps_device(exclude_ports=esp_exclude or None)
2047 except Exception:
2048 dev = None
2049 # 'gpsd' is the sentinel for "gpsd already running and owns the port",
2050 # not a device path — treat as already-configured, don't re-point.
2051 if dev == 'gpsd':
2052 dev = None
2053 want = os.path.realpath(dev) if dev else None
2054 needs_setup = bool(want) and want != self._gpsd_configured_realpath()
2055
2056 if needs_setup or not active:
2057 setup = os.path.join(os.path.dirname(os.path.abspath(__file__)),
2058 'scripts', 'setup_gpsd.sh')
2059 if os.path.isfile(setup):
2060 subprocess.run(['sudo', 'bash', setup], timeout=30, check=False,

Callers 1

_device_monitor_loopMethod · 0.95

Calls 4

attachMethod · 0.80
infoMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected