很难说做了什么,什么没做。 'official' documentation from Microstack 提供了两种设置串口的方法。然后继续
自动启动 gpsd
要在 Raspberry Pi® 启动时自动启动 gps 服务,请重新配置 GPS
通过在终端输入守护进程
sudo dpkg-reconfigure gpsd
● 当系统询问您是否要自动启动 gpsd 时选择<yes>。
● 当被问到“gpsd 是否应该处理连接的 USB GPS”时选择<no>
自动接收”。
● 当询问“GPS 接收器连接到哪个设备”时,输入
/dev/ttyAMA0 .
● 接受其他选项的默认值。
如果您按照说明配置了串行端口并且配置了 gpsd 以自动启动并拾取您刚刚设置的设备,...那么,由于 gpsd 正在处理设备(对?),设备将处于忙碌状态,并且命令 cat /dev/ttyAMA0应该返回 cat: /dev/ttyAMA0: Device or resource busy...但是,它没有。
序列号没有按照说明配置,或者 gpsd 没有运行并拾取设备,或者两者兼而有之。
目标不是 cat 你的 GPS 数据,但 cat 没有返回 错误 表明有问题。
通常,这只是一个错字。但这可能是由于跳过了流程中的一个步骤,或者混合了各种来源的指令,以致左手不知道右手做了什么。
尝试:
sudo killall gpsd 如果它返回 gpsd: no process found 则回答一个问题。
如果返回没有错误,请使用cat /dev/ttyAMA0 跟进。如果它什么都不返回,你应该看的方向是你的串口配置。
如果sudo dpkg-reconfigure gpsd 不允许您重新配置(我以为只是我),您可以使用您喜欢的编辑器修改 gpsd 的配置,例如sudo nano /etc/default/gpsd 并输入如下内容:
# Default settings for the gpsd init script and the hotplug wrapper.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyAMA0"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n -G"
您可能会发现-n 和 -G 很有用。保存并重新启动。