Jump to content

30 secs banner.jpg

EKOS Unable to connect to LX200GPS - [WARNING] Port /dev/ttyUSB0 is already used by another driver or process.


Recommended Posts

I'm running astroberry and attempting to control an LX200GPS via Kstars/Ekos.

The scope is aligned, connected to the Raspberry pi via a USB cable

Whenever I start the pi and try to connect from Kstars I see the error message that the USB port is already in use...

I have to manually stop GPSD every time I restart the pi and then Kstars can connect and control the scope without issue.

Is there any way I can get the connection to work automatically without having to do this?

Link to post
Share on other sites

There is, kind of :)

The problem is that Linux assigns USB serial devices in the order that they connect and when that happens at boot time with more than one device it can be somewhat random, so given two USB serial devices, one may appear as /dev/ttyUSB0 at some point and then /dev/ttyUSB1 after a reboot.

My solution, regardless of Ekos etc., would be to hack the udev rules files to add a symbolic link with a fixed name for each of the clashing devices.  I'm not sure if that's the right way to do it in an Astroberry context though.  StellarMate has some extra "wizard" to help with this, so Astroberry may also have something.

This thread may help a little, though I ended up ranting at INDI a bit :)

 

James

Link to post
Share on other sites

Yep, udev rules should fix this. You will want to make sure that autodetection is turned off and you explicitly select the port, or you can still get collisions if drivers end up connecting or trying to connect to the wrong thing at start time.

Link to post
Share on other sites

I'll give that a try, but I suspect I'll just get a different port in use error because there is only one USB device- it's the cable connecting to the scope....

gpsd seems to think the scope will behave like a GPS device and therefore binds to the port even though when I try to get data from it with a GPS client (cgps or xgps) neither can connect.

The scope is getting a GPS fix, and updates KStars with the correct location data- so the built in GPS is working and once I've stopped gpsd everything works OK....I just want to stop gpsd reacting to this device.

Link to post
Share on other sites

I don’t know if I need gods at all- the scope doesn’t update the OSwith location data so if I disable virtualgps and gpsd- I guess other apps might not work as expected- butI don’t think that’s a major issue.

If there’s a way to keep gpsd running but avoid it locking this device I don’t have any problems.-it would probably be the best outcome.

I’ll see what I can do with user rules first.

Link to post
Share on other sites

I'm snookered....

adding a udev rule to make a permanent symlink didn't work

disabling gpsd.service and gpsd.socket via systemctl didn't work- they start up again after a reboot and I can't seem to stop that happening (short of uninstalling the packages I guess)

I'm planning on using the pi as an indiserver controlling the devices from a Ekos on either Windows or Mac desktop so I'd really like to avoid having to connect to it directly simply to stop the gpsd service each time I startup...but I can't think of any alternative right now.

Link to post
Share on other sites

Edit: Interesting, I can't post to this with some content...

I don't suppose the LX200 will be returning GPS data in a format that gpsd can take advantage of anyway, so I'd disable it.

If you want a GPS, then USB GPS devices that work with Linux can be had for <£20 on eBay or even Amazon et al. gpsd can be forced to look at a specific serial port and not autodetect with a startup parameter, normally configured in etc default gpsd. Otherwise systemctl disable gpsd would do the trick, so long as you've got an internet connection for time.

For good time sync, gpsd can do basic clock control but you're much better off configuring ntpd or chrony to treat gpsd as a clock source as they'll do a much better job of regulating your clock. If you get a board-level GPS module or hat you can also configure chrony or ntpd to use the pulse-per-second input from a GPS module to properly discipline the clock, making your Pi a "stratum 1" reference with very good stability for very little money!
https://thepihut.com/products/raspberry-pi-gps-hat

This is probably the easiest solution to achieve that - it's a GPS module hat to drop onto a Pi, but also has an RTC, all the wiring needed for the PPS pin already done, and an external antenna port. The RTC means that even without a GPS fix or internet the Pi can get reasonably-close time quickly.

Edit: OK, so the forums for some reason block paths like etc default gpsd.conf if you have / in them. Guessing some very overzealous web application firewall...

Edited by discardedastro
Link to post
Share on other sites
1 hour ago, discardedastro said:

Edit: Interesting, I can't post to this with some content...

I don't suppose the LX200 will be returning GPS data in a format that gpsd can take advantage of anyway, so I'd disable it.

If you want a GPS, then USB GPS devices that work with Linux can be had for <£20 on eBay or even Amazon et al. gpsd can be forced to look at a specific serial port and not autodetect with a startup parameter, normally configured in etc default gpsd. Otherwise systemctl disable gpsd would do the trick, so long as you've got an internet connection for time.

For good time sync, gpsd can do basic clock control but you're much better off configuring ntpd or chrony to treat gpsd as a clock source as they'll do a much better job of regulating your clock. If you get a board-level GPS module or hat you can also configure chrony or ntpd to use the pulse-per-second input from a GPS module to properly discipline the clock, making your Pi a "stratum 1" reference with very good stability for very little money!
https://thepihut.com/products/raspberry-pi-gps-hat

This is probably the easiest solution to achieve that - it's a GPS module hat to drop onto a Pi, but also has an RTC, all the wiring needed for the PPS pin already done, and an external antenna port. The RTC means that even without a GPS fix or internet the Pi can get reasonably-close time quickly.

Edit: OK, so the forums for some reason block paths like etc default gpsd.conf if you have / in them. Guessing some very overzealous web application firewall...

Thanks for the suggestion.

I don't need the GPS, but I can't seem to disable gpsd....if I run 'sudo systemctl stop gpsd.service && sudo systemctl disable gpsd.service' EKOS connects and everything works OK, but after a reboot of the pi I have to do the same thing again- I thought that if I disable gpsd.service it wouldn't come back up after the reboot....

I'd like to find a way to tell gpsd to ignore /dev/ttyUSB0 - but I can't find a way to do that easily. The only thing I can think of would be to build gpsd from source, but leave out the support for the usb-serial chip (cp210x) that's in cable....but that seems a bit extreme....so I guess I'll just ssh onto the pi and disable it each time I run.

It's not a massive issue, but it's a bit irritating and I can't seem to find a good way to fix it.

 

Link to post
Share on other sites
19 minutes ago, catburglar said:

Thanks for the suggestion.

I don't need the GPS, but I can't seem to disable gpsd....if I run 'sudo systemctl stop gpsd.service && sudo systemctl disable gpsd.service' EKOS connects and everything works OK, but after a reboot of the pi I have to do the same thing again- I thought that if I disable gpsd.service it wouldn't come back up after the reboot....

I'd like to find a way to tell gpsd to ignore /dev/ttyUSB0 - but I can't find a way to do that easily. The only thing I can think of would be to build gpsd from source, but leave out the support for the usb-serial chip (cp210x) that's in cable....but that seems a bit extreme....so I guess I'll just ssh onto the pi and disable it each time I run.

It's not a massive issue, but it's a bit irritating and I can't seem to find a good way to fix it.

 

Try this: sudo systemctl disable gpsd.sock

To explain a little more - both gpsd.service and gpsd.sock are things provided by gpsd to systemd, which will ensure that all the dependencies for the service/socket are met. That includes, if you just disable the service, bringing it back to ensure the socket is available.

If it's still booting up then try systemctl list-dependencies --reverse gpsd.service - this will tell you what is dependent on it and bringing it up.

Edited by discardedastro
Link to post
Share on other sites
6 minutes ago, discardedastro said:

Try this: sudo systemctl disable gpsd.sock

I'd tried that also and it kept coming back after the restart... 

BUT... I'd misread your initial post....I was looking for the gpsd conf file in etc and not in _etc_default...changed USBAUTO='false', rebooted and all is OK- gpsd is still running but it's not automatically connecting to the USB device....just what I wanted.

I don't think I'll be needing an actual GPS dongle, but if I do then at least I'll know where to put the config!

Thank you so much.

  • Like 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.