Do you get a different results with a lower DTE rate (say, 57600 bps)?
Do you get a different results with a lower DTE rate (say, 57600 bps)?
57600, 38400, 19200 look to be the same behavior.
9600 and 2400 sometimes gets an ATZ through after a retry but the caller ID fails. Much the same as when testing under strace.
I'm having an odd issue with SEXPOTS using an onboard uart (onboard Asus P5BV-M). Debian 11.
* The modem works fine in 'minicom' with the same serial port settings as sexpots and the onboard uart
* the sexpots configuration works fine with the very same modem but using a usb
<> rs232 adapter is generally reliable
Do you get a different results with a lower DTE rate (say, 57600 bps)?
57600, 38400, 19200 look to be the same behavior.
9600 and 2400 sometimes gets an ATZ through after a retry but the caller ID fails. Much the same as when testing under
strace.
Interesting. Thanks for experimenting. I don't have any immediate ideas, but you have the source and can see all the sexposts.ini settings available you could continue to experiment with. If strace makes it work (more often than not), then I agree,
it sounds like some kind of timing issue. --
that sounds like a bad UART.. I get a similar thing on my 286 if i go above 19200 even though it has an 16550A uart in it.
Have you got a usb serial dongle? do you get a similar thing?
Re: SEXPOTS timeout with onboard UART; works under strace, and with othe By: Matthew Asham to Digital Man on Sun Oct 02 2022 07:47 pm
Do you get a different results with a lower DTE rate (say, 57600 bps)?
57600, 38400, 19200 look to be the same behavior.
9600 and 2400 sometimes gets an ATZ through after a retry but the caller ID fails. Much the same as when testing under
strace.
Interesting. Thanks for experimenting. I don't have any immediate ideas, but you have the source and can see all the
sexposts.ini settings available you could continue to experiment with. If strace makes it work (more often than not), then I
agree, it sounds like some kind of timing issue.
Matthew, just replied to your email btw, sorry for the delay.
that's what I was thinking as well.. what you might want to do if you can, is play around with the size of the buffers >https://stackoverflow.com/questions/10815811/linux-serial-port-reading-can-i-c hange-size-of-input-buffer
Off hand I can't think of what sexpots is doing differently than other serial code I've poked at in the past so it remains a mystery to me. I hope to poke at it again but time constraints etc etc and I have a viable alternative for now, but for my next round I'll likely start by walking through what minicom is doing since that is my reference test case. It is odd.
Could just be some serial port/UART setting that minicom is making that sexpots is not, but is needed for reliable operation with that UART.
Matthew, just replied to your email btw, sorry for the delay.Saw that thanks! I didn't see anything in my config that looked off. No worries on the delay ;)
I performed further testing on the serial port using minicom and was able to transmit multimeg files over the course of an
hour or so with minimal errors.
I suspect if I was dealing with a dodgy uart I would not have seen success in those tests.
Off hand I can't think of what sexpots is doing differently than other serial code I've poked at in the past so it remains a
mystery to me. I hope to poke at it again but time constraints etc etc and I have a viable alternative for now, but for my
next round I'll likely start by walking through what minicom is doing since that is my reference test case. It is odd.
it should give you a *nix login where you should be able to log into the box just like ssh etc.
once mgetty is installed you can just use "mgetty -x7 <device line> -s 115200"
eg mgetty -x7 ttyS0 -s 115200
see what happens. be interesting... the -x7 is debug and that will appear in /var/log/mgetty/<logfile>
Okay - I found something else.
in modem_send() https://gitlab.synchro.net/main/sbbs/-/blob/master/src/sexpo ts/sexpots.c#L619, if I comment out the call to comPurgeInput(com_handle) - the modem initializes successfully and this is repeatable.
This happens right after the modem command is sent but before reading.
tcflush(handle, TCIFLUSH) purges the input buffer, but why would strace slow the process down (or maybe i/o in the kernel?) enough so that this purge wouldn't have an affect?
I also tried putting my modem into no echo mode (ATE0) - no affect when comPurgeInput was still present in code.
I also saw the mgetty is doing an fcntl FD_NOFL - but adding the same call to sexpots made no difference.
Re: SEXPOTS timeout with onboard UART; works under strace, and with othe
By: Matthew Asham to Matthew Asham on Mon Oct 10 2022 04:03 pm
Okay - I found something else.
in modem_send() https://gitlab.synchro.net/main/sbbs/-/blob/master/src/sexpo ts/sexpots.c#L619, if I comment out the call to comPurgeInput(com_handle) - the modem initializes successfully and this is repeatable.
Thank you for experimenting and reporting your findings!
This happens right after the modem command is sent but before reading.
The flush is supposed to happen after all the printable characters of the AT command are sent (and potentially echoed back by the modem) but before the carriage-return ('\r') is sent.
tcflush(handle, TCIFLUSH) purges the input buffer, but why would strace slow the process down (or maybe i/o in the kernel?) enough so that this purge wouldn't have an affect?
strace will change the timing and this just looks like some kind of race condition, so not too surprising.
I also tried putting my modem into no echo mode (ATE0) - no affect when comPurgeInput was still present in code.
Ah, that's also a very good finding/report! I think this also means that if you tried increasing that SLEEP(100), just before the comPurgeInput() call, to a bigger delay, say SLEEP(500), that also might make the issue go away. I'm sure there's a better fix which I will ponder.
I also saw the mgetty is doing an fcntl FD_NOFL - but adding the same call to sexpots made no difference.
Cool, thanks.
Thank you for experimenting and reporting your findings!
The flush is supposed to happen after all the printable characters of the AT command are sent (and potentially echoed back by the modem) but before the carriage-return ('\r') is sent.
strace will change the timing and this just looks like some kind of race condition, so not too surprising.
Ah, that's also a very good finding/report! I think this also means that if you tried increasing that SLEEP(100), just before the comPurgeInput() call, to a bigger delay, say SLEEP(500), that also might make the issue go away. I'm sure there's a better fix which I will ponder.
Another one-line experiment I'd appreciate if you could conduct and report back is to add a call to comDrainOutput() just before the SLEEP() call, like so:
comDrainOutput(com_handle); // newly-added line
SLEEP(100);
comPurgeInput(com_handle);
Another one-line experiment I'd appreciate if you could conduct and report back is to add a call to comDrainOutput() just before the SLEEP() call, like so:
comDrainOutput(com_handle); // newly-added line
SLEEP(100);
comPurgeInput(com_handle);
tested, no dice
code:
printf("do sleep 100\n");
comDrainOutput(com_handle); // newly-added line
SLEEP(100);
printf("end sleep 100\n");
comPurgeInput(com_handle);
return comWriteByte(com_handle, '\r');
output:
10/10 17:19:00 Reading /etc/sexpots/line3.conf
10/10 17:19:00 Synchronet Communications I/O Library for Linux v1.19
10/10 17:19:00 Build Oct 10 2022 17:18:09 GCC 10.2.1
10/10 17:19:00 TCP Host: lovelybits.org
10/10 17:19:00 TCP Port: 1337
10/10 17:19:00 Opening Communications Device (COM Port): /dev/ttyS0
10/10 17:19:00 COM Port device handle: 3
10/10 17:19:00 COM Port DTE rate: 115200 bps
10/10 17:19:00 Initializing modem:
10/10 17:19:00 Modem Command: ATZ
do sleep 100
end sleep 100
10/10 17:19:00 Waiting for Modem Response ...
' / 13dByte read '
sexpots.c:652 comreadbyte ok
10/10 17:19:10 Modem Response TIMEOUT (10 seconds) on /dev/ttyS0
10/10 17:19:10 Retry #1: sending modem command (ATZ) on /dev/ttyS0
10/10 17:19:10 Dropping DTR on /dev/ttyS0
10/10 17:19:10 Raising DTR on /dev/ttyS0
10/10 17:19:10 Modem Command: ATZ
do sleep 100
end sleep 100
10/10 17:19:10 Waiting for Modem Response ...
' / 13dByte read '
sexpots.c:652 comreadbyte ok
10/10 17:19:20 Modem Response TIMEOUT (10 seconds) on /dev/ttyS0
10/10 17:19:20 Retry #2: sending modem command (ATZ) on /dev/ttyS0
10/10 17:19:20 Dropping DTR on /dev/ttyS0
10/10 17:19:20 Raising DTR on /dev/ttyS0
10/10 17:19:20 Modem Command: ATZ
do sleep 100
end sleep 100
10/10 17:19:20 Waiting for Modem Response ...
' / 13dByte read '
sexpots.c:652 comreadbyte ok
10/10 17:19:30 Modem Response TIMEOUT (10 seconds) on /dev/ttyS0
10/10 17:19:30 Modem command (ATZ) failure on /dev/ttyS0 (3 attempts)
10/10 17:19:30 Cleaning up ...
10/10 17:19:30 Done (handled 0 calls).
Re: SEXPOTS timeout with onboard UART; works under strace, and with othe
By: Matthew Asham to Digital Man on Mon Oct 10 2022 05:19 pm
Okay, so now it's not echoing anything back when you make that change?
Is is still working fine if you just comment-out/remove the call to comPurgeInput() - but make no other changes? It seems to me that change cause all the commands to be echoed back (unless you specifically set your modem to ATE0 by default), and then fail the init for that reason.
Re: SEXPOTS timeout with onboard UART; works under strace, and with othe
By: Matthew Asham to Digital Man on Mon Oct 10 2022 05:19 pm
Okay, so now it's not echoing anything back when you make that change?
Is is still working fine if you just comment-out/remove the call to comPurgeInput() - but make no other changes? It seems to me that change cause all the commands to be echoed back (unless you specifically set your modem to ATE0 by default), and then fail the init for that reason.
Yes, it was just seeing the commands echo'd back from the modem. Not an 'OK'. By default I use ATE1. I also tried E0 just to see.
With ATE1
code:
comPurgeOutput(com_handle);
SLEEP(100);
comPurgeInput(com_handle);
So it's as if it's not reading anything. I can also state that I know the modem is not getting the full ATZ because the relay is not clicking when the command is sent from SEXPOTS (Courier's have a very noticable *click* when ATZ is processed).
Now with ATE0 and both comPurge lines commented out, these are my results:
10/10 18:13:21 Reading /etc/sexpots/line3.conf
10/10 18:13:21 Synchronet Communications I/O Library for Linux v1.19
10/10 18:13:21 Build Oct 10 2022 18:13:14 GCC 10.2.1
10/10 18:13:21 TCP Host: lovelybits.org
10/10 18:13:21 TCP Port: 1337
10/10 18:13:21 Opening Communications Device (COM Port): /dev/ttyS0
10/10 18:13:21 COM Port device handle: 3
10/10 18:13:21 COM Port DTE rate: 115200 bps
10/10 18:13:21 Initializing modem:
10/10 18:13:21 Modem Command: ATZ
comWriteByte A
comWriteByte T
comWriteByte Z
comWriteByte
10/10 18:13:21 Waiting for Modem Response ...
10/10 18:13:31 Modem Response TIMEOUT (10 seconds) on /dev/ttyS0
10/10 18:13:31 Retry #1: sending modem command (ATZ) on /dev/ttyS0
10/10 18:13:31 Dropping DTR on /dev/ttyS0
10/10 18:13:31 Raising DTR on /dev/ttyS0
10/10 18:13:31 Modem Command: ATZ
comWriteByte A
comWriteByte T
comWriteByte Z
comWriteByte
10/10 18:13:31 Waiting for Modem Response ...
' / 13dByte read '
comReadByte read '
' / 10
comReadByte read 'O' / 79
comReadByte read 'K' / 75
' / 13dByte read '
comReadByte read '
' / 10
10/10 18:13:32 Modem Response: OK
10/10 18:13:32 Enabling modem Caller-ID:
10/10 18:13:32 Modem Command: AT#CID=1
comWriteByte A
comWriteByte T
comWriteByte #
comWriteByte C
comWriteByte I
comWriteByte D
comWriteByte =
comWriteByte 1
comWriteByte
10/10 18:13:32 Waiting for Modem Response ...
comReadByte read 'A' / 65
comReadByte read 'T' / 84
comReadByte read '#' / 35
comReadByte read 'C' / 67
comReadByte read 'I' / 73
comReadByte read 'D' / 68
comReadByte read '=' / 61
comReadByte read '1' / 49
' / 13dByte read '
10/10 18:13:32 Modem Response: AT#CID=1
10/10 18:13:32 Waiting for incoming call (Ring Indication) ...
Re: SEXPOTS timeout with onboard UART; works under strace, and with othe
By: Matthew Asham to Digital Man on Mon Oct 10 2022 06:13 pm
I suggested testing with comDrainOutput(), not comPurgeOutput(). I would not expect that to help at all and just make matters worse. Please re-read my message carefully.
Cool. Now please try the experiment I requested. :-)
it should give you a *nix login where you should be able to log into the box just like ssh etc.
once mgetty is installed you can just use "mgetty -x7 <device line> -s 115200"
eg mgetty -x7 ttyS0 -s 115200
see what happens. be interesting... the -x7 is debug and that will appear in /var/log/mgetty/<logfile>
I've tested this just now using mgetty and the modem initializes without incident and happily answers.
Okay - I found something else.
in modem_send() https://gitlab.synchro.net/main/sbbs/-/blob/master/src/sexpots/sexpots.c#L619, if I comment out the call to comPurgeInput(com_handle) - the modem initializes successfully
and this is repeatable.
This happens right after the modem command is sent but before reading. tcflush(handle, TCIFLUSH) purges the input buffer, but why would strace slow the process down (or maybe i/o in the
kernel?) enough so that this purge wouldn't have an affect?
I also tried putting my modem into no echo mode (ATE0) - no affect when comPurgeInput was still present in code.not sure that would work if that's what SP is expecting
I also saw the mgetty is doing an fcntl FD_NOFL - but adding the same call to sexpots made no difference.
I hope I didn't miss anything else :)
I didn't see any results from experiments with increasing the SLEEP() duration (e.g. to 500, 1000, etc.).
Sysop: | Coz |
---|---|
Location: | Anoka, MN |
Users: | 2 |
Nodes: | 4 (0 / 4) |
Uptime: | 191:38:10 |
Calls: | 184 |
Calls today: | 1 |
Files: | 5,413 |
Messages: | 222,758 |