feat: add DisableEcho property to GenericSshClient and integrate with CommFactory

This commit is contained in:
Neil Dorin 2026-07-21 15:16:54 -06:00
parent 9656e3c408
commit 42b358862f
2 changed files with 16 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using Crestron.SimplSharp;
@ -137,6 +138,11 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
private bool DisconnectLogged = false;
/// <summary>
/// When true, turns off echo for the SSH session
/// </summary>
public bool DisableEcho { get; set; }
/// <summary>
/// Typical constructor.
/// </summary>
@ -250,7 +256,15 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
try
{
Client.Connect();
TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534);
var modes = new Dictionary<TerminalModes, uint>();
if (DisableEcho)
{
modes.Add(TerminalModes.ECHO, 0);
}
TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534, modes);
if (TheStream.DataAvailable)
{
// empty the buffer if there is data

View file

@ -68,6 +68,7 @@ namespace PepperDash.Essentials.Core;
{
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
ssh.AutoReconnect = c.AutoReconnect;
ssh.DisableEcho = c.DisableSshEcho;
if(ssh.AutoReconnect)
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = ssh;