Closed dillonbuhl closed 1 year ago
Is this on the virtual machine?
sudo seems to be needed to access ttyS1, is that right?...
Yeah that's right if you haven't given yourself the right group permissions (I didn't do anything special).
Add yourself the right group permissions like so
sudo usermod -a -G dialout $USER
Logout and then log back in for the group changes to take effect.
The problem with not finding the package is that since you are sudoing, it is looking for packages in the root user's installation of pip, and pynmea2 was installed for the non-root user. So there's your problem. Try running again without sudo and see if your permission error goes away, then if it finds the package.
You can also just check if the package is installed by running python3
as each user and running import pynmea2
at the command line and see what happens.
thx, changing the user permissions worked... that's kind of interesting... didn't even realize that /dev entities had same permission structure as normal files, but of course that makes sense
Now, I'm getting this, which I can't make too much out of:
igadmin@qcvm20a:~/Downloads/navcoldex_data/navcoldex_gnss_server$ ./server.py --serial /dev/ttyS1 --format nmea --interval 1 --host 10.0.2.15 --port 4040
INFO:root:Listening on 10.0.2.15:4040
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/igadmin/.local/lib/python3.8/site-packages/serial/serialposix.py", line 398, in _reconfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "./server.py", line 160, in nmea_serial_handler
ser = serial.Serial(serialport_name, 9600, timeout=1.)
File "/home/igadmin/.local/lib/python3.8/site-packages/serial/serialutil.py", line 244, in __init__
self.open()
File "/home/igadmin/.local/lib/python3.8/site-packages/serial/serialposix.py", line 332, in open
self._reconfigure_port(force_update=True)
File "/home/igadmin/.local/lib/python3.8/site-packages/serial/serialposix.py", line 401, in _reconfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')
This would seem to indicate that /dev/ttyS1
isn't available?
Are you sure /dev/ttyS1 is where the garmin is connected?
What do you see when you go ls -l /dev/tty*
?
The /dev/ttyUSB
's might be what you're looking for. Can you try talking to the USB port using other methods?
Also referencing #2, you probably don't need the --server and --host.
same error when I don't specify the server and host...
there's a whole bunch of tty##'s and ttyS##'s listed but no ttyUSB##'s. The way I've gotten the Garmin to work for other applications is through a utility that takes in the Garmin stream and spits out NMEA on virtual serial ports.. I can see serial data coming across on com1 in windows (assuming that's the same as ttyS1, is that not true?).
Yeah server/host is irrelevant for this part of the issue.
How is VirtualBox configured to route the Windows USB device or serial port into the Guest OS?
https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/serialports.html
thanks, yeah, that's what I was thinking too just now... I'll look at it.
cat /dev/ttyS# gives input/output error for 1,2,3,4...
In #3, you said
In virtual machine's settings, enabled a single serial port assigned to COM2 in "Host Device" mode
What dev does this com2 end up mapping to in Linux?
good question, forgot to mention that for posterity... it maps to /dev/ttyS1
That even though I pointed it at port COM2. Selection of COM2 was basically arbitrary; I was pointing realterm at COM1 in windows to see the NMEA stream. GpsGate sends NMEA over virtual ports related to both COM1 and COM2.
attempting to run server.py as sudo ./server.py --serial /dev/ttyS1 --format nmea --interval 1 with Garmin NMEA coming in on multiple serial ports, including COM1. sudo seems to be needed to access ttyS1, is that right?...
getting: ModuleNotFoundError: No module named 'pynmea2'
I've installed requirements.txt explicitly. Can import pynmea2 on the python interpreter command line no problem. Any idea why it might not be able to find it?
@gregoryng