Coder Social home page Coder Social logo

ep12 / pytouchd Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 36 KB

Python driver for some touch screens like the ODROID VU7+ etc.

License: GNU Affero General Public License v3.0

Python 97.45% Shell 2.55%
touchscreen driver input raspberry-pi-3 raspberry-pi odroid odroid-vu7-plus

pytouchd's Introduction

pytouchd

Python driver for some touch screens like the ODROID VU7+ etc.

History

After googling around it seems to be harder than it should to get the touch functionality of some touch displays working. In the initial case, the ODROID VU7+ screen with the Raspberry Pi 3 SBC works perfectly fine as a display but without input. Compiling a new kernel that can handle the different type of input was too much work for such a small thing. In a post concerning that problem (VU7+ and RPI3) it was stated that the current support for other monitors should be kept and my idea was that it is possible to write a driver that is capable of handling both types of input since only two tiny details have chainged:

  1. In the original struct, every coordinate is one byte. So a point (x, y) is two bytes in length. If you have a display with a 4K resolution (3840 x 2160), many different input presses on different pixels will appear with the same two bytes. In that example, a touch in a 15x8 pixels area is quite a big of an error. My VU7+ sends two bytes instead of one for each coordinate. That means, the touch resolution is way better! (65536 instead of 256 display parts for each axis.)
  2. The mode is not limited to be relative (0 = 0%, 255 = 100%), the exact absolute pixel coordinate is sent!

This driver is a (proof of) concept for a universal driver as described above. If the driver detects that a point (2 coordinates) consists of 2 bytes (bpc (bytes per coordinate) is 1), the mode is set to relative, for bpc==2 the absolute mode is chosen.

If you want to, you can adapt this idea, especially if you are working on the kernel that should be handling touch input!

Tests

touch device SBC status
ODROID VU7+ RasPi3 beta, dblClick not good

Installation

  1. Always load the UInput module:
    sudo echo uinput >> /etc/modules
  2. Install python3 and dependencies:
    sudo apt-get install python3 python3-pip
    # try with sudo if it doesn't work (I have strange errors, but it works perfectly as root ?_?)
    pip3 install -U numpy evdev
  3. Clone this repo
  4. Install start-up script TODO

Options

name type default value comment
live bool false disable all enhancements and foward the raw input
dblClickTime float if a click is registered within x seconds after the last click has begun and the new position is within the dragDist radius, the DBL mode is set.
holdForRightClick bool true perform a right click when pressing the touch screen for longClickTime seconds
longClickTime float in seconds
dragDist custom defines the distance that must be exceeded to start a drag. In px, in, cm, mm if devW and devH are given, else: pixels
devW, devH custom the phyical measurements of the touch area in cm, mm, in

pytouchd's People

Contributors

ep12 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.