arn-c0de / arn-c0de/InteractiveChecklists

Feature Idea: ๐ŸŽฎ Android Button Panel โ†’ Virtual HID Device for DCS World

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
backend breaking change datapad discussion enhancement feature help wanted ideas priority: low
Dominant language
Kotlin
Stars
45
Forks
4
PR merge metrics
No merged PRs in 30d

Description

> **Type:** Feature Request / Experimental Evaluation
> **Status:** ๐Ÿ”ฌ Testing in Progress
> **Priority:** Medium

---

## ๐Ÿ“‹ Description

Implement a system that allows application to act as a configurable button panel for DCS World by transmitting input events over UDP connection back to **forward_parsed_udp.py** .

This document also serves as an **experimental evaluation** to determine whether the **Virtual HID approach** is better and easier suited than **direct Export.lua commands** for the application and every Module Aircraft.

---

## ๐Ÿ—๏ธ Proposed Architecture

### Option A: Virtual HID Device *(Current Experiment)*

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” UDP/AES-GCM โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” HID Driver โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“ฑ Android โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ ๐Ÿ Python โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ ๐ŸŽฎ DCS โ”‚
โ”‚ Button App โ”‚ โ”‚ Backend โ”‚ โ”‚ World โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
(vgamepad/uinput) (Std Joystick)
```

### Option B: Direct Export.lua *(Comparison)*

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” UDP/AES-GCM โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” Export.lua โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“ฑ Android โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ ๐Ÿ Python โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ ๐ŸŽฎ DCS โ”‚
โ”‚ Button App โ”‚ โ”‚ Backend โ”‚ โ”‚ World โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
(Lua Socket) (LoSetCommand)
```

---

## โš–๏ธ Comparison Matrix

| Kriterium | Virtual HID | Export.lua |
|-----------|:-----------:|:----------:|
| DCS Native Binding UI | โœ… | โŒ |
| Works with other games | โœ… | โŒ |
| No Lua scripting needed | โœ… | โŒ |
| Module-specific commands | โŒ | โœ… |
| No virtual device setup | โŒ | โœ… |
| Lower abstraction layers | โŒ | โœ… |
| Portable solution | โœ… | โŒ |

---

## ๐Ÿ“ฆ Scope

### โœ… In Scope

- New Kotlin module with configurable buttons, switches, encoders
- Bidirectional UDP communication
- Secure channel: ECDH key exchange + AES-GCM encryption via **forward_parsed_udp.py** and **crypto_handshake.py**
- Python backend exposing virtual HID device
- DCS World recognition as standard input hardware
- Cross-platform backend (Windows/Linux)
- Working also in other games (MSFS , XPLANE etc)

### โŒ Out of Scope

- Android as direct USB HID (no root/custom kernel)
- Reverse engineering of DCS internals
- Macro functionality (1 event = 1 HID input)

---

## ๐Ÿ“ Requirements

| Requirement | Target | Status |
|-------------|--------|:------:|
| End-to-end latency | < 10 ms | โณ |
| Event mapping | 1:1 (no macros) | โณ |
| Device identification | Fixed VID/PID | โณ |
| License compliance | Apache/BSD/MIT only | โณ |

### ๐Ÿ–ฅ๏ธ Platform Support

| Platform | Implementation | Library |
|----------|----------------|---------|
| Windows | ViGEmBus | `vgamepad` |
| Linux | uinput/evdev | `evdev` |

---

## โœ… Acceptance Criteria

- [ ] Android button press visible in DCS as costumizable modular joystick button
- [ ] Secure channel established automatically on startup
- [ ] System runs reliably for extended sessions (8h+)
- [ ] No control inputs gone lost
- [ ] No conflicts with physical input devices

---

## ๐Ÿงช Test Cases

### Phase 1: Infrastructure Setup (if use seperate .py forwarder)

- [ ] 1.1 โ€” Python backend stable on Windows (ViGEmBus)
- [ ] 1.2 โ€” Python backend stable on Linux (uinput)
- [ ] 1.3 โ€” Virtual joystick visible in Windows Game Controllers
- [ ] 1.4 โ€” Virtual joystick visible in `jstest`/`evtest` (Linux)
- [ ] 1.5 โ€” Fixed VID/PID persists across restarts
- [ ] 1.6 โ€” ECDH key exchange successful
- [ ] 1.7 โ€” AES-GCM packets decoded correctly

### Phase 2: Basic HID Functionality

- [ ] 2.1 โ€” Single button press registers
- [ ] 2.2 โ€” Button release handled correctly
- [ ] 2.3 โ€” Multiple simultaneous presses work
- [ ] 2.4 โ€” Latency < 10 ms (button โ†’ HID event)
- [ ] 2.5 โ€” No event loss at 10 Hz
- [ ] 2.6 โ€” No event loss at 50 events/sec burst

### Phase 3: DCS World Integration

- [ ] 3.1 โ€” DCS detects virtual joystick in Controls
- [ ] 3.2 โ€” Button bindable via DCS UI
- [ ] 3.3 โ€” Bound button triggers correct action
- [ ] 3.4 โ€” Binding persists across DCS restarts
- [ ] 3.5 โ€” No conflict with physical joysticks
- [ ] 3.6 โ€” โœˆ๏ธ F/A-18C Hornet tested
- [ ] 3.7 โ€” ๐Ÿ›ฉ๏ธ A-10C II tested
- [ ] 3.8 โ€” ๐Ÿš Ka-50 tested

### Phase 4: Stability & Edge Cases

- [ ] 4.1 โ€” Stable over 2h session
- [ ] 4.2 โ€” Stable over 8h session
- [ ] 4.3 โ€” Reconnect after app backgrounded
- [ ] 4.4 โ€” Reconnect after network interruption
- [ ] 4.5 โ€” Graceful backend restart handling
- [ ] 4.6 โ€” No memory leaks (24h test)
- [ ] 4.7 โ€” CPU usage < 5% idle / < 15% active

### Phase 5: Export.lua Comparison ๐Ÿ”ฌ

- [ ] 5.1 โ€” Export.lua socket connection works
- [ ] 5.2 โ€” `LoSetCommand()` executes externally
- [ ] 5.3 โ€” Measure latency: UDP โ†’ Export.lua โ†’ action
- [ ] 5.4 โ€” Module-specific commands work (e.g., UFC)
- [ ] 5.5 โ€” `GetDevice()` cockpit manipulation works
- [ ] 5.6 โ€” **Compare latency:** HID vs Export.lua
- [ ] 5.7 โ€” **Compare reliability:** 1000 events test

---

## ๐Ÿ“Š Measurement Log

| Test | Date | Result | Latency | Notes |
|:----:|:----:|:------:|:-------:|-------|
| 2.4 | | โณ | โ€” ms | |
| 5.3 | | โณ | โ€” ms | |
| 5.6 | | โณ | โ€” ms | |

---

## ๐Ÿ› ๏ธ Implementation Checklist

### ๐Ÿ“ฑ Android App

- [ ] Button grid UI
- [ ] Button configuration (label, ID, type)
- [ ] UDP socket management
- [ ] ECDH key exchange (client)
- [ ] AES-GCM encryption
- [ ] Connection status indicator
- [ ] Reconnect logic
- [ ] Haptic feedback
- [ ] Config save/load (JSON)

### ๐Ÿ Python Backend

- [ ] Async UDP server
- [ ] ECDH key exchange (server)
- [ ] AES-GCM decryption
- [ ] Event queue management
- [ ] Windows: ViGEmBus integration
- [ ] Linux: uinput integration
- [ ] Button mapping config (JSON/YAML)
- [ ] Structured logging
- [ ] Systemd service (Linux)
- [ ] Windows service wrapper

### ๐ŸŽฎ DCS Integration

- [ ] Virtual device recognition
- [ ] Test binding profile
- [ ] Module preset profiles
- [ ] User documentation

---

## ๐Ÿ”ฎ Future Extensions

- [ ] Configurable button-to-HID mapping (JSON/YAML)
- [ ] Multi-device support
- [ ] Encoder and axis support
- [ ] Heartbeat and reconnect handling

---

## ๐Ÿ“Œ Current Status

| Phase | Status |
|-------|:------:|
| Infrastructure | โณIn Progress|
| Basic HID | โณ Open |
| DCS Integration | โณ Open |
| Stability | โณ Open |
| Comparison | โณ Open |

---

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.