QWS_MOUSE_PROTO: Connect USB mouse after start of QT app

Markus Mehlan
Hi,

if I connect a usb mouse after the QT application has already started, the
mouse won't be recognized by the QT application.

My variable QWS_MOUSE_PROTO is as follows:
export QWS_MOUSE_PROTO="Tslib:/dev/input/event1 MouseMan:/dev/input/mouse1"

If I connect the mouse before I start my QT app, everything works fine
 (touchscreen + mouse). How can I solve this problem?

Regards,
Markus

davef
Using the kernel and rootfs built with PTdist 2011.07.0 mine does.

Maybe,

export QWS_MOUSE_PROTO="IntelliMouse:/dev/input/mice
Tslib:/dev/input/event1

Have you got "mice"?  That works as well as the stylus.  Maybe, mouse will
work in your case.

HTH,
Dave

Markus Mehlan
Hi Dave,

yes, this works, but it causes another problem. The touchscreen events
and the mice events bite one another. The effect is that the
mouse pointer moves some pixels around the point at which I press
the stylus. And often the mouse pointer jumps to a different control.

I also use ptxdist 2011.07.0. and the last BSP from pengutronix.

Regards,
Markus

davef
Mine seems to track well if I press down on the screen. If I lightly touch
the stylus it can be displaced, as you mention.

There has been a lot of discussion on trying to get finger presses to work
properly, maybe tweaking some of the variables in /etc/ts.conf or adding
some other parameters.

My keyboard stopped working after this experiment!  Looks like even with my
setup you gotta leave some of the USB devices plugged in before powering
up.

Good luck.
Dave.

Markus Mehlan
Hi Dave,

can you send me your kernel config?

Regards,
Markus

Dave Festing
Attachment: kernelconfig-2.6.39.zip (49.34 KB)
Markus,

Read comment about Qt and hotplugging.  I'll clarify what I did at this
end. Unlpug USB mouse, fire up the board, ran a Qt /demo/browser app,
stylus works, USB keyboard doesn't work (!), plugging USB mouse and it
works.  Keyboard still non-functional after plugging mouse in.

Remove the .zip extension.

Dave

Dave Festing
Attachment: profile.zip (1.1 KB)
Further,

If I leave mouse plugged in and disconnect the keyboard as soon as 
I tell the app to run and plug the keyboard in after the app is running it
doesn't work. The mouse keeps working.

Appears to be something to do with the USB devices.

My /etc/profile.environment is attached.
Dave

Juergen Beisert
Dave,

if you point Qt to device nodes that are created only if a hotplug device
appears it can't work. For the keyboard you should use a tty instead,
because it collects the input events from any connected (or in future
connected) device and forwards it to the app.
For the touchscreen and/or mouse I guess the same happens with the
"/dev/input/mice" devnode.

Markus Mehlan
Hi Dave,

MINI2440_KEYEVENT=/dev/input/event3
export QWS_KEYBOARD=LinuxInput:${MINI2440_KEYEVENT}

The name of the event depends on the order of plugging in
the devices.

/dev/input/event0 -> touchscreen
/dev/input/event1 -> gpio-buttons
/dev/input/event2 -> usb-mouse or usb-keyboard
/dev/input/event3 -> usb-mouse or usb-keyboard

I use the following environment and i can plug in the
usb keyboard before or after starting the qt app.
When the app is running I can plug out an in the keyboard
and it works.

export QWS_KEYBOARD=TTY:/dev/tty1

But my problem is the mouse. "IntelliMouse:/dev/input/mice"
supports hotplugging, but the events "/dev/input/mice" and
"/dev/input/event1" disturb one another. This means the mouse
pointer moves nervy or jumps suddendly. 

Here is the start script for my app.
Please test with two configurations:

1: export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mice"
2: export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mouse1"

--------------------------------------------------------------------------
#!/bin/sh
# Mini2440 related settings
MINI2440_FBDEV=/dev/fb0
MINI2440_KEYEVENT=/dev/input/event0
MINI2440_TOUCHEVENT=/dev/input/event1

# touchscreen relevant settings

if grep -q "mini2440=3" /proc/cmdline ; then
        # this size is for the portrait 240 x 320 display of type
"TD035STED4"
        # change it, if you are using another display (sizes are in [mm])
        MINI2440_LCD_WIDTH=55
        MINI2440_LCD_HEIGHT=71
        # Rotate screen
        export
QWS_DISPLAY=LinuxFb:mmWidth=${MINI2440_LCD_WIDTH}:mmHeight=${MINI2440_LCD_HEIGHT
}
        export QWS_SIZE=240x320
        echo "Display x35 (TD035STED4) Portrait mode 240x320"
elif grep -q "mini2440=5" /proc/cmdline ; then
        # this size is for the portrait 240 x 320 display of type
"ACX502BMU"
        # change it, if you are using another display (sizes are in [mm])
        MINI2440_LCD_WIDTH=55
        MINI2440_LCD_HEIGHT=71
        # Rotate screen
        export
QWS_DISPLAY=LinuxFb:mmWidth=${MINI2440_LCD_WIDTH}:mmHeight=${MINI2440_LCD_HEIGHT
}
        export QWS_SIZE=240x320
        echo "Display x35 (ACX502BMU) Portrait mode 240x320"
elif grep -q "mini2440=6" /proc/cmdline ; then
        # this size is for the portrait 240 x 320 display of type
"LCDN3502"
        # change it, if you are using another display (sizes are in [mm])
        MINI2440_LCD_WIDTH=71
        MINI2440_LCD_HEIGHT=54
        # Rotate screen
        export
QWS_DISPLAY=Transformed:LinuxFb:mmWidth=${MINI2440_LCD_WIDTH}:mmHeight=${MINI244
0_LCD_HEIGHT}:Rot90
        export QWS_SIZE=320x240
        echo "Display w35i (LQ035Q1DG06) Landscape mode 320x240"
fi

export TSLIB_TSDEVICE=${MINI2440_TOUCHEVENT}
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=${MINI2440_FBDEV}
#export TSLIB_CALIBFILE=/etc/pointercal
#export TSLIB_CONFFILE=/etc/ts.conf
#export TSLIB_PLUGINDIR=/usr/lib/ts

#export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mice"
export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mouse1"
#export QWS_KEYBOARD=LinuxInput:${MINI2440_KEYEVENT}
export QWS_KEYBOARD=TTY:/dev/tty1
--------------------------------------------------------------------------

Regards,
Markus

davef
Juergen,

Thanks for that clarification.  I hadn't ticked that box during my Qt
browser build.  Next time I build it I'll give it a try.

It is not a problem for me I just leave the keyboard and mouse plugged in
all the time :)

Dave

davef
Markus,

Your post slipped in while I was answering Juergen.

Did test 1 and 2. Test 1 behaves normally for me.  The second one the mouse
is OK, but the stylus causes the cursor to jump to random places across the
screen.

Do you expect me to do anything with the script or is it just for my
information?

Dave

Markus Mehlan
Dave,

1: export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mice"
2: export QWS_MOUSE_PROTO="Tslib:${MINI2440_TOUCHEVENT}
MouseMan:/dev/input/mouse1"

My stylus causes the cursor to jump with the first test
( /dev/input/mice ). Did you mean the same?

The script was just for your information.

Markus

Juergen Beisert
Dave, Markus,

you should try without the touchscreen as a devnode. Only try with the mice
device and enable the touchscreen-to-mouse-emulation in the kernel. Maybe
this would help you to work with one device only.

Markus Mehlan
Juergen,

export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice"

The usb mouse works as expected, but the cursor doesn't follow the stylus.
The cursor moves somewhere on the screen

Markus

Juergen Beisert
Hi Markus,

it works as I promised. But it needs very strange patches of the
touchscreen driver. For example X and Y positions have to be swapped and
the Y position must be inverted. And INPUT_MOUSEDEV must be Y and
INPUT_MOUSEDEV_SCREEN_X/INPUT_MOUSEDEV_SCREEN_Y must contain your screen
resolution (so, one kernel cannot be used for different screen sizes).

But after these changes Qt can work with only the 'export
QWS_MOUSE_PROTO="IntelliMouse:/dev/input/mice"' for both input devices. And
you can remove the USB mouse and re-attach it and it still works as
expected.

davef
Good morning,
****
My stylus causes the cursor to jump with the first test
( /dev/input/mice ). Did you mean the same?
****

No.  The first test behaved like my setup.  You do have to firmly press
with the stylus. If you touch the screen lightly the cursor can jump around
the proper location a bit.  

The 2nd test was totally non-functional.  The cursor would move to random
places on the screen and the relationship of cursor position with respect
to the mouse movement is . . . well let's say "is not apparent to me"!

***
The effect is that the
mouse pointer moves some pixels around the point at which I press
the stylus.
***

A few pixels is a pretty small displacement. I'd say my stylus contact
point and the stylus track within 1-2mm on an N35 screen, with a reasonable
press on the screen.

Which display are you using? There could be differences in behaviour
between different touchscreens.

Dave

Markus Mehlan
Dave,

I have got three different 3.5in displays:
w35i    LQ035Q1DG06
x35     ACX502BMU
t35     TD035STED4

All of them have the same behaviour in relation to the touch screen.
The w35i has to be rotated for my app, because it's in landscape mode.


Juergen,

I don't know, if it is a good idea to patch the kernel driver for a
dedicated display. Then I have to make different kernels for different
3,5inch displays. I only want to change the boot parameter mini2440
at barebox.
Now I will just restart my app after connecting an usb mouse.

So long. I won't have access to the hardware the next 3 weeks,
because we make our vacation in Denmark.

Sushant
hello,
the usb mouse not work in mini2440 

SET ENV variable is :
export QTDIR=/usr/local/Qt
export QWS_MOUSE_PROTO=tslib:/dev/event1 -- mouse
#export QWS_MOUSE_PROTO=tslib:/dev/event0 ---touch screen 
 export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_TSDEVICE=/usr/local/tslib/lib/ts
export TSLIB_TSEVENTTYPE=INPUT

Juergen Beisert
Qt -> RTFM