Make USB Mouse working with Qt sample applications

First make sure your Linux kernel has support for USB mouse (the default kernel should have):
CONFIG_INPUT_MOUSEDEV
CONFIG_USB
CONFIG_USB_SUPPORT
CONFIG_USB_HID
CONFIG_USB_DEVICEFS

To check this on your running kernel, just hotplug the USB mouse an type:
# dmesg | grep -i usb
output should contain things similar to:
hub 1-0:1.0: USB hub found
hub 2-0:1.0: USB hub found
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usb 2-1.4: new low speed USB device using fsl-ehci and address 3
input: Microsoft Microsoft 3-Button Mouse with IntelliEye(TM) as /devices/platform/fsl-ehci.1/usb2/2-1/2-1.4/2-1.4:1.0/input/input2
generic-usb 0003:045E:0040.0001: input: USB HID v1.10 Mouse [Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)] on usb-fsl-ehci.1-1.4/input0


Now check which input device is assigned to your mouse:
# cat /sys/class/input/mouse*/device/name

e.g. when testing on Wi-i.MX53 it was "mouse1". Set the QT environment variables accordingly, e.g.:
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouse1"

now tetris should work with your USB mouse:
# /usr/bin/qt-embedded/tetrix -qws

You may also use USB mouse AND touch at the same time by providing several parameters to QWS_MOUSE_PROTO, see /etc/profile.d/touchscreen.sh (remove comment in QWS_MOUSE_PROTO line, and modify line accordingly), to make your change permanent after reboot.
Last updated: Jan 01, 2024

Recently Viewed

No recently viewed articles

Did you find this article helpful?