Re: UnicodeDecodeError from tty.readline(), u-Blox 8
Gary said: > Weird... Since ttyACM0 is USB, maybe a driver thing. Yes, I'm using the USB port rather than the serial port. The question is: Which driver? Linux or U-Blox? -- These are my opinions. I hate spam. ___ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel
Re: UnicodeDecodeError from tty.readline(), u-Blox 8
Yo Hal! On Sat, 03 Jun 2023 21:53:34 -0700 Hal Murray via devel wrote: > Gary said: > > To open to read binary: > > tty = open("/dev/ttyACM0", "rb") > > The line will be binary. Getting just the NMEA out will be fun. > > Thanks. That's what I needed. Good. > There is no problem getting just the NMEA. I'm using isASCII to > detect the garbage cases. Cool. > I get things like: > ### Not ASCII 2023 Jun 3, 22:46:41 UTC > ### > "$GLG\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\x > cd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\ > xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd > \xcd\xcd\xcd$GLGSV,3,3,11,87,43,333,,88,01,306,,90,13,029,*5A" > > I get several bogus lines each day. I haven't seen anything other > then 0xcd in the non-ASCII part. Weird... Since ttyACM0 is USB, maybe a driver thing. RGDS GARY --- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 g...@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can't measure it, you can't improve it." - Lord Kelvin pgpNWqbZhyEPG.pgp Description: OpenPGP digital signature ___ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel
Re: UnicodeDecodeError from tty.readline(), u-Blox 8
Gary said: > To open to read binary: > tty = open("/dev/ttyACM0", "rb") > The line will be binary. Getting just the NMEA out will be fun. Thanks. That's what I needed. There is no problem getting just the NMEA. I'm using isASCII to detect the garbage cases. I get things like: ### Not ASCII 2023 Jun 3, 22:46:41 UTC ### "$GLG\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\x cd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\ xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \xcd\xcd\xcd$GLGSV,3,3,11,87,43,333,,88,01,306,,90,13,029,*5A" I get several bogus lines each day. I haven't seen anything other then 0xcd in the non-ASCII part. -- These are my opinions. I hate spam. ___ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel
Re: UnicodeDecodeError from tty.readline(), u-Blox 8
Yo Hal! On Mon, 29 May 2023 15:22:43 -0700 Hal Murray via devel wrote: > Can somebody give me a lesson on this area? > > The code is: > tty = open("/dev/ttyACM0") > forever: > line = tty.readline() > a) How do I read mostly ASCII without crashing when there is > non-ASCII? To open to read binary: tty = open("/dev/ttyACM0", "rb") The line will be binary. Getting just the NMEA out will be fun. > b) Why is a u-Blox LEA-M8T sending me non-ASCII crap? Becasue it wants to. Becasue UBX is better than NMEA. > This is coming from the USB port. It's running in NMEA mode. > I don't think I have sent it any commands. From u-blox8-M8_ReceiverDescrProtSpec_UBX-13003221.pdf: "By default all ports are configured for UBX and NMEA protocols." RGDS GARY --- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 g...@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can't measure it, you can't improve it." - Lord Kelvin pgphJpZk9Bk6j.pgp Description: OpenPGP digital signature ___ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel
UnicodeDecodeError from tty.readline(), u-Blox 8
Can somebody give me a lesson on this area? The code is: tty = open("/dev/ttyACM0") forever: line = tty.readline() a) How do I read mostly ASCII without crashing when there is non-ASCII? b) Why is a u-Blox LEA-M8T sending me non-ASCII crap? This is coming from the USB port. It's running in NMEA mode. I don't think I have sent it any commands. -- These are my opinions. I hate spam. ___ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel