Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:09 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : talkto - a network terminal (kind of) for linux

Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 03:31pm 01 Jun 2020
Copy link to clipboard 
Print this post

hi,
   attached is an experimental kind-of-terminal-emulator for linux:

talkto (linux 32 and 64-bit).zip

it only connects to devices over the internet, and uses as the backend a utility called netcat that is a standard part of linux. meanwhile, the frontend is provided by the linux console window itself, that supposedly follows the xterm-256color standard. with a bit of tweaking in between the two, it is possible to connect to a remote micromite and run the internal editor without any major hiccips. even the mouse works!

testing so far has been on a single host, the micromite that tassyjim has on the net. am not sure if he wants the location published or not, so will let him chip in with the address/port if it is ok.

i've named the program talkto, as this is essentially what it does. the code is very simple, consisting largely of 'plumbing' between the backend and frontend. i wrote it as a testbed for experimenting with how to use netcat as a network backend for GFXterm.

what may be of interest - particularly in regards to RPi MMbasic - is that i found out how to switch the linux console into RAW mode. this causes the console to pass control characters (^C, ^Z, etc) straight through to the application without acting on them itself. the application therefore has 100% control of the console window - so you can press control-C to your heart's content without causing talkto to close.

important:
1. only run talkto from the console window. if clicked on from the gui, it will just lurk invisibly in the background sucking up computrons until you kill it.
2. to exit talkto, just press shift-f1.


as always, feedback would be much appreciated...


cheers,
rob   :-)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:58pm 01 Jun 2020
Copy link to clipboard 
Print this post

tassyjim.ddns.net port 3002 for  a micromite
tassyjim.ddns.net port 44002 for a CMM2

Only one user at a time and there is a 10 minute inactivity timeout.

Jim
VK7JH
MMedit
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 03:56am 02 Jun 2020
Copy link to clipboard 
Print this post

hi jim,
   have just been playing with the above CMM2, seems to be able to connect ok, run the editor, etc. i do notice that the files command appears to assume a 50-line x 100-column display - is this correct? can this be changed by the user to 24-line/80-column, or is the geometry hard-coded to the VGA screen geometry? OPTION DISPLAY lines [,chars] produced an error.


cheers,
rob   :-)
Edited 2020-06-02 13:57 by robert.rozee
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 04:56am 02 Jun 2020
Copy link to clipboard 
Print this post

I think it's fixed at 50 x 100 but Peter will have to confirm.

Jim
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:59am 02 Jun 2020
Copy link to clipboard 
Print this post

The files and edit commands switch the CMM2 into Mode 1,8 (800x600) with font 1 (8x12). This gives 50x100 characters.
The CMM2 firmware sends out the ANSI sequence to resize the terminal emulator into the correct format needed (actually 101x50).
Any decent terminal emulator will understand this sequence and act accordingly. Putty and Teraterm certainly resize properly when entering EDIT or FILES.
You can try this with Putty to Jim's CMM2 to confirm
Edited 2020-06-02 19:05 by matherp
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 01:38pm 02 Jun 2020
Copy link to clipboard 
Print this post

i take it you are using the sequence \033[8;50;101t to resize? it looks like upon exit, the terminal size is not restored - if desired the size can be read with \033[18t before the initial resizing.

i'm also seeing a hanging escape character in the bottom-rightmost character location, and what i'm guessing is a string of trailing control-Z characters - perhaps padding the file size out to some multiple of ???/32/64/128. see below screen capture.

this is on linux mint xfce, so the console is "xfce4-terminal".


cheers,
rob   :-)


 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 02:09pm 02 Jun 2020
Copy link to clipboard 
Print this post

Tested locally with realterm there are definitely no extra characters or hanging escape codes. The last thing sent is esc[?25h to turn the cursor on.

It may be TCP/IP is somehow padding?

The code does not attempt to resize the window as there is no reason to. The intention is just to ensure there is a window big enough to use once and for all.


 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 02:50pm 02 Jun 2020
Copy link to clipboard 
Print this post

am i not seeing ddouble?    





cheers,
rob   :-)
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 03:16pm 02 Jun 2020
Copy link to clipboard 
Print this post

I'm seeing it, too.

John
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 03:20pm 02 Jun 2020
Copy link to clipboard 
Print this post

I though you meant at the end. I'll remove that one in the next release but should be benign: certainly is in Teraterm and Putty. What is categorically not the case is any padding at the end of the page update
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 03:48pm 02 Jun 2020
Copy link to clipboard 
Print this post

the padding was at the very end of the file, try paging down to the end and check. it could well be that the a:/fm.bas file sitting on Jim's CMM2 has padding in the file itself from an earlier x-modem transfer.

try creating a short file with some text followed by a a whole load of control-Z characters at the end, then load it into the CMM2's editor. when loading a file into the editor, control characters like tab, cr and lf should be handled sanely*, other skipped, and upon seeing the first control-Z loading should terminate - just like what happens with AUTOSAVE on the micromite.


cheers,
rob   :-)


*a good strategy is to scan the file for cr+lf pairs, replacing each one with a single cr. next scan for lf characters, replacing each one with a cr. next scan for space+cr pairs, replacing them with a single cr (thus removing spaces from ends of lines). the following is the code i use in GFXterm when pasting:


 for I:=1 to length(S) do             // clear bit-7 of all characters being pasted
       S:=char(byte(S) and $7F);

 I:=pos(#13#10, S);
 while I<>0 do
 begin                                // translate all CR-LF pairs into single CR
   delete(S, I+1, 1);
   I:=pos(#13#10, S)
 end;

 for I:=1 to length(S) do             // translate any remaining LFs into CRs
     if S=#10 then S:=#13;

 for I:=length(S) downto 1 do         // remove any other control characters (just keeping TAB, CR and crtl-Z)
     if not (S[ I] in [#9, #13, #26, #32..#255]) then delete(S, I, 1);

 I:=pos(#32#13, S);
 while I<>0 do
 begin                                // remove all trailing spaces at ends of lines
   delete(S, I, 1);
   I:=pos(#32#13, S)
 end;

 while (length(S)<>0) and (S[length(S)]=#32) do delete(S, length(S), 1);
                                      // remove final trailing spaces at end of S  


(characters after any control-Z are retained in the above example to cater for commands following on after an autosave completes - this would not be a usage case with the CMM2)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 03:50pm 02 Jun 2020
Copy link to clipboard 
Print this post

All Xmodem transferred files have padding at the end. This is nothing to do with the CMM2. This happens on all MM but most terminals don't show it
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 04:03pm 02 Jun 2020
Copy link to clipboard 
Print this post

when the file is saved [after being edited], what does the editor do with the extra control-Z characters? are they retained, or all (or all except 1) stripped out? how does it handle other control characters embedded within a file? i'm picking tab, cr, lf are handled, but what of control-G for instance?

my apologies for being picky, but in a past life part of my job was coming up with stupid things that customers could try and testing what doing said things did to products. as the product release date approached i would receive death threats from the developers   :-(


cheers,
rob   :-)
Edited 2020-06-03 02:04 by robert.rozee
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 06:08pm 02 Jun 2020
Copy link to clipboard 
Print this post

  Quote  when the file is saved [after being edited], what does the editor do with the extra control-Z characters? are they retained, or all (or all except 1) stripped out? how does it handle other control characters embedded within a file? i'm picking tab, cr, lf are handled, but what of control-G for instance?


Can't remember - feel free to test and report if any issues. It used to show unhandled control character in inverse video in the editor and they could then be deleted but I can't remember if I altered this to remove them
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:38pm 02 Jun 2020
Copy link to clipboard 
Print this post

All XMODEM transfers will pad the file with either ^Z or chr$(0) characters.
There has never been any consensus on which to use.

The file FM.BAS was transferred to the CMM2 using XMODEM so has the padding.
This is one reason why I usually use AUTOSAVE to transfer code but I did have to test XMODEM sometime.

Jim
VK7JH
MMedit
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 04:10am 03 Jun 2020
Copy link to clipboard 
Print this post

aha, that explains what i saw. i'd consider the editor reading in those control characters verbatim to be a bug - once a file is loaded ALL control characters should be absent from the editable text.

has anyone had a chance to play with talkto yet? i'm thinking of a couple of ways it could be expanded into a useful tool in itself, perhaps with a gui window that displays diagnostics about escape sequences in the income data stream.


cheers,
rob   :-)
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025