1

I'm trying to make a usb touchscreen working or a rpi4 with 2020-02-13-raspbian-buster but I'm stuck on a new known problem I think but I would appreciate any help to find a solution. My problem is that the touchscreen works perfectly well when the display is in normal mode but I want to use it in portrait mode the touch don't rotate so I get X and Y inputs inverted. To rotate the screen I use the built in gui screen config tool or xrandr --output HDMI-1 --rotate right since on rpi4 from what I'm reading it cannot rotate from /boot/config.txt (if someone know how I would apreciate). How can I make hid_multitouch to invert X and Y ? I looked a lot around X11/Xorg.d ... with no luck. I found some solution for the hyperpixel screen since it has the same problem but I don't see how to adapt it to mine...

Hereafter is what I could get from my touch :

lsusb : Bus 001 Device 003: ID 1ff7:0009 CVT Electronics.Co.,Ltd

kernel.log :

hid-generic 0003:1FF7:0009.0003: input,hiddev97,hidraw2: USB HID v1.11 Device [IrScreen ca] on usb-0000:01:00.0-1.4/input0
input: IrScreen ca Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:1FF7:0009.0004/input/input5
input: IrScreen ca Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:1FF7:0009.0004/input/input6
hid-generic 0003:1FF7:0009.0004: input,hidraw3: USB HID v1.11 Mouse [IrScreen ca] on usb-0000:01:00.0-1.4/input1
input: IrScreen ca as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:1FF7:0009.0003/input/input7
hid-multitouch 0003:1FF7:0009.0003: input,hiddev97,hidraw2: USB HID v1.11 Device [IrScreen ca] on usb-0000:01:00.0-1.4/input0```

xinput list:
```⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ IrScreen ca                               id=6    [slave  pointer  (2)]
⎜   ↳ IrScreen ca Mouse                         id=7    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ IrScreen ca Keyboard ```                     id=8    [slave  keyboard (3)]

xinput list-props "IrScreen ca"
```Device 'IrScreen ca':
        Device Enabled (135):   1
        Coordinate Transformation Matrix (136): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (263):     0
        Device Accel Constant Deceleration (264):       1.000000
        Device Accel Adaptive Deceleration (265):       1.000000
        Device Accel Velocity Scaling (266):    10.000000
        Device Product ID (267):        8183, 9
        Device Node (268):      "/dev/input/event2"
        Evdev Axis Inversion (269):     0, 0
        Evdev Axis Calibration (270):   <no items>
        Evdev Axes Swap (271):  0
        Axis Labels (272):      "Abs MT Position X" (261), "Abs MT Position Y" (262), "Abs MT Touch Major" (258), "Abs MT Touch Minor" (259), "Abs MT Orientation" (260), "None" (0), "None" (0)
        Button Labels (273):    "Button Unknown" (255), "Button Unknown" (255), "Button Unknown" (255), "Button Wheel Up" (141), "Button Wheel Down" (142)
        Evdev Scrolling Distance (274): 0, 0, 0
        Evdev Middle Button Emulation (275):    0
        Evdev Middle Button Timeout (276):      50
        Evdev Middle Button Button (277):       2
        Evdev Third Button Emulation (278):     0
        Evdev Third Button Emulation Timeout (279):     1000
        Evdev Third Button Emulation Button (280):      3
        Evdev Third Button Emulation Threshold (281):   20
        Evdev Wheel Emulation (282):    0
        Evdev Wheel Emulation Axes (283):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (284):    10
        Evdev Wheel Emulation Timeout (285):    200
        Evdev Wheel Emulation Button (286):     4
        Evdev Drag Lock Buttons (287):  0```


xinput list-props "IrScreen ca Mouse" :
```Device 'IrScreen ca Mouse':
        Device Enabled (135):   1
        Coordinate Transformation Matrix (136): -1.000000, 0.000000, 1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (263):     0
        Device Accel Constant Deceleration (264):       1.000000
        Device Accel Adaptive Deceleration (265):       1.000000
        Device Accel Velocity Scaling (266):    10.000000
        Device Product ID (267):        8183, 9
        Device Node (268):      "/dev/input/event0"
        Evdev Axis Inversion (269):     0, 0
        Evdev Axis Calibration (270):   <no items>
        Evdev Axes Swap (271):  0
        Axis Labels (272):      "Abs X" (256), "Abs Y" (257)
        Button Labels (273):    "Button Left" (138), "Button Middle" (139), "Button Right" (140), "Button Wheel Up" (141), "Button Wheel Down" (142)
        Evdev Scrolling Distance (274): 0, 0, 0
        Evdev Middle Button Emulation (275):    0
        Evdev Middle Button Timeout (276):      50
        Evdev Middle Button Button (277):       2
        Evdev Third Button Emulation (278):     0
        Evdev Third Button Emulation Timeout (279):     1000
        Evdev Third Button Emulation Button (280):      3
        Evdev Third Button Emulation Threshold (281):   20
        Evdev Wheel Emulation (282):    0
        Evdev Wheel Emulation Axes (283):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (284):    10
        Evdev Wheel Emulation Timeout (285):    200
        Evdev Wheel Emulation Button (286):     4
        Evdev Drag Lock Buttons (287):  0```





1

The touchscreen orientation and scaling is handled via the Coordinate Transformation Matrix as described here. Check out the examples for different typical use cases and figure which one you need.

In your case the X axis seems to already be inverted, so rotating by 90 degrees in addition should give (0 1 0 1 0 0 0 0 1) or (0 -1 1 -1 0 1 0 0 1), depending on the rotation direction. Note that you say you want to "get X and Y inverted", which is not the portrait mode but rather hanging the display upside down.

You can change the matrix at runtime using

xinput set-prop 'IrScreen ca Mouse' 'Coordinate Transformation Matrix' <matrix in row-order>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.