Compare commits

..

11 Commits

Author SHA1 Message Date
Kevin Hester
e84fd77346 1.2.40 2021-05-30 10:13:14 +08:00
Kevin Hester
3d6de0c9d1 1.2.39 2021-05-30 10:11:39 +08:00
Kevin Hester
1fa5277a0c update protos 2021-05-30 10:11:39 +08:00
Kevin Hester
8c8dff97e4 Merge pull request #97 from jfirwin/patch-1
remove S from genPSKS256 on line 329
2021-05-30 10:10:16 +08:00
Foster Irwin
1242b090b9 remove S from genPSKS256 on line 329
Found [here](https://meshtastic.discourse.group/t/ch-add-admin-not-working-on-1-2-36/3432) on the forum.
2021-05-29 14:55:09 -06:00
Kevin Hester
ef05162169 1.2.36 2021-05-28 10:50:51 +08:00
Kevin Hester
b734b9f009 fix #95, somehow a S got inserted ;-) (thanks @jfirwin) 2021-05-28 10:49:55 +08:00
Kevin Hester
037d29e200 Merge pull request #94 from jdstroy/fix-help-text
Fix the text for --subnet in the help text
2021-05-26 10:39:23 +08:00
Kevin Hester
5972004dc0 Merge pull request #93 from jdstroy/serial-interface-hack-for-wsl
Add detection for WSL1 in SerialInterface
2021-05-26 10:38:55 +08:00
jdstroy
13a84500c6 Fix the text for --subnet in the help text 2021-05-25 08:05:37 +00:00
jdstroy
88254ff0c1 Add detection for WSL1 in SerialInterface
WSL1 shares the same (buggy) driver behavior as the underlying Windows/NT platform; thus, the RTS/RTR workaround applied to Windows and OS X applies to WSL1, too.
2021-05-25 07:38:03 +00:00
7 changed files with 103 additions and 32 deletions

View File

@@ -155,6 +155,8 @@ import base64
import platform
import socket
import timeago
import os
import stat
from . import mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, environmental_measurement_pb2, remote_hardware_pb2, channel_pb2, radioconfig_pb2, util
from .util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout
from .node import Node
@@ -1010,18 +1012,40 @@ class SerialInterface(StreamInterface):
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
self.stream.port = devPath
# OS-X/Windows seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin). Since it is going to drive it anyways we want to make
# sure it is driven low, so that the TBEAM won't reset
# Linux does this properly, so don't apply this hack (because it makes the reset button not work)
if platform.system() != 'Linux':
# HACK: If the platform driving the serial port is unable to leave the RTS pin in high-impedance
# mode, set RTS to false so that the device platform won't be reset spuriously.
# Linux does this properly, so don't apply this hack on Linux (because it makes the reset button not work).
if self._hostPlatformAlwaysDrivesUartRts():
self.stream.rts = False
self.stream.open()
StreamInterface.__init__(
self, debugOut=debugOut, noProto=noProto, connectNow=connectNow)
"""true if platform driving the serial port is Windows Subsystem for Linux 1."""
def _isWsl1(self):
# WSL1 identifies itself as Linux, but has a special char device at /dev/lxss for use with session control,
# e.g. /init. We should treat WSL1 as Windows for the RTS-driving hack because the underlying platfrom
# serial driver for the CP21xx still exhibits the buggy behavior.
# WSL2 is not covered here, as it does not (as of 2021-May-25) support the appropriate functionality to
# share or pass-through serial ports.
try:
# Claims to be Linux, but has /dev/lxss; must be WSL 1
return platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss').st_mode);
except:
# Couldn't stat /dev/lxss special device; not WSL1
return False;
def _hostPlatformAlwaysDrivesUartRts(self):
# OS-X/Windows seems to have a bug in its CP21xx serial drivers. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin).
# TODO: When WSL2 supports USB passthrough, this will get messier. If/when WSL2 gets virtual serial
# ports that "share" the Windows serial port (and thus the Windows drivers), this code will need to be
# updated to reflect that as well -- or if T-Beams get made with an alternate USB to UART bridge that has
# a less buggy driver.
return platform.system() != 'Linux' or self._isWsl1();
class TCPInterface(StreamInterface):
"""Interface class for meshtastic devices over a TCP link"""
@@ -2346,17 +2370,40 @@ debugOut {stream} – If a stream is provided, any debug serial output from
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
self.stream.port = devPath
# OS-X/Windows seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin). Since it is going to drive it anyways we want to make
# sure it is driven low, so that the TBEAM won't reset
# Linux does this properly, so don't apply this hack (because it makes the reset button not work)
if platform.system() != 'Linux':
# HACK: If the platform driving the serial port is unable to leave the RTS pin in high-impedance
# mode, set RTS to false so that the device platform won't be reset spuriously.
# Linux does this properly, so don't apply this hack on Linux (because it makes the reset button not work).
if self._hostPlatformAlwaysDrivesUartRts():
self.stream.rts = False
self.stream.open()
StreamInterface.__init__(
self, debugOut=debugOut, noProto=noProto, connectNow=connectNow)</code></pre>
self, debugOut=debugOut, noProto=noProto, connectNow=connectNow)
&#34;&#34;&#34;true if platform driving the serial port is Windows Subsystem for Linux 1.&#34;&#34;&#34;
def _isWsl1(self):
# WSL1 identifies itself as Linux, but has a special char device at /dev/lxss for use with session control,
# e.g. /init. We should treat WSL1 as Windows for the RTS-driving hack because the underlying platfrom
# serial driver for the CP21xx still exhibits the buggy behavior.
# WSL2 is not covered here, as it does not (as of 2021-May-25) support the appropriate functionality to
# share or pass-through serial ports.
try:
# Claims to be Linux, but has /dev/lxss; must be WSL 1
return platform.system() == &#39;Linux&#39; and stat.S_ISCHR(os.stat(&#39;/dev/lxss&#39;).st_mode);
except:
# Couldn&#39;t stat /dev/lxss special device; not WSL1
return False;
def _hostPlatformAlwaysDrivesUartRts(self):
# OS-X/Windows seems to have a bug in its CP21xx serial drivers. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin).
# TODO: When WSL2 supports USB passthrough, this will get messier. If/when WSL2 gets virtual serial
# ports that &#34;share&#34; the Windows serial port (and thus the Windows drivers), this code will need to be
# updated to reflect that as well -- or if T-Beams get made with an alternate USB to UART bridge that has
# a less buggy driver.
return platform.system() != &#39;Linux&#39; or self._isWsl1();</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">

View File

File diff suppressed because one or more lines are too long

View File

@@ -68,6 +68,8 @@ import base64
import platform
import socket
import timeago
import os
import stat
from . import mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, environmental_measurement_pb2, remote_hardware_pb2, channel_pb2, radioconfig_pb2, util
from .util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout
from .node import Node
@@ -923,18 +925,40 @@ class SerialInterface(StreamInterface):
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
self.stream.port = devPath
# OS-X/Windows seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin). Since it is going to drive it anyways we want to make
# sure it is driven low, so that the TBEAM won't reset
# Linux does this properly, so don't apply this hack (because it makes the reset button not work)
if platform.system() != 'Linux':
# HACK: If the platform driving the serial port is unable to leave the RTS pin in high-impedance
# mode, set RTS to false so that the device platform won't be reset spuriously.
# Linux does this properly, so don't apply this hack on Linux (because it makes the reset button not work).
if self._hostPlatformAlwaysDrivesUartRts():
self.stream.rts = False
self.stream.open()
StreamInterface.__init__(
self, debugOut=debugOut, noProto=noProto, connectNow=connectNow)
"""true if platform driving the serial port is Windows Subsystem for Linux 1."""
def _isWsl1(self):
# WSL1 identifies itself as Linux, but has a special char device at /dev/lxss for use with session control,
# e.g. /init. We should treat WSL1 as Windows for the RTS-driving hack because the underlying platfrom
# serial driver for the CP21xx still exhibits the buggy behavior.
# WSL2 is not covered here, as it does not (as of 2021-May-25) support the appropriate functionality to
# share or pass-through serial ports.
try:
# Claims to be Linux, but has /dev/lxss; must be WSL 1
return platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss').st_mode);
except:
# Couldn't stat /dev/lxss special device; not WSL1
return False;
def _hostPlatformAlwaysDrivesUartRts(self):
# OS-X/Windows seems to have a bug in its CP21xx serial drivers. It ignores that we asked for no RTSCTS
# control and will always drive RTS either high or low (rather than letting the CP102 leave
# it as an open-collector floating pin).
# TODO: When WSL2 supports USB passthrough, this will get messier. If/when WSL2 gets virtual serial
# ports that "share" the Windows serial port (and thus the Windows drivers), this code will need to be
# updated to reflect that as well -- or if T-Beams get made with an alternate USB to UART bridge that has
# a less buggy driver.
return platform.system() != 'Linux' or self._isWsl1();
class TCPInterface(StreamInterface):
"""Interface class for meshtastic devices over a TCP link"""

View File

@@ -64,7 +64,7 @@ trueTerms = {"t", "true", "yes"}
falseTerms = {"f", "false", "no"}
def genPSKS256():
def genPSK256():
return os.urandom(32)
@@ -326,7 +326,7 @@ def onConnected(interface):
if not ch:
raise Exception("No free channels were found")
chs = channel_pb2.ChannelSettings()
chs.psk = genPSKS256()
chs.psk = genPSK256()
chs.name = args.ch_add
ch.settings.CopyFrom(chs)
ch.role = channel_pb2.Channel.Role.SECONDARY
@@ -647,7 +647,7 @@ def initParser():
parser.add_argument('--tunnel',
action='store_true', help="Create a TUN tunnel device for forwarding IP packets over the mesh")
parser.add_argument(
"--subnet", dest='tunnel_net', help="Read from a GPIO mask", default=None)
"--subnet", dest='tunnel_net', help="Sets the local-end subnet address for the TUN IP bridge", default=None)
parser.set_defaults(deprecated=None)

View File

File diff suppressed because one or more lines are too long

2
proto

Submodule proto updated: f604be5bb2...f5b3d0643b

View File

@@ -12,7 +12,7 @@ with open("README.md", "r") as fh:
# This call to setup() does all the work
setup(
name="meshtastic",
version="1.2.35",
version="1.2.40",
description="Python API & client shell for talking to Meshtastic devices",
long_description=long_description,
long_description_content_type="text/markdown",