HyperPixel4 & EVDEV question


#1

I was attempting to run a HyperPixel4 with touch on a Pi 3 using latest Raspian Lite 2018-11-13. Ran the HyperPixel4 installer and display is working fine. Running in the default orientation. My problem is with touch. For some reason when I run EVTEST the X and Y maximum values are inverted. So on the longer X axis I get EVDEV events from 0-479 and on the shorter Y axis I get EVDEV events from 0-799. I would expect this to be reversed so the longer X axis was 0-799 and the shorter Y axis was 0-479

EVTest Output:

Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x416 product 0x38f version 0x1060
Input device name: "Goodix Capacitive TouchScreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 125 (KEY_LEFTMETA)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value     17
      Min        0
      Max      480
    Event code 1 (ABS_Y)
      Value    771
      Min        0
      Max      800
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        4
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      255
    Event code 50 (ABS_MT_WIDTH_MAJOR)
      Value      0
      Min        0
      Max      255
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      480
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      800
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535

I tried the alternate drivers, with many combinations/switches when building, but still can’t get the expected results from EVDEV. Am I wrong in how I am expecting the EVDEV events to be reported? If not, is there some way to correct this?


#2

See my reply here- HyperPixel 4 - Touch screen dimensions are swapped

Long story short- I ran into this problem too, I can’t remember if it was fixed with the alternate driver, but I’ll look into it.


#3

I’ve got a suspicion that people trying the alternative drivers have been installing them but, due to a lack of clarity in the instructions, haven’t actually used them at all.

Could you try:

sudo cp /boot/overlay/hyperpixel4.dtbo /boot/overlay/hyperpixel4-upstream.dtbo
git clone https://github.com/pimoroni/HyperPixel4TouchScreen
cd HyperPixel4TouchScreen/driver
make build
sudo make install

This should replace your hyperpixel4.dtbo with the one that loads and configures the alternate driver.


#4

Just followed these steps and ran EVTest- I’m seeing the same thing.

You’re never going to touch the screen with pixel-perfect accuracy so I’d suggest just doing x=(x/480)*800 and y=(y/800)*480 to correct the touch positions and saving yourself the hassle of dealing with drivers.

Using EVDEV you should be able to read the X and Y axis ranges and scale accordingly anyway, since I don’t believe there’s any guarantee that touch axis/screen pixels will always be a 1:1 relationship. In this case it’s particularly weird because they just so happen to be the X and Y ranges swapped.