Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple evdev linux device driver and GUI program to simulate multitouch touchscreen
C Clojure Perl Makefile
Branch: master

Update README

latest commit 52a5de440b
@vi authored

README

Simple virtual input device to testing things in Linux. Creates character device and input device.

Building (from configured Linux kernel's directory):

"make modules M=~/src/virtual_touchscreen/"

Using:

1# insmod virtual_touchscreen.ko
1# dmesg | grep virtual_touchscreen
virtual_touchscreen: Major=250
1# cat /dev/virtual_touchscreen
Usage: write the following commands to /dev/virtual_touchscreen:
    x num  - move to (x, ...)
    y num  - move to (..., y)
    d 0    - touch down
    u 0    - touch up
    s slot - select multitouch slot (0 to 9)
    a flag - report if the selected slot is being touched
    e 0   - trigger input_mt_report_pointer_emulation
    X num - report x for the given slot
    Y num - report y for the given slot
    S 0   - sync (should be after every block of commands)
    M 0   - multitouch sync
    T num - tracking ID
    also 0123456789:; - arbitrary ABS_MT_ command (see linux/input.h)
  each command is char and int: sscanf("%c%d",...)
  <s>x and y are from 0 to 1023</s> Probe yourself range of x and y
  Each command is terminated with '\n'. Short writes == dropped commands.
  Read linux Documentation/input/multi-touch-protocol.txt to read about events

1# printf 'x 200\ny 300\nS 0\n' > /dev/virtual_touchscreen
1# printf 'd 0\nS 0\n' > /dev/virtual_touchscreen
1# printf 'u 0\nS 0\n' > /dev/virtual_touchscreen

2# hd /dev/input/event11 # or whatever udev assigns
00000000  df 32 48 4f a6 10 02 00  03 00 00 00 c8 00 00 00  |.2HO............|
00000010  df 32 48 4f ab 10 02 00  03 00 01 00 2c 01 00 00  |.2HO........,...|
00000020  df 32 48 4f bf 10 02 00  00 00 00 00 00 00 00 00  |.2HO............|
00000030  e3 32 48 4f af af 09 00  01 00 4a 01 01 00 00 00  |.2HO......J.....|
00000040  e3 32 48 4f bc af 09 00  00 00 00 00 00 00 00 00  |.2HO............|
00000050  e7 32 48 4f 3d bb 05 00  01 00 4a 01 00 00 00 00  |.2HO=.....J.....|
00000060  e7 32 48 4f 50 bb 05 00  00 00 00 00 00 00 00 00  |.2HOP...........|

There is also experimental script to read /dev/input/eventX of some real device and output data for virtual_touchscreen.

There is GUI application that can also provide data for virtual touchscreen (virtual_touchscreen.clj, bundled version: http://vi-server.org/pub/virtual_touchscreen.jar )
It listens port 9494 and provides virtual_touchscreen input for connected clients.

Example:
hostA$  java -cp clojure.jar clojure.main virtual_touchscreen.clj

hostB#  nc hostA 9494 > /dev/virtual_touchscreen
Something went wrong with that request. Please try again.