summaryrefslogtreecommitdiffstats
path: root/content/posts/software-kvm-switch.rst
blob: b4943f68ea015b69d4cbdbbbf94d8ad4e8f43a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
A Software KVM Switch
#####################
:date: 2015-01-05 02:26
:tags: composite video,software keyboard,kvm,remote management
:status: draft

I have been so often in the need for quick graphical access to a server without
the need of an actual mouse and display plus wiring for power and so on.

In the enterprise world there are things called 'KVM switches' and laptops
which do exactly what i need but a) they are fucking expensive and b) they are
stationary and built into server racks so i came up with my own low-budget solution.

With this you will be able to see video output from composite,hdmi and vga and
control a virtual USB keyboard of a headless server or embedded system.

.. image:: /img/videograbber_on_raspi.jpg
    :width: 60%
    :alt: video and soft keyboard attached to raspi
    :align: middle

I am using a 32u4 turned into a software keyboard and a Composite Video grabber to 
capture the output of the system to supervise.

*A fair Warning:* Be aware that the video image is very crappy and the software keyboard code is
a WIP.

Parts list
----------
All you need are the following things:

For the soft keyboard input:
1. a 32u4 microcontroller like the `arduino pro micro`_
2. a cheap `USB-TTL adapter`_

For capturing video:
1. a video grabber with the STK1160 chipset (for linux support)
I asked the sellers on aliexpress and found `this videograbber`_ which uses
the chipset needed.
2. a HDMI-to-AV_ (recommended) and optionally a  VGA-to-HDMI_ box to capture
output other than the one from a Raspberry Pi which has native composite output.


Setup
-----

**Soft Keyboard**

Attach the USB-TTL adapter to the 32u4 by connecting both GND , Pin 9 to the
USB-TTL TX and pin 10 to USB-TTL RX.

Now flash the passthrough firmware for the 32u4:

.. code-block:: bash
  
    git clone https://github.com/makefu/keyboard-passthrough.git
    cd keyboard-passthrough
    cat README.md
    arduino key_passthrough/key_passthrough.ino
    # flash it

Get the passthrough software running on your computer:

.. code-block:: bash

    pip install hg+http://bitbucket.org/pygame/pygame
    python here.py


.. _arduino pro micro:
.. _USB-TTL adapter:
.. _this videograbber:
.. _HDMI-to-AV:
.. _VGA-to-HDMI: