Xtr126 / wayland-getevent

GNU General Public License v3.0
27 stars 4 forks source link

Mouse operation is invalid #9

Closed llc0930 closed 3 months ago

llc0930 commented 4 months ago

After I execute the cage, the log contains mouse movement and click records, but waydroid does not respond at all. What could be the problem? Is it because I enabled x11-backend and executed the cage in bspwm?

Xtr126 commented 4 months ago

After I execute the cage, the log contains mouse movement and click records, but waydroid does not respond at all. What could be the problem? Is it because I enabled x11-backend and executed the cage in bspwm?

It must be, I patched only the wayland backend to print input events.

llc0930 commented 4 months ago

I customize the size of wlroots-x11-backend to 1600x900. $ sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui | sh ./w_sh.sh When I move the mouse into the cage, it closes immediately.

output:

[09:45:01] WayDroid session is stopped
[09:45:02] Starting waydroid session
[09:45:02] Skipping clipboard manager service because of missing pyclip package
[09:45:03] Failed to get service waydroidplatform, trying again...
[09:45:11] Android with user 0 is ready
[09:45:11] Established ADB connection to Waydroid device at 192.168.240.112.
-rw-rw---- 1 u0_a170 ext_data_rw 356 2024-05-26 09:44 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh

w_sh.sh:

while [[ -z $(waydroid prop get sys.boot_completed) ]]
  do sleep 1
done
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
exec sudo waydroid shell -- sh /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=1600 --height=900

$ ./build/cage waydroid show-full-ui The command will output:

/dev/input/wl_pointer_motion: EV_ABS ABS_X 13
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 757
/dev/input/wl_pointer_motion: EV_ABS ABS_X 9
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 755
/dev/input/wl_pointer_motion: EV_ABS ABS_X 4
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 754
/dev/input/wl_pointer_motion: EV_ABS ABS_X -1
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 752

Do I need wlroots-confine-pointer for x11?

Xtr126 commented 4 months ago

I customize the size of wlroots-x11-backend to 1600x900. $ sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui | sh ./w_sh.sh When I move the mouse into the cage, it closes immediately.

output:

[09:45:01] WayDroid session is stopped
[09:45:02] Starting waydroid session
[09:45:02] Skipping clipboard manager service because of missing pyclip package
[09:45:03] Failed to get service waydroidplatform, trying again...
[09:45:11] Android with user 0 is ready
[09:45:11] Established ADB connection to Waydroid device at 192.168.240.112.
-rw-rw---- 1 u0_a170 ext_data_rw 356 2024-05-26 09:44 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh

w_sh.sh:

while [[ -z $(waydroid prop get sys.boot_completed) ]]
  do sleep 1
done
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
exec sudo waydroid shell -- sh /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=1600 --height=900

$ ./build/cage waydroid show-full-ui The command will output:

/dev/input/wl_pointer_motion: EV_ABS ABS_X 13
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 757
/dev/input/wl_pointer_motion: EV_ABS ABS_X 9
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 755
/dev/input/wl_pointer_motion: EV_ABS ABS_X 4
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 754
/dev/input/wl_pointer_motion: EV_ABS ABS_X -1
/dev/input/wl_pointer_motion: EV_ABS ABS_Y 752

Do I need wlroots-confine-pointer for x11?

wlroots-confine-pointer patch is not needed. I tested now, X11 backend seems to work fine other than the lack of confining pointer, so I enabled it now. Also ported the wayland custom size patch for x11. Unfortunately without any error or trace or being able to reproduce it myself it's hard to know why it closes for you when pointer enters.

llc0930 commented 4 months ago

wlroots-confine-pointer patch is not needed. I tested now, X11 backend seems to work fine other than the lack of confining pointer, so I enabled it now. Also ported the wayland custom size patch for x11. Unfortunately without any error or trace or being able to reproduce it myself it's hard to know why it closes for you when pointer enters.

I saw patches 4 and 5, I will test them later, thank you. I didn't see the error message. I will try to research again.

llc0930 commented 4 months ago

Patch 5 seems to need fixing...

llc0930 commented 4 months ago

I later discovered that any action that would print out an event would cause cage to close. The current situation is that the mouse remains unresponsive, which seems to be expected. However, keyboard input causes the cage to close.

w_sh.sh:

while [[ -z $(waydroid prop get sys.boot_completed) ]]
  do sleep 1
done
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
sudo waydroid shell -- sh -c 'chmod 660 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
exec sudo waydroid shell -- sh -c "/sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT"

r_cage.sh:

export WLR_NO_DECORATION=1 XTMAPPER_WIDTH=1600 XTMAPPER_HEIGHT=900
sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui | sh ./w_sh.sh

$ ./r_cage.sh output:

[20:13:42] WayDroid session is stopped
[20:13:42] Starting waydroid session
[20:13:42] Skipping clipboard manager service because of missing pyclip package
[20:13:43] Failed to get service waydroidplatform, trying again...
[20:13:51] Android with user 0 is ready
[20:13:51] Established ADB connection to Waydroid device at 192.168.240.112.
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 10:23 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 10:23 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh
sh: /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh: can't execute: Permission denied

r_cage.sh:

export WLR_NO_DECORATION=1 XTMAPPER_WIDTH=1600 XTMAPPER_HEIGHT=900
sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui

$ ./r_cage.sh output:

[20:14:46] Starting waydroid session
[20:14:46] Skipping clipboard manager service because of missing pyclip package
[gbinder] Service manager /dev/anbox-binder has appeared
[20:14:55] Android with user 0 is ready
[20:14:55] Established ADB connection to Waydroid device at 192.168.240.112.
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT UP
/dev/input/wl_keyboard: EV_KEY KEY_DOWN DOWN
/dev/input/wl_keyboard: EV_KEY KEY_DOWN UP
/dev/input/wl_keyboard: EV_KEY KEY_LEFT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_LEFT UP
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT UP
/dev/input/wl_keyboard: EV_KEY KEY_UP DOWN
/dev/input/wl_keyboard: EV_KEY KEY_UP UP
/dev/input/wl_keyboard: EV_KEY KEY_SUPER_L DOWN

Is the problem related to permissions? As you can see, the chmod command in the script doesn't work for some reason. The original permission of xtMapper.sh was 660. When executing waydroid, I entered the command sudo waydroid shell in the terminal to enter the waydroid shell and changed it to 777.

Xtr126 commented 4 months ago

I later discovered that any action that would print out an event would cause cage to close. The current situation is that the mouse remains unresponsive, which seems to be expected. However, keyboard input causes the cage to close.

w_sh.sh:

while [[ -z $(waydroid prop get sys.boot_completed) ]]
  do sleep 1
done
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
sudo waydroid shell -- sh -c 'chmod 660 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
sudo waydroid shell -- sh -c 'ls -al /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh'
exec sudo waydroid shell -- sh -c "/sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT"

r_cage.sh:

export WLR_NO_DECORATION=1 XTMAPPER_WIDTH=1600 XTMAPPER_HEIGHT=900
sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui | sh ./w_sh.sh

$ ./r_cage.sh output:

[20:13:42] WayDroid session is stopped
[20:13:42] Starting waydroid session
[20:13:42] Skipping clipboard manager service because of missing pyclip package
[20:13:43] Failed to get service waydroidplatform, trying again...
[20:13:51] Android with user 0 is ready
[20:13:51] Established ADB connection to Waydroid device at 192.168.240.112.
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 10:23 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 10:23 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh
sh: /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh: can't execute: Permission denied

r_cage.sh:

export WLR_NO_DECORATION=1 XTMAPPER_WIDTH=1600 XTMAPPER_HEIGHT=900
sudo systemctl stop waydroid-container.service && bspc rule -a \* -o state=floating && ./build/cage waydroid show-full-ui

$ ./r_cage.sh output:

[20:14:46] Starting waydroid session
[20:14:46] Skipping clipboard manager service because of missing pyclip package
[gbinder] Service manager /dev/anbox-binder has appeared
[20:14:55] Android with user 0 is ready
[20:14:55] Established ADB connection to Waydroid device at 192.168.240.112.
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT UP
/dev/input/wl_keyboard: EV_KEY KEY_DOWN DOWN
/dev/input/wl_keyboard: EV_KEY KEY_DOWN UP
/dev/input/wl_keyboard: EV_KEY KEY_LEFT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_LEFT UP
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT DOWN
/dev/input/wl_keyboard: EV_KEY KEY_RIGHT UP
/dev/input/wl_keyboard: EV_KEY KEY_UP DOWN
/dev/input/wl_keyboard: EV_KEY KEY_UP UP
/dev/input/wl_keyboard: EV_KEY KEY_SUPER_L DOWN

For me on kwin_x11 there is no issue with keyboard or mouse input. Try with cage from https://github.com/cage-kiosk/cage if you encounter the same issue then it is either cage problem or in your system. Waydroid not responding to keyboard and mouse inputs is expected behavior, after xtMapper.sh is run successfully it should work fine. You can also try running cage with wayland backend inside cage with x11 backend /usr/bin/cage ./build/cage waydroid show-full-ui

Is the problem related to permissions? As you can see, the chmod command in the script doesn't work for some reason. The original permission of xtMapper.sh was 660. When executing waydroid, I entered the command sudo waydroid shell in the terminal to enter the waydroid shell and changed it to 777.

You are using some other command to run xtMapper.sh instead of that in README-alt.md, that’s the problem. Permissions won’t help for sdcard directory in Android, you can’t execute scripts directly.

llc0930 commented 4 months ago

I have tried the original cage and it runs waydroid normally just like weston. I'll try that nesting back and forth when I have time. The problem is that directly copying this command and using it only causes my terminal to be stuck at the prompt symbol...

Xtr126 commented 4 months ago

I have tried the original cage and it runs waydroid normally just like weston. I'll try that nesting back and forth when I have time. The problem is that directly copying this command and using it only causes my terminal to be stuck at the prompt symbol...

I'll tell you what to change then, instead of this command exec sudo waydroid shell -- sh -c "/sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT" use exec sudo waydroid shell -- sh /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT as in README-alt.md. The -c flag you added is what causes the error.

llc0930 commented 4 months ago

I'll tell you what to change then, instead of this command exec sudo waydroid shell -- sh -c "/sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT" use exec sudo waydroid shell -- sh /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT as in README-alt.md. The -c flag you added is what causes the error.

It does no longer complain about lack of permissions, but the cage still closed by pressing the keyboard.

[15:39:25] WayDroid session is stopped
[15:39:25] Starting waydroid session
[15:39:25] Skipping clipboard manager service because of missing pyclip package
[15:39:26] Failed to get service waydroidplatform, trying again...
[15:39:34] Android with user 0 is ready
[15:39:34] Established ADB connection to Waydroid device at 192.168.240.112.
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 20:43 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh
-rwxrwxrwx 1 u0_a170 ext_data_rw 356 2024-05-27 20:43 /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh