Connecting to external RS-232 device via UART #101
Replies: 6 comments 8 replies
-
Neat! I'm not sure which chip the official serial extension will use, but if it's the ever-so-common MAX3232, then the software for it will be merged in shortly. To that end, the infrastructure around extension boards will be introduced fairly soon, so that'll tell us a lot more about how the JetKVM team expect us to interact with the UART port. There hasn't been much investigation into the extension port and it's infrastructure yet, mostly waiting to see what the official implementation looks like. |
Beta Was this translation helpful? Give feedback.
-
I don't think the software would know or care if it's a MAXx232 or something else - it'd just be talking to a serial port, no? I don't disagree that it should become clearer when the software gets released, but if we're itchy in the meantime.... @MaffooClock, the other thing you could try (before or after verifying your adapter) would be to connect the RS232 side of it to a known-working RS232 port (could be a USB adapter) on a PC with a terminal emulator (minicom, PuTTY, etc). When you have it working, anything you send on the JetKVM side should appear in the terminal (and vice-versa) |
Beta Was this translation helpful? Give feedback.
-
For testing your custom cable, if you just jumper the TX and RX pins together (on the RS232 side), do you see anything? Whatever terminal app you're using will have to disable hardware flow control. (there's no CTS/RTS/etc pins). |
Beta Was this translation helpful? Give feedback.
-
Welp, tested my custom TTL to RS-232 cable -- worked perfectly. One of the tests included the JetKVM, of course, and I can confirm that The problem: the TX and RX pins on the "Chinesium KVM" are labeled backwards 🙄. Oh, and the baud rate is 115200, for anyone who cares. And now, sending Next step: learning some Go and adding a way to dispatch these command from the web UI. If I build this right, it would be compatible with the plugin system discussed in #9 (and related pull request #10), and be configurable so the user can specify how many inputs are available and what the associated serial command would be. |
Beta Was this translation helpful? Give feedback.
-
For what it's worth to anyone that might want it, I've whipped up a simple script to make it easy. I'm going to guess that this will work for any serial-connected external KVM manufactured by KCEVE (just set the #!/bin/sh
NUM_INPUTS=10
PORT=/dev/ttyS3
BAUD=115200
### Make sure the input number was supplied
if [ $# -ne 1 ]
then
echo "Usage: $0 <input>"
exit 1
fi
### Check that the argument is an integer
echo "$1" | grep -Eq '^-?[0-9]+$'
if [ $? = 1 ]
then
echo "Invalid argument: $1"
exit 1
fi
### Check that the argument is within range
if [ "$1" -lt 1 ] || [ "$1" -gt "$NUM_INPUTS" ]
then
echo "Input out of range: $1"
exit 1
fi
### Check if the serial port is already set to the correct baud (and set it if not)
stty -F $PORT | grep -q $BAUD
if [ $? = 1 ]
then
stty -F $PORT $BAUD
fi
### Convert integer to hex (in case we have more than 9 inputs)
I=$(printf "%X\n" $1)
### Send it!
echo "X${I},1\$" > $PORT For my purposes, having an SSH terminal open while I access the JetKVM web UI will satisfy my requirements to remotely view and control any of the 9 hosts connected to my external KVM. But I would like to see if I can add a component in the web UI to make it even easier... |
Beta Was this translation helpful? Give feedback.
-
Thanks for doing the legwork on this. I actually bought the parts to put together a UART to RS232 cable a few weeks ago but I've been too busy to actually put it all together. Glad it worked for you since this is what I wanted to do myself. |
Beta Was this translation helpful? Give feedback.
-
I realize this product is in its infancy and not all features are present, and not all code and schematics have been made open-source yet, so I'm probably getting ahead of things, but...
I'm tinkering with using the extension port to communicate with an external KVM (manufactured of questionable Chinese quality by KCEVE) that supports switching inputs via serial control. My ultimate goal is to use the JetKVM to effectively convert the "standard" KVM into an IPKVM. The final solution will offer buttons in the web UI that I can click to switch the input on the external KVM.
I built a simple serial cable with a 6P6C RJ-11 and a MAX3232 transceiver, using the 3.3V on pin 4 to drive the MAX3232.
Here's the wiring:
While poking around the OS on the JetKVM, I see three
tty
devices:I assume
ttyS3
is the UART pins on the Extension Port. Runningstty -F /dev/ttyS3 -a
shows that it's already set to a typical 9600/8/n/1, so it appears that I don't need to set anything (except maybe the baud, but I have no clue what the external device expects, so this is a decent start).The serial device on the other end expects commands like
X3,1$
orXA,1$
to switch inputs (input 3 or 10, respectively, for example). Seems easy enough. So the actual command I'm sending, escaped and with a carriage return, is:Well, nothing happens. So, there must be a problem in one of these points:
ttyS3
isn't the right deviceProbably the first thing to do would be to test my custom TTL to RS-232 cable -- I could use a Raspberry Pi for that:
So, no point in messing with the JetKVM until I perform the test on my custom cable. But meanwhile, I figured I'd start this discussion in case anyone might have some insight, or for anyone else interested in this who might want to follow along.
Beta Was this translation helpful? Give feedback.
All reactions