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

send key event action when imitating button presses #563

Closed
yyy33 opened this issue Jan 21, 2021 · 70 comments
Closed

send key event action when imitating button presses #563

yyy33 opened this issue Jan 21, 2021 · 70 comments

Comments

@yyy33
Copy link

yyy33 commented Jan 21, 2021

Hello sds100, I use rd client to connect to the remote desktop on my Android phone, and then use the Bluetooth keyboard to connect to my Android phone. But I found that there are some problems when using the keyboard, that is, when I press certain shortcut keys on the keyboard, these shortcut keys will be triggered by the Android system instead of being triggered by the remote computer, such as alt-tab, meta.

In order to solve this problem, I checked a lot of information and finally found the software you developed. I set up a pair of mappings in the software: short press meta key-----meta key. At this time, my remote computer can receive the meta key normally, but cannot use the key combination, such as opening the windows file manager meta-e. Can you teach me how to configure it?

@sds100
Copy link
Collaborator

sds100 commented Jan 21, 2021

Hi! I'm not 100% what the solution is but there is one thing I can think of trying. Can you send a screenshot of your keymaps as they are now?

  1. Install the apk ("artifact") from this CI build https://github.com/sds100/KeyMapper/actions/runs/498957297.
  2. Then create a "Key Event" action and select your keyboard as the device for it. The screenshot below will show you what the screen to create this action will look like.

Screenshot_20210121-131803

@yyy33
Copy link
Author

yyy33 commented Jan 22, 2021

Hi! I'm not 100% what the solution is but there is one thing I can think of trying. Can you send a screenshot of your keymaps as they are now?

  1. Install the apk ("artifact") from this CI build https://github.com/sds100/KeyMapper/actions/runs/498957297.
  2. Then create a "Key Event" action and select your keyboard as the device for it. The screenshot below will show you what the screen to create this action will look like.

Screenshot_20210121-131803

Hello, I downloaded and installed the installation package file you provided. The following screenshot is my configuration, but I still can't use key combination. I don't know what the problem is.
Screenshot_20210122-192820
Screenshot_20210122-192829
Screenshot_20210122-192839
Screenshot_20210122-192847
Screenshot_20210122-192856
Uploading Screenshot_20210122-192907.jpg…
Uploading Screenshot_20210122-193303.jpg…

@sds100
Copy link
Collaborator

sds100 commented Jan 22, 2021

What if you turn on the "hold down" option by pressing the 3 dots on the action.

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

What if you turn on the "hold down" option by pressing the 3 dots on the action.

Is it set up like this? Still the same as before.

Screenshot_20210123-084347

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

You didn't have the hold down option turned on before.
And can you choose a device for the Key Event action like in my screenshot.

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

You didn't have the hold down option turned on before.
And can you choose a device for the Key Event action like in my screenshot.

Yes, I can see my Bluetooth keyboard in the device list, and I chose it.

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

keymapper-2.3.0-alpha-debug.zip
Uninstall the old debug build and install this one.
This apk will intercept all key events and then send them through the Key Mapper Debug Basic Input Method.
Turn on the accessibility service and you must choose the Key Mapper Debug Basic Input Method. You know it is working if your volume buttons aren't working. You don't need to create any keymaps just press the shortcut into your rd client. I want to see if passing along the system's key events will work.

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

keymapper-2.3.0-alpha-debug.zip
Uninstall the old debug build and install this one.
This apk will intercept all key events and then send them through the Key Mapper Debug Basic Input Method.
Turn on the accessibility service and you must choose the Key Mapper Debug Basic Input Method. You know it is working if your volume buttons aren't working. You don't need to create any keymaps just press the shortcut into your rd client. I want to see if passing along the system's key events will work.

Ha ha, it works. The remote computer can normally receive all key sequences on my Bluetooth keyboard, including combination keys.

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

Cool. That's a good start. Can you install this app and press the key shortcuts with the accessibility service of the last apk turned on and then with it off. Then send me a screenshot of the full output.
keyevent-viewer-deviceid-source.zip

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

Cool. That's a good start. Can you install this app and press the key shortcuts with the accessibility service of the last apk turned on and then with it off. Then send me a screenshot of the full output.
keyevent-viewer-deviceid-source.zip

Of course, when the accessibility service is turned on, the software does not have any output. When the accessibility service is turned off, if I press meta-e quickly, the following output will be generated. However, if the speed is not very fast, there will be no output

Press buttons to see the keycodes:
KeyUp       : action=1 code=33 repeat=0 meta=0 scanCode=18 flags=8 label='69' chars='null' number='0' deviceId='9' source='769'

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

Did you choose the Basic Input Method when you turned the accessibility service on? it should work.

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

Did you choose the Basic Input Method when you turned the accessibility service on? it should work.

No,i don't.Let me try again

Press buttons to see the keycodes:
KeyDown     : action=0 code=117 repeat=0 meta=196608 scanCode=125 flags=0 label='0' chars='null' number='0' deviceId='10' source='769'
KeyDown     : action=0 code=33 repeat=0 meta=196608 scanCode=18 flags=0 label='69' chars='null' number='0' deviceId='10' source='769'
KeyUp       : action=1 code=33 repeat=0 meta=196608 scanCode=18 flags=0 label='69' chars='null' number='0' deviceId='10' source='769'
KeyUp       : action=1 code=117 repeat=0 meta=0 scanCode=125 flags=0 label='0' chars='null' number='0' deviceId='10' source='769'
-------------------------
-------------------------
-------------------------
KeyUp       : action=1 code=33 repeat=0 meta=0 scanCode=18 flags=8 label='69' chars='null' number='0' deviceId='10' source='769'

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

How come there is only a KeyUp if you press the shortcut without the accessibility service turned on? There should be 4 events - down and up for both Meta and E

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

How come there is only a KeyUp if you press the shortcut without the accessibility service turned on? There should be 4 events - down and up for both Meta and E

I tried many times and there was only one. And I'm still pressing the shortcut key quickly. If I press a little bit slowly, nothing will be output. Is it related to voice assistant? When I press the meta key alone, the voice assistant is turned on and there is no output.

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

ohhhh, of course! sorry

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

How come there is only a KeyUp if you press the shortcut without the accessibility service turned on? There should be 4 events - down and up for both Meta and E

My device has root permissions. I have given root permissions to the software that tests the buttons.

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

yeah, its fine. i forgot that the keyevents were being consumed by the system 😄

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

I'm working on a fix now...

@yyy33
Copy link
Author

yyy33 commented Jan 23, 2021

I'm working on a fix now...

Hard work, come on.🌹

@sds100
Copy link
Collaborator

sds100 commented Jan 23, 2021

keymapper-2.3.0-alpha-debug.zip
try this apk. do what you were first doing by remapping the meta key to the meta key. you must have the "hold down" option turned on for the meta key code action. you don't need to set the device or anything.

@sds100 sds100 changed the title Ask about the key mapping. send key event action when imitating button presses Jan 23, 2021
@yyy33
Copy link
Author

yyy33 commented Jan 24, 2021

keymapper-2.3.0-alpha-debug.zip
try this apk. do what you were first doing by remapping the meta key to the meta key. you must have the "hold down" option turned on for the meta key code action. you don't need to set the device or anything.

Remote desktop can receive shortcut keys normally. But I found some small problems. The first one is that when I press the shortcut key meta-e at a very fast speed, the effect on the remote desktop is equivalent to pressing meta alone, then releasing, then pressing E alone, and then releasing. The second problem is that if I use the Bluetooth keyboard to directly connect to my remote computer, at this time I keep pressing and holding the meta key. Only when I release it will the windows application menu interface be opened. But when I use the Bluetooth keyboard to connect to the Android phone and use the Android phone to connect to my computer remotely, if I keep holding down the meta key, before I release it, the windows application menu interface will be opened in two or three seconds.

@sds100
Copy link
Collaborator

sds100 commented Jan 24, 2021

keymapper-2.3.0-alpha-debug.zip
this should have fixed the issues

@yyy33
Copy link
Author

yyy33 commented Jan 24, 2021

keymapper-2.3.0-alpha-debug.zip
this should have fixed the issues

When I install, I am prompted that the installation package is invalid. No operating system is incompatible. My operating system is 8.0😂

@sds100
Copy link
Collaborator

sds100 commented Jan 24, 2021

ohh oops. sent wrong one i think...

@sds100
Copy link
Collaborator

sds100 commented Jan 24, 2021

keymapper-2.3.0-alpha-debug.zip
does this work?

@yyy33
Copy link
Author

yyy33 commented Jan 24, 2021

keymapper-2.3.0-alpha-debug.zip
does this work?

This installation package can't use shortcut keys, just like the release version.

@sds100
Copy link
Collaborator

sds100 commented Jan 24, 2021

You're using the basic input method?

@yyy33
Copy link
Author

yyy33 commented Jan 24, 2021

You're using the basic input method?

yes ,i did

@sds100
Copy link
Collaborator

sds100 commented Jan 24, 2021

try this apk
keymapper-2.3.0-alpha-debug_1.zip

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

keymapper-2.3.0-alpha-debug.zip
does this work?

Or can only short press, can't use shortcut keys.😴

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

What! 😂 I swear it worked in the Microsoft Remote Desktop app for me. I could use Win+E to open File Explorer and Win+R to open the Run dialog.

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

What! 😂 I swear it worked in the Microsoft Remote Desktop app for me. I could use Win+E to open File Explorer and Win+R to open the Run dialog.

😭Is there something wrong with my mobile phone? I remember I succeeded once. But there's a little bit of a problem. That's the one.

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Did you change anything? You were right, the other apks didn't work for me either. The one you said that worked didn't seem to either. The one which just passed through all Key Events did work.

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

This version can work normally, but there are some small problems I mentioned.

Did you change anything? You were right, the other apks didn't work for me either. The one you said that worked didn't seem to either. The one which just passed through all Key Events did work.

This version can work normally, but there are some small problems I mentioned.
Uploading IMG_20210127_211246.jpg…

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Can you make sure the image is uploaded before posting the comment. I've done the same as well

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Can you make sure the image is uploaded before posting the comment. I've done the same as well

Can you see the picture now? My mobile browser doesn't seem very smart
Uploading IMG_20210127_211246.jpg…

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Nope at first the link will say "Uploading [image name]...." and when it doesn't say "Uploading" anymore you need to send the message.

@yyy33 yyy33 closed this as completed Jan 27, 2021
@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Closed?

@yyy33 yyy33 reopened this Jan 27, 2021
@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Closed?

No, my browser is too laggy. It should be wrong.

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Nope at first the link will say "Uploading [image name]...." and when it doesn't say "Uploading" anymore you need to send the message.
Now you should be able to see the pictures. I uploaded them on my computer instead.
Photo_0127_1a

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

So you can you use the shortcuts at all in the latest apk that I sent?

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

So you can you use the shortcuts at all in the latest apk that I sent?

No, only the installation package in the picture I sent can use shortcut keys.

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

keymapper-2.3.0-alpha-debug_1.zip
I sent you the wrong apk. 😂 Sorry that this is taking so long

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

keymapper-2.3.0-alpha-debug_1.zip
I sent you the wrong apk. 😂 Sorry that this is taking so long

😂😂😂
The shortcut key is normal, but I found that there are two shortcut keys with a little problem. meta -enter and meta-backspace are used as home key and back key in my mobile phone system. When I turn on mapping, other shortcut keys of remote desktop are normal, but as soon as I press the above two shortcut keys, Android system will respond to these two shortcut keys, and will respond repeatedly. As a result, my mobile phone has been pressing the home key or back key. Just now my mobile phone couldn't do anything until I forced it to turn off.😥

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Do you need to use Meta-Enter as a shortcut?

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

Screenshot_20210127-173156589
Make these shortcuts by pressing meta-enter to create a "home" trigger and meta-backspace to create a "back" trigger. I could open Narrator on Windows with the Ctrl+meta+enter shortcut after doing this.

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Do you need to use Meta-Enter as a shortcut?

Well, when I use VNC to connect to Linux, I often need to use meta-enter to open the shell

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Screenshot_20210127-173156589
Make these shortcuts by pressing meta-enter to create a "home" trigger and meta-backspace to create a "back" trigger. I could open Narrator on Windows with the Ctrl+meta+enter shortcut after doing this.

Why do you have the back key on your physical keyboard? As I said before, the home and back keys are the keys of my mobile phone.

@yyy33
Copy link
Author

yyy33 commented Jan 27, 2021

Screenshot_20210127-173156589
Make these shortcuts by pressing meta-enter to create a "home" trigger and meta-backspace to create a "back" trigger. I could open Narrator on Windows with the Ctrl+meta+enter shortcut after doing this.

Why do you have the back key on your physical keyboard? As I said before, the home and back keys are the keys of my mobile phone.

I can't find the back key on my Bluetooth keyboard

Screenshot_20210127-173156589
Make these shortcuts by pressing meta-enter to create a "home" trigger and meta-backspace to create a "back" trigger. I could open Narrator on Windows with the Ctrl+meta+enter shortcut after doing this.

I can't find the back key on my Bluetooth keyboard

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

When you press meta-backspace Android treats that shortcut as the "back button". meta-enter is the "home button".

@sds100
Copy link
Collaborator

sds100 commented Jan 27, 2021

So if you press those shortcuts while making a trigger Key Mapper thinks you have pressed the back/home button.

@yyy33
Copy link
Author

yyy33 commented Jan 28, 2021

So if you press those shortcuts while making a trigger Key Mapper thinks you have pressed the back/home button.

Thank you so much. Now I can play computer happily in bed. ha-ha.

@yyy33
Copy link
Author

yyy33 commented Jan 28, 2021

So if you press those shortcuts while making a trigger Key Mapper thinks you have pressed the back/home button.
Will you add this feature to the release version?

@sds100
Copy link
Collaborator

sds100 commented Jan 29, 2021

I will add this to the 2.2 release and release Beta 2 today to the play store

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