×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Another GPSD port problem - Solved

  • Posts: 84
  • Thank you received: 27
Hi,
I've having problems with GPSD preventing connection to my OnStep controller - RPi4 running current 32-bit Raspberry Pi OS, indi compiled from source (commit 29056dfe1eb0db45b0e9cfa2ea93dd1155044174).
OnStep is via a CP2102 on ttyUSB0.
GPS dongle is via a PL2303 on ttyUSB1.
Port allocations are controlled by two udev rules (OnStep is allocated by physical connection as it will be permanently connected):/etc/default/gpsdlsof /dev/ttyUSB0 returns empty but OnStep connect fine if I boot without the GPS dongle attached.
What can I do next to investigate/fix this?
Thanks in advance.
2 years 2 months ago #80225

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 27

Replied by Ed Lee on topic Another GPSD port problem

Two additional data points on this...

1. I have the Arduino IDE installed on the Pi as well. I booted with the GPS dongle attached. Checked using xgps that gpsd is using ttyUSB1, closed xpgs. Checked that Indi can not connect to OnStep, closed Indi/Ekos/KStars. Opened the Arduino IDE Serial Monitor - I can talk to OnStep fine - :GVP# (and any other command) returns as expected.
Rebooted (Pi & OnStep - see 2 below) and opened xgps and left running. Opened the Arduino IDE Serial Monitor, and yep OnStep comms is fine. Shut down both Arduino IDE and xgps and check Indi - nope it can't open ttyUSB0.

2. Through this testing I've found that once I've had an Indi failure to connect to OnStep due to the GPS dongle presence, cold rebooting the Pi without the GPS dongle is not enough to clear the problem. I have to reboot the OnStep controller as well. So it seems the 'bad comms' are affecting the OnStep MCU.

It seems as though my udev/gpsd configuration is working as expected for everything except Indi - could this be some subtle bug in the Indi gpsd or OnStep drivers?
2 years 2 months ago #80272

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 27
I got some more time to try to debug this during the week. Turned on with the same setup, and it worked. No changes made but as long as I connect everything before powering on it now works consistently. Haven't had the Pi connected to the internet or changed any local files but it's magically fixed.
2 years 1 month ago #80732

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 27

Replied by Ed Lee on topic Another GPSD port problem

And today it's back again! Maybe some sort of race condition. I'll keep investigating.
2 years 1 month ago #80769

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I'm not sure I'm following 100%, but is it possible that gpsd is sending a command to OnStep that makes it unresponsive, causing it to not respond until it is rebooted? Like is gpsd scanning all serial ports and blindly sending commands?
2 years 1 month ago #80773

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 27

Replied by Ed Lee on topic Another GPSD port problem

It's possible. It shouldn't though - I've disabled the gpsd auto start and port auto detect and verified that it only opens when indi starts it's driver.
It's so intermittent I think it's going to take some time to track down.
2 years 1 month ago #80799

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 27
I think I've found and fixed this issue now. I'm just updating here for future reference.
The cause of my problems was udev rules. Probably my lack of understanding of precedence and priorities with how the rules are applied. No matter what I wrote as a rule I can't force the ttyUSB0 / ttyUSB1 allocation to be consistent. I think there are complex system defined rules that override what I was specifying.
I've overcome this by changing my udev rules to create a consistent symlink (a bit like a shortcut in Windows speak) to each device regardless of which ttyUSB# the system allocates.
My udev rules to do this are:
   KERNEL=="ttyUSB*", KERNELS=="1-1.3:1.0", SYMLINK="OnStep"
I used the KERNELS=="1-1.3:1.0 as I have hard wired the OnStep controller to a specific USB port on my Pi and this identifies the device by which port it is connected to. As my OnStep controller uses a CP2102 for the serial interface I could have used:

   ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK="OnStep"

...but this would prevent me using any other CP2101 devices at the same time and you never know what toy's next.
And for the my GPS dongle, which uses a PL2303 internally the rule is:

   KERNEL=="ttyUSB*", DRIVERS=="pl2303", SYMLINK="MyGPS"

This does suffer the drawback that I can't use another PL2303 connected device at the same time but I'll have to live with that. The GPS dongle could be plugged into any available port on the Pi or (more likely) my external hub, each of which will get a different KERNELS=="1-2.3:1.0" style bus address so that identification scheme can't be used in this case.
I then set the OnStep connection port in Indi to /dev/OnStep and the /etc/default/gpsd to:

   # Devices gpsd should collect to at boot time.
   # They need to be read/writeable, either by user gpsd or the group dialout.
   DEVICES="/dev/MyGPS"

   # Other options you want to pass to gpsd
   GPSD_OPTIONS=""

   # Automatically hot add/remove USB GPS devices via gpsdctl
   USBAUTO="false"


This works for me. The OnStep controller comes up at ttyUSB0 most of the time but about one boot in five it's ttyUSB1. This no longer matters as I always get the (symlinked) ports required.
Last edit: 2 years 1 month ago by Ed Lee. Reason: Block quotes not showing up
2 years 1 month ago #80990

Please Log in or Create an account to join the conversation.

Time to create page: 0.709 seconds