linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Register virtual GPIO keys for VNC
@ 2025-07-29  6:43 marlonwu
  2025-07-29  6:43 ` [PATCH 1/2] dt-bindings vnc virtual input marlonwu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: marlonwu @ 2025-07-29  6:43 UTC (permalink / raw)
  To: robh, dmitry.torokhov, krzk+dt
  Cc: linux-input, devicetree, marlonwu, MenglongWoo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2964 bytes --]

From: Menglong Wu <marlonwu@126.com>

Test platform
-------------
Kernel: 4.14.98
Rootfs: BusyBox 1.29
QT: 4.7
x11vnc: 0.9.16

Purpose
-------------

To emulate a full ANSI keyboard on embedded devices without physical 
keyboards.
The server responds to key events via x11vnc.
This resolves the limitation where embedded systems only register a few 
GPIO keys, making them unable to process full keyboard inputs.

documented in Documentation/devicetree/bindings/input/vnc-virtual-input.yaml

Scenario
-------------

- /dev/input/event1: Physical GPIO buttons

- /dev/input/event2: Physical touchscreen

Assume my-pcb.dts defines two GPIO-based hardware keys (A and B).
When the VNC server x11vnc is started, a remote PC connects via a VNC 
client and attempts to send key inputs.
Since the Linux kernel only recognizes two keys, the UI on the embedded 
device only responds to ‘A’ and ‘B’.

Start x11vnc server:

```
    x11vnc -noipv6 -rawfb /dev/fb0 -forever -clip 640x480+0+0 \
      -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,\
      direct_key=/dev/input/event1,\
      direct_abs=/dev/input/event2
```

Monitor key events:

```
    hexdump /dev/input/event1
```

Original my-pcb.dts:


```
    gpio_keys {
        compatible = "gpio-keys";
        pinctrl-0 = <&pinctrl_gpio_keys>;

        key-a {
            label = "btn-key-a";
            gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
            linux,code = <KEY_A>;
        };
        key-b {
            label = "btn-key-b";
            gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
            linux,code = <KEY_A>;
        };
    };
```


Solution
-------------

Modify my-pcb.dts to support a virtual ANSI keyboard:

```
    #include "vnc-virtual-input.dtsi"

    // Originally, the DTS relied on physical GPIO keys
    gpio_keys {
        // Disable the original physical key node
        status = "disable";
    };

    // The virtual GPIO DTS node now integrates physical GPIO
    vnc_key {
        compatible = "gpio-keys";
        pinctrl-0 = <&pinctrl_gpio_keys>;
        
        key-a {
            label = "btn-key-a";
            gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
            linux,code = <KEY_A>;
        };
        key-b {
            label = "btn-key-b";
            gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
            linux,code = <KEY_A>;
        };
    }
```
Menglong Wu (2):
  dt-bindings vnc virtual input
  ARM: dts: Add virtual GPIO input for VNC keyboard

 .../bindings/input/vnc-virtual-input.txt      | 153 +++++
 .../bindings/input/vnc-virtual-input.yaml     |  86 +++
 MAINTAINERS                                   |   8 +
 arch/arm/boot/dts/vnc-virtual-input.dtsi      | 569 ++++++++++++++++++
 4 files changed, 816 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/vnc-virtual-input.txt
 create mode 100644 Documentation/devicetree/bindings/input/vnc-virtual-input.yaml
 create mode 100644 arch/arm/boot/dts/vnc-virtual-input.dtsi

-- 
2.39.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-29  7:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29  6:43 [PATCH 0/2] Register virtual GPIO keys for VNC marlonwu
2025-07-29  6:43 ` [PATCH 1/2] dt-bindings vnc virtual input marlonwu
2025-07-29  7:33   ` Krzysztof Kozlowski
2025-07-29  6:43 ` [PATCH 2/2] ARM: dts: Add virtual GPIO input for VNC keyboard marlonwu
2025-07-29  7:52   ` Krzysztof Kozlowski
2025-07-29  7:39 ` [PATCH 0/2] Register virtual GPIO keys for VNC Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).