Skip to content
Driver for touch panel on 7" HDMI panel for RPi
Branch: master
Clone or download
bsteinsbo Stop relying on udev and use ulib intead. Scan devices on startup, an…
…d receive events

after that.  Correct device identified by vendor/product.  No support for multiple devices.
Latest commit 6d956bb Jul 29, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
99-rpi-touch.conf Untested config file for /etc/X11/xorg.conf.d when calibrartion is ne… Jul 29, 2015
rpi_touch_driver.c Stop relying on udev and use ulib intead. Scan devices on startup, an… Jul 29, 2015

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


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


  • 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

Copyright (c) 2015 Bjarne Steinsbo

Code and inspiration from and the CyanogenMod userspace touchscreen driver for cypress ctma395.

You can’t perform that action at this time.