Dev Shed Lounge
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDev Shed Lounge

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 24th, 2003, 04:07 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,676 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 39 m 45 sec
Reputation Power: 220
Send a message via ICQ to computer
Writing script to control KVM via RS232

Okay Lol,

I can't think where to post it as it deals with hardware and software lol.

Here is my request:

I want to order a new KVM switch (http://nti1.com/srvsw-usbvst-u.html) and was wondering if I could do the following thing.

I want to get two of these number pads to control the KVM via the serial port.

I have a spare box, so I was wondering how I could set it up so that buy pressing 1-8 on the left keypad, my left LCD changed to input 1-8 respectivly and the right keypad changed the right LCD. I was thinking by setting up these keypads somehow and sending commands via the serial port to the KVM it could control it.

HYCHM,
comp

and a bit more information:

It says it has RS232 (read here) control over it.

I want to be able to press say '5' on on of the keypads and have it switch user 1 to CPU5. the other keypad will switch user 2 to say CPU5 or whatever.

I was wondering of how I could get a script that would listen for keypresses on either keypad and then send a message to the KVM telling it to do something like change outputs or whaever.


Hope anyone can help me here.

computer
__________________

Reply With Quote
  #2  
Old September 25th, 2003, 03:55 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,676 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 39 m 45 sec
Reputation Power: 220
Send a message via ICQ to computer
Hmm this is really hard. I cant find an answer anywhere

Perhaps a perl script would work?

Reply With Quote
  #3  
Old September 25th, 2003, 05:46 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
Did you try firing up MiniCom on your serial port, setup 9600,8n1 and simply typing "CA"?
Also test the other baud rates told and also 7e1 with all of them. 7e1 is a common setting too. (i.e. 7bit, even parity, one stop bit)

Oh, a Windows user, ...
- "HyperTerm" if this still comes with your version... Use "direct connection", not a modem device.

hth,
M.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #4  
Old September 26th, 2003, 02:07 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,676 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 39 m 45 sec
Reputation Power: 220
Send a message via ICQ to computer
Well I don't acutally have it yet. I dont want to spend yodels if I cant get a keypad like this working.

The other problem, is that with two sets of keys for each number, would they mix?

Perhaps you could remap one set to letters and the other to other letters and get it to work by running something sensing the keypresses.

I could put windows or linux on this box so it doesn't matter too much on the OS side.

HTH,
computer

Reply With Quote
  #5  
Old September 26th, 2003, 03:52 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
To be honest, the OS should not matter at all. I just had to take the chance for a windows rant

It won't work like simulating a keyboard though. But similar:

RS232 as such is a very simple protocol. Three wire is minimum (rx, tx, gnd = receive, send, ground) but usually you use 5 (+2 for hardware handshake). RS232 is not using the usual TTL levels (0V = binary "0" and 5V = binary "1") but +/-12V.

Handshaking is taken care of by your OS and you only need to tell it *how* to use the port.
Hardware handshake is usually done using RTS/CTS ("Request to send", "Clear to send"), i.e. one of the wires will be raised to +12V so the other end knows it is allowed to send now. It will send and then raise the other to let the recipient know it has finished sending.

The line itself sends 7 or 8 bits at once with one, 1.5 (no idea how this works) or two stop bits (separators) and even, odd or no parity.
Modems eg. usually use 115.200 baud (because they can compress data they need a line to your PC faster than to the other modem). 8bits, no parity.

From here it is only raw data. Using a modem you send "ATDT <phone number>\n" and receive a "CONNECT\n" or "BUSY\n".
I once wrote a program to remote control a sony camera, they did use a binary protocol. But as simple as:
0x01 0x?? = move left ?? units
0x02 0x?? = move right ?? units
...
With the device responding 0x80 for OK and 0xFF for failure.

Long talk, short conclusion:
If they offer a "RS232 remote control feature" and with the stuff from above, it should be trivial to setup a remote control feature in any OS.
Maybe you have to pre-program it with a standard keyboard or directly on the device, but once done you can remote-control at least the preconfigured settings. I did not read the full docs of this KVM, but looks like a quite professional piece of hardware The more professional it is, the more documentation you get from the manufacturer and on the 'net. (btw, did you google it already?)

You are a php freak, right? In linux it works eg. like this:
- Assuming you have setup the OS with the right baudrate and bits already done someway similar to "/sbin/setserial /dev/ttyS0 crtscts 9600,n81"
Code:
<?
$cmd=$_GET['cmd']; // eg. from a form
$handle=open("/dev/ttyS0"); // COM1:
fwrite($handle, $cmd);
/* The following 2 lines are only valid if the KVM "answers" your command with "OK." or similar */
$result=fgets($handle); // read a line
if ($result!="OK") die("The command failed with message: $result");
fclose($handle);
?>


Try to get the technical docs first (the protocol used, I could not spot them on first glance). Once you have them, I can tell you if it really is as simple as I am expecting

Not sure if the whole discussion is interesting to the forums here. You can PM or eMail me anytime if you want. I have done quite some projects already involving RS232 on windows as well as linux. And I can also pass you some Delphi or C code for Windows.

...M

Reply With Quote
  #6  
Old September 26th, 2003, 03:55 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
Quote:
Not sure if the whole discussion is interesting to the forums here.

Maybe we should move this to one of our new Hardware forums?

Reply With Quote
  #7  
Old September 26th, 2003, 04:13 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,676 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 39 m 45 sec
Reputation Power: 220
Send a message via ICQ to computer
Perhaps I am not sure.

I don't acutally have the KVM yet, as it was an idea. I really want to get some other hardware first but I was interested in looking into this.

I could get one keypad and work out a way of deciding between the two monitors etc to switch.

The only thing is how can I get the remote control program to work? I would want it to work without me doing anything on that computer (ie, switching the KVM to the control PC, then changing the KVM as that is pointless). I think keeping this open on the forum to some extent is a good idea.

HTH and I'm not too much of a spoon feed wanting newbie lol

computer

Reply With Quote
  #8  
Old September 26th, 2003, 04:19 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
Did you see that I posted two messages?

n8,
M.

Reply With Quote
  #9  
Old September 26th, 2003, 04:25 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,676 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 39 m 45 sec
Reputation Power: 220
Send a message via ICQ to computer
ya but your PHP will need a form. I kinda need it to be via a keypad only. perhaps a form where I enter something and press enter and it goes and completes it and returns me back to the form.

that way I could do:

1 + 5 + Enter switch LCD1 to CPU5

perhaps I don't know lol

computer

Reply With Quote
  #10  
Old September 27th, 2003, 01:11 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
Another example: Linux shell, using a textmode menu that can be controlled with a keypad connected to this machine:
Code:
#!/bin/sh
setserial ... (see man page)
while true; do
  dialog --menu 80 25 19 "Please choose console" A "All" 1 "First" 2 "Second" 3 "Third" 2>/tmp/answer
  if [ $? -ne 0 ]; then
    # cancel pressed
    exit;
  fi
  RESULT=`cat /tmp/answer`
  case "$RESULT" in
    A) expect "" CA OK </dev/ttyS0 > /dev/ttyS0
    ;;
    1) expect "" C1 OK </dev/ttyS0 > /dev/ttyS0
    ;;
..... Add all others here too
  esac
done

I haven't done much shellcode the last months, and this code is right from my mind. Probably contains some errors.
...Regard it an example HOW simple it is in linux...


hth,
M.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDev Shed Lounge > Writing script to control KVM via RS232


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.