Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uhid keyboard - combinaison alt+number ascii #4732

Open
2 tasks done
allamezon opened this issue Mar 6, 2024 · 11 comments
Open
2 tasks done

uhid keyboard - combinaison alt+number ascii #4732

allamezon opened this issue Mar 6, 2024 · 11 comments

Comments

@allamezon
Copy link

allamezon commented Mar 6, 2024

  • I have read the FAQ.

  • I have searched in existing issues.

  • OS: Windows 10 pro

  • scrcpy version: 2.4

  • installation method: Windows release

  • device model:A52s Samsung 5G

  • Android version: 14

I am so greatful for this app. I hope I can contribute to improve this extordinary collaborate app !

The Bug
I discover the 2.4 version. I read about uhid that I tried and it's a great improvement !
But when I try to put the É (alt+144) ascii or may others (alt+128 - Ç), I am desapointed. No character is writen.
However, I would love to keep the keyboard not open each time I have to type words, sentences.

Thank you.
Sébastien
French weird charaters are boring, don't they ? ;-))

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2024

But when I try to put the É (alt+144) ascii or may others (alt+128 - Ç), I am desapointed. No characters are writen.

These combinations are specific to Windows, so that's expected (here the key presses occur on Android).

On Linux, pressing é with CapsLock on yields É, pressing ç with CapsLock on yields Ç. I thought it would be the same on Android, but this is not the case. Therefore, I don't know how to enter É or Ç with a physical keyboard. :/

@allamezon
Copy link
Author

What is strange is when I use the --keyboard=sdk, I can use the combinaison alt+144 (fe), it works.
But when --keyboard=uhid, nothing happens.

You wrote "here the key presses occur on Android" so it means Android understands the pressed key. Is that right ?
:-)

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2024

What is strange is when I use the --keyboard=sdk, I can use the combinaison alt+144 (fe), it works.

Sure, with keyboard sdk, the text is "resolved" on the computer side, then sent to the device.

Run with -Vverbose to see what happens.

@allamezon
Copy link
Author

Mettre Verbose, Romain, ça donne ça (t'es bien français ?) :
Pour Alt 144
VERBOSE: input: UHID input [1] 00 00 00 00 00 00 00 00

Ça te dit quelque chose ?

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2024

It's the release of the Alt key (all others are captured by scrcpy, unless you disable Alt as a shortcut, with --shortcut-mod=lsuper for example).

Btw, there is a problem, Alt release is sent, but not Alt press, so this is inconsistent. I'll look into it how to handle it properly and how it should work along with scrcpy shortcuts. IMO Alt should not be sent at all if it's a scrcpy shortcut.

Mettre Verbose, Romain, ça donne ça (t'es bien français ?) :

Yes, but please write in English, other people read github issues 😉

@allamezon
Copy link
Author

Ok, thank you for the answer.
I don't configure specificly the scrcpy shortcut so this Alt could be disabled. Is it the case by default ? I tried --shortcut-mod=rcrtl to make the lalt free but it doexn't work either. It confirms what you wrote about the alt press : inconsistent.
Hope to hear from you soon.
Great job !

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2024

I tried --shortcut-mod=rcrtl to make the lalt free but it doexn't work either.

What do you mean by "it does not work"? Alt+144 will never work on Android, this is a Windows combination.

@allamezon
Copy link
Author

Answer to your question : as you wrote, I changed the "mod" touch from default lalt to rctrl. The alt+144 didn't work. (I understand your answer : no such touch combinaison in Android)

Ok so when I use uhid keyboard (it doesn't appear) for better interface (more comfortable), it is impossible to find É, Ç, œ, È,... ? Do their letters exist on the Android keyboard ?
Otherwise the only solution is to stay with the sdk keyboard but each time you select a text field, the Android keyboard appears. Not very comfort but the only useful situation.

@rom1v
Copy link
Collaborator

rom1v commented Mar 7, 2024

it is impossible to find É, Ç, œ, È,... ? Do their letters exist on the Android keyboard ?

I did not find a satisfying way on Android. It is the same problem with real physical keyboards (although I did not test).

Ironically, É works with a English (UK) keyboard with AltGr+Shift+e. It seems there are not enough keyboard layout on Android for French (and other languages). Maybe it could be done with other software keyboards?

By comparison, on my computer, I have many layouts available for French:

layouts

(each with different behaviors for AltGr+key)

@allamezon
Copy link
Author

I tried with OpenBoard and Gboard.
No combinaison or keyboard specific touch.
What a pity !

rom1v added a commit that referenced this issue Mar 7, 2024
Restrict shortcut modifiers to be composed of only one item each.

Before, it was possible to select a list of multiple combinations of
modifier keys, like --shortcut-mod='lctrl+lalt,rctrl+rsuper', meaning
that shortcuts would be triggered either by LCtrl+LAlt+key or
RCtrl+RSuper+key.

This was overly generic, probably not used very much, and it prevents to
solve inconsistencies between UP and DOWN events of modifier keys sent
to the device.

Refs #4732 <#4732>
rom1v added a commit that referenced this issue Mar 7, 2024
Never inject keycodes used as shortcut modifiers.

Refs #4732 <#4732>
@rom1v
Copy link
Collaborator

rom1v commented Mar 7, 2024

Btw, there is a problem, Alt release is sent, but not Alt press, so this is inconsistent. I'll look into it how to handle it properly and how it should work along with scrcpy shortcuts. IMO Alt should not be sent at all if it's a scrcpy shortcut.

Fix proposed in PR #4741

rom1v added a commit that referenced this issue Mar 30, 2024
Restrict shortcut modifiers to be composed of only one item each.

Before, it was possible to select a list of multiple combinations of
modifier keys, like --shortcut-mod='lctrl+lalt,rctrl+rsuper', meaning
that shortcuts would be triggered either by LCtrl+LAlt+key or
RCtrl+RSuper+key.

This was overly generic, probably not used very much, and it prevents to
solve inconsistencies between UP and DOWN events of modifier keys sent
to the device.

Refs #4732 <#4732>
rom1v added a commit that referenced this issue Mar 30, 2024
Never inject keycodes used as shortcut modifiers.

Refs #4732 <#4732>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants