python - GPSD 未响应新连接

标签 python sockets gps gpsd

我正在使用来自 Ubuntu 的 Bionic 存储库的 GPSd v3.17-5。

我遇到了 GPSd 拒绝响应新客户端连接的问题。

以下是来自 lsof 的转储这表明 gpsmon已连接(您可以看到 gpsd 和 gpsmon 都已建立连接),但我的 python连接仅在 Python 端建立。

root@machine:~# lsof -n -P -i TCP:2947
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd    1 root   57u  IPv6  39371      0t0  TCP [::1]:2947 (LISTEN)
systemd    1 root   58u  IPv4  40365      0t0  TCP 127.0.0.1:2947 (LISTEN)
gpsd     949 gpsd    4u  IPv6  39371      0t0  TCP [::1]:2947 (LISTEN)
gpsd     949 gpsd    5u  IPv4  40365      0t0  TCP 127.0.0.1:2947 (LISTEN)
gpsd     949 gpsd    7u  IPv4  59781      0t0  TCP 127.0.0.1:2947->127.0.0.1:41656 (ESTABLISHED)
gpsmon  3289 root    3u  IPv4  60651      0t0  TCP 127.0.0.1:41656->127.0.0.1:2947 (ESTABLISHED)
python  3387 root    5u  IPv4  61892      0t0  TCP 127.0.0.1:41662->127.0.0.1:2947 (ESTABLISHED)

如果我杀了gpsmon它也无法重新连接,只能坐在那里。
root@machine:~# lsof -n -P -i TCP:2947
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd    1 root   57u  IPv6  39371      0t0  TCP [::1]:2947 (LISTEN)
systemd    1 root   58u  IPv4  40365      0t0  TCP 127.0.0.1:2947 (LISTEN)
gpsd     949 gpsd    4u  IPv6  39371      0t0  TCP [::1]:2947 (LISTEN)
gpsd     949 gpsd    5u  IPv4  40365      0t0  TCP 127.0.0.1:2947 (LISTEN)
python  3508 root    5u  IPv4  64143      0t0  TCP 127.0.0.1:55999->127.0.0.1:2947 (ESTABLISHED)
gpsmon  6157 root    3u  IPv4  64311      0t0  TCP 127.0.0.1:41678->127.0.0.1:2947 (ESTABLISHED)

我已尝试禁用 gpsd.socket通过 systemctl但重新启动后我的结果没有什么不同。第一个客户端连接似乎很好,但在那之后它是一个废话拍摄。

我不知道如何解决这个问题。有谁知道从哪里开始?journalctl -u gpsd 中没有错误或任何错误消息.

有比 GPSd 更好的东西吗?它似乎是事实上的标准,但也有不少缺点。我最大的要求是我不能手动指定 GPS 设备,因为这是 headless 服务的一部分。

感谢您的任何帮助/方向/建议。

最佳答案

监控后syslog我注意到当我插入我的 GPS 设备时,ModemManager发出无法为我的设备创建调制解调器的警告。

Oct  4 23:03:47 ubuntu ModemManager[681]: <info>  [device /sys/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2] creating modem with plugin 'u-blox' and '1' ports
Oct  4 23:03:47 ubuntu ModemManager[681]: <warn>  Could not grab port (tty/ttyACM0): 'Cannot add port 'tty/ttyACM0', unhandled serial type'
Oct  4 23:03:47 ubuntu ModemManager[681]: <warn>  Couldn't create modem for device '/sys/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2': Failed to find primary AT port

我猜ModemManager最终会接管设备,GPSd 将失去连接并永远阻塞等待响应。这完全是一种预感,但禁用 ModemManager解决了我所有的问题!
systemctl disable ModemManager.service

关于python - GPSD 未响应新连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58242803/

相关文章:

ios - 如何让 GPS 应用程序在后台不间断地运行

python - Django 不显示两个 DetailView

python - 使用scrapy获取javascript回发参数

python - Django registration-profile - 用户配置文件的下一步

linux - 套接字选项 SO_SNDLOWAT 的用途是什么

java - 在处理层映射 GPS 点

c# - 在没有 GPS 的情况下获取经纬度 (Windows Mobile)

javascript - 正常表单提交正确但ajax表单提交为空

Java Socket 客户端向设备发送额外的字节

sockets - 科尼发布服务超时