- Terminal 1 - Create the virtual keyboard:
sudo ./virtual_keyboardYou should see:
═══════════════════════════════════════════════════════
Virtual Keyboard Device Created
═══════════════════════════════════════════════════════
Device Name : Virtual Keyboard 115200
Baudrate : 115200 bps
Bit Time : 8.68 μs
Char Time : 86.81 μs
Vendor ID : 0x1234
Product ID : 0x5678
═══════════════════════════════════════════════════════
- Terminal 2 - Monitor keyboard events:
# Find the event device number
cat /proc/bus/input/devices | grep -A 5 "Virtual Keyboard 115200"
# Monitor events (replace X with your event number)
sudo evtest /dev/input/eventX- Terminal 3 - Write to the keyboard:
sudo ./keyboard_writer
# Type: Hello World
# Press EnterYou should see timing information showing the baudrate-based delays!
The timing should respect the 115200 baud rate:
- Each character takes approximately 86.8 μs to transmit
- Including inter-character delays, expect ~260 μs per character total
- For "Hello World\n" (12 chars): ~3.1 ms total
# Terminal 3
sudo ./keyboard_writer
> ABCDEFGHIJKLMNOPQRSTUVWXYZ
# Watch the timing output to verify baudrate compliance# Monitor the actual events with timestamps
sudo evtest /dev/input/eventX# Check device information
cat /proc/bus/input/devices | grep -A 10 "Virtual Keyboard 115200"
# List all input devices
ls -la /dev/input/by-id/Create a test file to analyze timing:
# Terminal 3
sudo ./keyboard_writer
> The quick brown fox jumps over the lazy dogThe output will show:
- Number of characters sent
- Baudrate used (115200)
- Total transmission time
- This should align with baudrate calculations