droidVncServer icon indicating copy to clipboard operation
droidVncServer copied to clipboard

[SGS II] Keybinding only work when followed by a left click

Open OphyTe opened this issue 12 years ago • 17 comments

Hi,

I use this VNC server for a few days now and I found this anoying bug which force me to always make a left click after any key I press (page up for menu for instance) !

OphyTe avatar Aug 31 '12 12:08 OphyTe

Me too!!

For the HTC Hero, things are all very well. But for the HTC sensation XE, the bug happened. They both open uinput at the path /dev/uinput. But with different reactions. Why?

hyhjcjy avatar May 07 '13 06:05 hyhjcjy

Are the permissions set to read and write?

On Tue, May 7, 2013 at 2:48 AM, hyhjcjy [email protected] wrote:

Me too!!

For the HTC Hero, things are all very well. But for the HTC sensation XE, the bug happened. They both open uinput at the path /dev/uinput. But with different reactions. Why?

— Reply to this email directly or view it on GitHubhttps://github.com/oNaiPs/droid-VNC-server/issues/42#issuecomment-17526070 .

agronick avatar May 07 '13 21:05 agronick

How to check?

But I don't think it's the problem of permissions, it can send key, but binding with a left click...

hyhjcjy avatar May 08 '13 09:05 hyhjcjy

Reproduces on my HTC Desire C, OS: 4.0.3

alvin777 avatar May 26 '13 14:05 alvin777

Calling suinput_write(inputfd, EV_SYN, SYN_REPORT, 0); after ret=suinput_press(inputfd,code); and ret=suinput_release(inputfd,code); fixes the issue for me

alvin777 avatar May 26 '13 15:05 alvin777

Thanks so much to alvin777 !!! You really fix the problem!!!! :+1:

HTC Sensetion XE, OS:4.0.3

hyhjcjy avatar May 27 '13 01:05 hyhjcjy

BTW, do you have the following situation?

For my HTC Sens, the touch screen control: there's a "spot" to be drag to the right place if I want to do click. But for my HTC Hero, it is "touch-and-play".

Why they are different??

(Hope you can understand my question, sorry for poor English.)

hyhjcjy avatar May 27 '13 02:05 hyhjcjy

The build I installed from Google Play was "touch and play", but the one I built myself has that spot. I'm going to investigate that next weekend.

alvin777 avatar May 27 '13 03:05 alvin777

I see, thank you for your kindly reply :)

hyhjcjy avatar May 27 '13 04:05 hyhjcjy

Ok, this one was tougher. According to http://source.android.com/tech/input/touch-devices.html propbit INPUT_PROP_DIRECT should be set explicitly. This could be done in suinput_open with:

if (ioctl(uinput_fd, UI_SET_PROPBIT, INPUT_PROP_DIRECT) == -1)
    goto err;    

The catch is that neither UI_SET_PROPBIT nor INPUT_PROP_DIRECT defined in Android NDK. It could be copypasted from https://github.com/quarck/csetup/blob/master/csetup/jni/input.h

#define UI_SET_PROPBIT      _IOW(UINPUT_IOCTL_BASE, 110, int)
#define EVIOCGPROP(len)     _IOC(_IOC_READ, 'E', 0x09, len)
#define INPUT_PROP_POINTER      0x00
#define INPUT_PROP_DIRECT       0x01
#define INPUT_PROP_BUTTONPAD    0x02
#define INPUT_PROP_SEMI_MT      0x03
#define INPUT_PROP_MAX          0x1f
#define INPUT_PROP_CNT          (INPUT_PROP_MAX + 1)

This fix works for me.

alvin777 avatar May 27 '13 13:05 alvin777

Yes! It works for me, too!! Thank you sooooooo much :smile:

hyhjcjy avatar May 28 '13 07:05 hyhjcjy

Oops! But the HTC Hero (OS: 2.x) becomes view only.

hyhjcjy avatar May 28 '13 07:05 hyhjcjy

Most likely ioctl line returns error. I think you can safely remove return value check here.

alvin777 avatar May 28 '13 08:05 alvin777

It seems that Adroid change the input control from 4.x, but the EVIOCGPROP ioctl only support by kernel 3.x. My HTC hero is the kernel of 2.6. So this

if (ioctl(uinput_fd, UI_SET_PROPBIT, INPUT_PROP_DIRECT) == -1) goto err;

would return error.

But if I remove the return value, the Android 4.0 phone becomes view only. @@

hyhjcjy avatar May 28 '13 08:05 hyhjcjy

Guys try to pull the changes from the forked master https://github.com/rbrune/droid-VNC-server/commit/b7db761f13297f00f060a4d3e714c93e8794594b

That should fix the "touch and play" issue

ghost avatar May 28 '13 08:05 ghost

Sorry, my fault. I cannot just remove the return line. It should leave a semicolon for the if statement.

if (ioctl(uinput_fd, UI_SET_PROPBIT, INPUT_PROP_DIRECT) == -1) ;

Then the two phones both work! (HTC Sensation XE ,4.0.3 & HTC hero, 2.x) Thanks to alvin777 again! You really help a lot!

hyhjcjy avatar May 28 '13 09:05 hyhjcjy

I'd leave just:

ioctl(uinput_fd, UI_SET_PROPBIT, INPUT_PROP_DIRECT)

You are welcome :)

alvin777 avatar May 28 '13 09:05 alvin777