Skip to content

kbaniak/rpi_touch_driver

 
 

Repository files navigation

User-mode driver for touch part for:

7" inch Capacitive Touch Screen HDMI TFT LCD High Speed fr Raspberry Pi/B/B+/Pi2

A number of LCD displays with HDMI interface and capacitive touch can be found on ebay and similar places. When plugging in the usb cable, Linux reports:

  • usb 6-2: New USB device found, idVendor=0eef, idProduct=0005
  • usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
  • usb 6-2: Product: By ZH851
  • usb 6-2: Manufacturer: RPI_TOUCH

The manufacturer (WaveShare?) is breaking every rule:

  • idVendor=0eef is assigned to D-WAV Scientific Co., Ltd, but the device is probably made by someone else.
  • totally bogus HID report descriptor
  • 16-bit data transferred in big-endian mode
  • GPL violation by distributing modified binary-only kernel (for RPi) where usbtouchscreen.c has been modified to support the first touch

Examples:

Touch events consists of 25 bytes, one example is

aa 01 03 1b 01 d2 bb 03 01 68 02 cc 00 5d 01 ef 01 5f 01 fe 00 fb 02 37 cc

Offset:

  • 0 : Start byte (aa)
    
  • 1 : Any touch (0=off,1=on)
    
  • 2-3 : First touch X
  • 4-5 : First touch Y
  • 6 : Multi-touch start (bb)
    
  • 7 : Bitmask for all touches (bit 0-4 (first-fifth), 0=off, 1=on)
    
  • 8-9 : Second touch X
  • 10-11 : Second touch Y
  • 12-13 : Third touch X
  • 14-15 : Third touch Y
  • 16-17 : Fourth touch X
  • 18-19 : Fourth touch Y
  • 20-21 : Fifth touch X
  • 22-23 : Fifth touch Y
  • 24 : End byte (cc or 00)

This user mode driver decodes the touch events and injects them back into the kernel using uinput. The drives requires a kernel with uinput, and there is nothing RPi-specific about it.

To use:

  • % make && sudo make install
  • sudo make systemd-install (only if your system uses systemd, otherwise you must find your own way to start the daemon)
  • (not tested) If calibration is necessary, install 99-rpi-touch.conf to /etc/X11/xorg.conf.d, calibrate using whatever calibration program you fancy, uncomment the calibration option line, and replace the calibration constants in 99-rpi-touch.conf

NOTE: Updated driver with the following changes:

  • removed multitouch support
  • hardcoded event transformation for Eleduino7" in JiveLite (see https://sites.google.com/site/picoreplayer/home)
  • (kbaniak) corrected managing /dev/hidrawX device handling with 'data ready for reading' polling. Now we read cahr device when data is available. No more buffer overlap and truncated messages.
  • (kbaniak) added hidraw data parsing routine and provided more debug

links:

Copyright (c) 2015 Gaspar de Elias

About

Driver for touch panel on 7" HDMI panel for RPi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.4%
  • Makefile 4.6%