Arian04 / android-hid-client

Android app that allows you to use your phone as a keyboard and mouse WITHOUT any software on the other end (Requires root)
GNU General Public License v3.0
109 stars 4 forks source link

Notify user when existing character device is not configured as expected (might've been created by some other app) and prompt to fix it #14

Open Arian04 opened 8 months ago

Arian04 commented 8 months ago

From @404LiverNotFound in this comment

Describe the bug v1.0.0-beta.4 works well, but every key is sent with l_ctrl key pressed in v1.0.0.

Device details (please complete the following information):

Logs (from wev) Input: A

Logs:

[14:     wl_keyboard] key: serial: 5965; time: 2827541; key: 37; state: 1 (pressed)
                      sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000004: Control 
                      latched: 00000000
                      locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5967; time: 2827541; key: 38; state: 1 (pressed)
                      sym: a            (97), utf8: ''
[14:     wl_keyboard] key: serial: 5968; time: 2827541; key: 37; state: 0 (released)
                      sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5970; time: 2827541; key: 38; state: 0 (released)
                      sym: a            (97), utf8: ''
[14:     wl_keyboard] key: serial: 5971; time: 2827542; key: 37; state: 1 (pressed)
                      sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000004: Control 
                      latched: 00000000
                      locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5973; time: 2827544; key: 37; state: 0 (released)
                      sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000010: Mod2
Arian04 commented 8 months ago

I can't reproduce this.

Details Phone: Pixel 5, running lineageOS 20 Computer: Archlinux, up to date as of yesterday. I believe key events are handled by the compositor on Wayland, so I'll include that I'm using Kwin (KDE Plasma). Keyboard: Hacker's Keyboard App Version: I grabbed the v1.0.0 APK straight off the releases page and fully uninstalled my previous version of the app and installed the fresh APK

My wev logs (Annotated, nothing ommitted) ``` [07: wl_seat] capabilities: pointer keyboard touch [07: wl_seat] name: [10: xdg_toplevel] configure: width: 0; height: 0 [09: xdg_surface] configure: serial: 93390 [14: wl_keyboard] repeat_info: rate: 25 keys/sec; delay: 660 ms [14: wl_keyboard] keymap: format: 1 (xkb v1), size: 64756 [13: wl_pointer] enter: serial: 93391; surface: 3, x, y: 596.000000, 479.000000 [13: wl_pointer] frame [14: wl_keyboard] enter: serial: 93395; surface: 3 ' sym: Return (65293), utf8: ' [14: wl_keyboard] modifiers: serial: 0; group: 0 depressed: 00000000 latched: 00000000 locked: 00000000 [11: wl_data_device] data_offer: id: 4278190080 [4278190080: wl_data_offer] offer: mime_type: text/plain [4278190080: wl_data_offer] offer: mime_type: application/x-kde-onlyReplaceEmpty [4278190080: wl_data_offer] offer: mime_type: text/plain;charset=utf-8 [4278190080: wl_data_offer] source_actions: actions: 0 (none) [11: wl_data_device] selection: id: 4278190080 [10: xdg_toplevel] configure: width: 640; height: 480 activated [09: xdg_surface] configure: serial: 93398 [14: wl_keyboard] key: serial: 93399; time: 151600607; key: 36; state: 0 (released) sym: Return (65293), utf8: '' ``` Everything above here is just from it starting up. The Return release was ofc from me releasing Enter after running the command ``` [14: wl_keyboard] key: serial: 93400; time: 151610902; key: 50; state: 1 (pressed) sym: Shift_L (65505), utf8: '' [14: wl_keyboard] modifiers: serial: 0; group: 0 depressed: 00000001: Shift latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 93402; time: 151610902; key: 38; state: 1 (pressed) sym: A (65), utf8: 'A' [14: wl_keyboard] key: serial: 93403; time: 151610904; key: 50; state: 0 (released) sym: Shift_L (65505), utf8: '' [14: wl_keyboard] modifiers: serial: 0; group: 0 depressed: 00000000 latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 93405; time: 151610904; key: 38; state: 0 (released) sym: a (97), utf8: '' ``` The above output was from sending a capital A (only `A`) using Direct Input (I hit Shift, then A on Hacker's Keyboard). Below, I typed an `A` into Manual Input and sent it. This should be soft keyboard independent. ``` [14: wl_keyboard] key: serial: 93406; time: 151614420; key: 50; state: 1 (pressed) sym: Shift_L (65505), utf8: '' [14: wl_keyboard] modifiers: serial: 0; group: 0 depressed: 00000001: Shift latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 93408; time: 151614420; key: 38; state: 1 (pressed) sym: A (65), utf8: 'A' [14: wl_keyboard] key: serial: 93409; time: 151614422; key: 50; state: 0 (released) sym: Shift_L (65505), utf8: '' [14: wl_keyboard] modifiers: serial: 0; group: 0 depressed: 00000000 latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 93411; time: 151614422; key: 38; state: 0 (released) sym: a (97), utf8: '' ``` Output seems the same between Direct and Manual input modes.

As you can see, I can't reproduce the issue. I tried to be very thorough in explaining my exact process, so if you notice that way you reproduced the issue was different from the way I attempted to, let me know.

Arian04 commented 8 months ago

ideas:

$ localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: (unset)
X11 Layout: (unset)

As you can see I also included the output I got so we can compare.

Arian04 commented 7 months ago

Just had another idea, did you change the CTRL setting that I mention in the readme?

404LiverNotFound commented 7 months ago

I did change the settings in README. After further testing, I believe the issue here is creating the character device with USB gadget tool in the first place. Everything works as intended only when I create a character device in the app. Switching between the default gadget and the keyboard gadget in USB gadget tool afterwards does not cause any problems.

Details

Arian04 commented 7 months ago

yup I create the char device in a special way that's different than that app does it. I did it that way so mine can send extra keys like multimedia keys. so it's expected behavior that using an unexpectedly different device will cause some issues. glad we could figure it out. maybe I'll see if I can recreate the char device if I detect that it's not correct