Disabling CTS/DTR Clarification.
I've got the latest ser2net working (with the yaml config file).
If you read man ser2net, you see the lines
setportconfig <network port> <config>
Set the port configuration as in the device configuration in the /etc/ser2net/ser2net.yaml file.
If conflicting options are specified, the last option will be the one used. Note that these will
not change until the port is disconnected and connected again. Options 300, 1200, 2400, 4800,
9600, 19200, 38400, 57600, 115200 set the various baud rates. The following speed may be avail‐
able if your system has the values defined and your hardware supports it: 230400, 460800, 500000,
576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000. Parity,
databits, and stopbits may be specified in the classical manner after the speed, as in 9600N81.
This has the following format: <speed>[N|E|O|M|S[5|6|7|8[1|2]]]. Setting serial options this way
does not work on SOL, SOL has fixed N81 serial options. EVEN, ODD, NONE (MARK and SPACE if sup‐
ported) set the parity. 1STOPBIT, 2STOPBITS set the number of stop bits. 7DATABITS, 8DATABITS
set the number of data bits. [-]XONXOFF turns on (- off) XON/XOFF support. [-]RTSCTS turns on
(- off) hardware flow control. [-]LOCAL ignores (- checks) the modem control lines (DCD, DTR,
etc.)
Specifically regarding RTSCTS and LOCAL options, these can be set from the admin interface. Is there a way to add those to the "connector" line? or are those toggled through the "options:" lines from within the config file?
Are they even settable from the config file?
On Tue, Mar 02, 2021 at 01:03:27PM -0800, William Sutton wrote:
I've got the latest ser2net working (with the yaml config file).
If you read
man ser2net, you see the linessetportconfig <network port> <config> Set the port configuration as in the device configuration in the /etc/ser2net/ser2net.yaml file. If conflicting options are specified, the last option will be the one used. Note that these will not change until the port is disconnected and connected again. Options 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 set the various baud rates. The following speed may be avail‐ able if your system has the values defined and your hardware supports it: 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000. Parity, databits, and stopbits may be specified in the classical manner after the speed, as in 9600N81. This has the following format: <speed>[N|E|O|M|S[5|6|7|8[1|2]]]. Setting serial options this way does not work on SOL, SOL has fixed N81 serial options. EVEN, ODD, NONE (MARK and SPACE if sup‐ ported) set the parity. 1STOPBIT, 2STOPBITS set the number of stop bits. 7DATABITS, 8DATABITS set the number of data bits. [-]XONXOFF turns on (- off) XON/XOFF support. [-]RTSCTS turns on (- off) hardware flow control. [-]LOCAL ignores (- checks) the modem control lines (DCD, DTR, etc.)Specifically regarding RTSCTS and LOCAL options, these can be set from the admin interface. Is there a way to add those to the "connector" line? or are those toggled through the "options:" lines from within the config file?
Yes, they are settable on the connector line. They are not documented here because they are documented in the gensio.5 documentation, which describes all the many connector (and accepter) definitions.
If you do "man 5 gensio" and search for serialdev, you will find the information you need.
I'm not sure what to do about this, because ser2net has really just become a program to connect gensio accepters to gensio connectors and a lot of the capability is documented in the gensio man page.
-corey
Are they even settable from the config file?
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/46
Thanks for that quick reply. Unfortunately, that doesn't solve my problem either.
Looking deeper into the code
for (i = 0; controls[i]; i++) {
if (strcmp(controls[i], "RTSHI") == 0)
sergensio_rts(sio, SERGENSIO_RTS_ON, NULL, NULL);
else if (strcmp(controls[i], "RTSLO") == 0)
sergensio_rts(sio, SERGENSIO_RTS_OFF, NULL, NULL);
else if (strcmp(controls[i], "DTRHI") == 0)
sergensio_rts(sio, SERGENSIO_DTR_ON, NULL, NULL);
else if (strcmp(controls[i], "DTRLO") == 0)
sergensio_rts(sio, SERGENSIO_DTR_OFF, NULL, NULL);
else
controller_outputf(cntlr, "error",
"Invalid device control - %s", controls[i]);
}
from portinfo.c stands out as manually setting the RTS and DTR pins.
I didn't see any easy way of setting them in the "options" area, nor in the gensio documentation.
It also appears those get reset after each connection.
I see the openstr: option exists. Could that be mangled/made to set the RTS and DTR pins to a certain state on each connection? Or would a separate set of functions make that work? Much like one would using the "setportcontrol" command?
On Tue, Mar 02, 2021 at 01:40:47PM -0800, William Sutton wrote:
Thanks for that quick reply. Unfortunately, that doesn't solve my problem either.
Looking deeper into the code
for (i = 0; controls[i]; i++) { if (strcmp(controls[i], "RTSHI") == 0) sergensio_rts(sio, SERGENSIO_RTS_ON, NULL, NULL); else if (strcmp(controls[i], "RTSLO") == 0) sergensio_rts(sio, SERGENSIO_RTS_OFF, NULL, NULL); else if (strcmp(controls[i], "DTRHI") == 0) sergensio_rts(sio, SERGENSIO_DTR_ON, NULL, NULL); else if (strcmp(controls[i], "DTRLO") == 0) sergensio_rts(sio, SERGENSIO_DTR_OFF, NULL, NULL); else controller_outputf(cntlr, "error", "Invalid device control - %s", controls[i]); }from portinfo.c stands out as manually setting the RTS and DTR pins.
Ah, I misunderstood. There is no way currently to manually set the DTR and RTS pins from the config file. I had not envisioned a need for this.
So you want, when a connection comes in, to manually changes the DTR and RTS lines to specific values, right? Or is it something else?
-corey
I didn't see any easy way of setting them in the "options" area, nor in the gensio documentation.
It also appears those get reset after each connection.
I see the
openstr:option exists. Could that be mangled/made to set the RTS and DTR pins to a certain state on each connection? Or would a separate set of functions make that work? Much like one would using the "setportcontrol" command?-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/46#issuecomment-789239383
Thats precisely what I'd like to do. Some devices use the setting of DTR/RTS to actually put the device into a "wait for new firmware" mode, which means it can't be communicated with until those two lines are asserted in a specific way.
Ok, I'll try to get something tonight. It shouldn't be too hard.
-corey
On Tue, Mar 02, 2021 at 02:30:20PM -0800, William Sutton wrote:
Thats precisely what I'd like to do. Some devices use the setting of DTR/RTS to actually put the device into a "wait for new firmware" mode, which means it can't be communicated with until those two lines are asserted in a specific way.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/46#issuecomment-789267071
On Tue, Mar 02, 2021 at 02:30:20PM -0800, William Sutton wrote:
Thats precisely what I'd like to do. Some devices use the setting of DTR/RTS to actually put the device into a "wait for new firmware" mode, which means it can't be communicated with until those two lines are asserted in a specific way.
That's certainly a reasonable request. It was also pretty easy to fix.
The changes are in to both the 2.2.x branch and the master branch in git. This was all in the gensio library. You have a dtr=on/off and rts=on/off option for the serialdev connector.
-corey
Wow that was fast!
Thanks for that!
I'll get a test going and see how it all works out.
On Tue, Mar 02, 2021 at 04:58:58PM -0800, William Sutton wrote:
Wow that was fast!
Thanks for that!
I am stuck in a somewhat boring video conference. This was kind of a mindless change to do and a welcome distraction :).
I'll get a test going and see how it all works out.
Thanks for testing.
-corey
My Slaesh is working with the DTR/RTS changes mentioned above.
I had to turn off both DTR and RTS to make it work.
Here is my connection in ser2net.yaml:
connection: &con01 accepter: tcp,20108 connector: serialdev,/dev/ttyUSB0,115200n81,local,dtr=off,rts=off options: kickolduser: true
On Mon, Mar 08, 2021 at 10:48:02AM -0800, Will Scales wrote:
My Slaesh is working with the DTR/RTS changes mentioned above.
I had to turn off both DTR and RTS to make it work.
Here is my connection in ser2net.yaml:
connection: &con01 accepter: tcp,20108 connector: serialdev,/dev/ttyUSB0,115200n81,local,dtr=off,rts=off options: kickolduser: true
Thanks for the report.
-corey
A followup. This solution with the Slaesh stick only seems to work on x86. I've tried it with archlinuxarm (using the same build procedure as the official package) on both a Pine64 and a Raspi. In both the armv7h and aarch64 architectures, something is amiss.
A sanity check with a bog standard cp2102 serial adapter and telnet with a bit of wire going from TX to RX works just fine.
I'm not sure what the issue and difference is.
On Thu, Apr 01, 2021 at 12:11:05PM -0700, William Sutton wrote:
A followup. This solution with the Slaesh stick only seems to work on x86. I've tried it with archlinuxarm (using the same build procedure as the official package) on both a Pine64 and a Raspi. In both the armv7h and aarch64 architectures, something is amiss.
A sanity check with a bog standard cp2102 serial adapter and telnet with a bit of wire going from TX to RX works just fine.
I'm not sure what the issue and difference is.
I have no idea. There is no arch-specific code around any of this. The only thing I can think of is driver differences in different kernel versions.
That's what i was afraid of. Maybe I'll replace my arm boards with some tiny x86s
On Thu, Apr 1, 2021, 5:19 PM Corey Minyard @.***> wrote:
On Thu, Apr 01, 2021 at 12:11:05PM -0700, William Sutton wrote:
A followup. This solution with the Slaesh stick only seems to work on x86. I've tried it with archlinuxarm (using the same build procedure as the official package) on both a Pine64 and a Raspi. In both the armv7h and aarch64 architectures, something is amiss.
A sanity check with a bog standard cp2102 serial adapter and telnet with a bit of wire going from TX to RX works just fine.
I'm not sure what the issue and difference is.
I have no idea. There is no arch-specific code around any of this. The only thing I can think of is driver differences in different kernel versions.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cminyard/ser2net/issues/46#issuecomment-812178684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABN74PEZPKUS6EJUWPKLPDTGTPNXANCNFSM4YPXM5SQ .
The Slaesh stick is working on my Raspberry Pi 3 Model B Rev 1.2.
I'm running HA core-2021.3.4 (kvm guest on x86). Zigbee2mqtt Edge Add-on. The Slaesh stick is plugged in to a Pi3 running Raspbian 10.
On Thu, Apr 01, 2021 at 12:11:04PM -0700, William Sutton wrote:
A followup. This solution with the Slaesh stick only seems to work on x86. I've tried it with archlinuxarm (using the same build procedure as the official package) on both a Pine64 and a Raspi. In both the armv7h and aarch64 architectures, something is amiss.
A sanity check with a bog standard cp2102 serial adapter and telnet with a bit of wire going from TX to RX works just fine.
I'm not sure what the issue and difference is.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/46#issuecomment-812113899
Interesting. Perhaps its an archlinuxarm thing then. I wonder what the difference is.
On Thu, Apr 1, 2021 at 7:57 PM Will Scales @.***> wrote:
The Slaesh stick is working on my Raspberry Pi 3 Model B Rev 1.2.
I'm running HA core-2021.3.4 (kvm guest on x86). Zigbee2mqtt Edge Add-on. The Slaesh stick is plugged in to a Pi3 running Rasbian 10.
On Thu, Apr 01, 2021 at 12:11:04PM -0700, William Sutton wrote:
A followup. This solution with the Slaesh stick only seems to work on x86. I've tried it with archlinuxarm (using the same build procedure as the official package) on both a Pine64 and a Raspi. In both the armv7h and aarch64 architectures, something is amiss.
A sanity check with a bog standard cp2102 serial adapter and telnet with a bit of wire going from TX to RX works just fine.
I'm not sure what the issue and difference is.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/46#issuecomment-812113899
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cminyard/ser2net/issues/46#issuecomment-812238249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABN74OLJBEACBXF3WTH5PTTGUB5BANCNFSM4YPXM5SQ .
-- No trees were harmed in the sending of this message, but a rather large number of electrons were terribly inconvenienced.
I built the latest ser2net and gensio on a Pi4 running archlinuxarm, and the Slaesh stick didn't work.
Then I switched to the 2.2.x branch of gensio and it now works.
On Fri, Apr 02, 2021 at 10:38:42AM -0700, Will Scales wrote:
I built the latest ser2net and gensio on a Pi4 running archlinuxarm, and the Slaesh stick didn't work.
Then I switched to the 2.2.x branch of gensio and it now works.
I wonder what I broke. I'm reproducing some bad behavior on am ARM system I have, I'll see what the issue is.
-corey
Even though the 2.2.x branch is working, the lock file is missing a '/':
It creates lock file /var/lockLCK..ttyUSB0
With the master branch of gensio the lock file is correct (/var/lock/LCK..ttyUSB0)
On Fri, Apr 02, 2021 at 10:38:42AM -0700, Will Scales wrote:
I built the latest ser2net and gensio on a Pi4 running archlinuxarm, and the Slaesh stick didn't work.
Then I switched to the 2.2.x branch of gensio and it now works.
Did you rebulid ser2net after installing the new gensio? There are some changes that require a recompile.
-corey
Yes. I did a "make clean", then re-ran the configure script, then rebuilt ser2net