0

I'm running Android on a mobile device, but I really just use it as a computer. I have a wireless mouse/keyboard that I use to navigate windows, etc. The keyboard works well generally, but I find some features lacking. I really would like to map keypresses to the touch screen input. i.e. I can set W to send touch input from a part of the screen given by the pixel location or some such thing.

I have a background in computer system, so I'm not afraid to get my hands dirty. I am willing to root the device, install programs, or build in some additional hardware. I can probably do it from scratch, but I really would like to not waste that much time on it.

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
ragnvaldr.js
  • 103
  • 1
  • 1
  • 3

4 Answers4

3

If you are willing to use a PC as the interface.

There appears to exist a modified version of the open-source scrcpy which has keyboard shortcut support for playing games, but should partially map to your requirement:

QtScrcpy - gitee repo or QtScrcpy - github repo

See project README for keyboard mapping feature: https://github.com/barry-ran/QtScrcpy/blob/master/README.md

README image of PUBG with keyboard shortcuts

It looks promising. Unfortunately I haven't used it, and while open source, most of the project UI/documentation isn't in English.

The issue thread for the keyboard mapping feature for scrcpy:

https://github.com/Genymobile/scrcpy/issues/712

you might want to look there for more options.

Morrison Chang
  • 4,983
  • 1
  • 22
  • 25
1

Although this question has an accepted answer, I just thought I could add another option, for others looking for something like this.

You could use an automation app like Automate, Macrodroid, Tasker or Automagic(development stopped), to listen for the specific keyboard input, and execute the touch action.

Trigger: keyboard input Constraints/conditions: external keyboard sends input Action: UI interaction - touch screen

(Trigger constraints and actions are called differently in different apps.)

Manish S
  • 111
  • 1
  • 1
1

You can read mouse and keyboard data from /dev/input/event* and write data into touchScreen by write data into /dev/input/event* , use EVIOCGRAB to prevent event send to other program . Here is a simple tool for example https://github.com/DriverLin/mouse-keyboard-map-touch

Dr UMR
  • 11
  • 1
  • Hi, thanks for your contribution, but looks like the readme is in Chinese. Since Stack Exchange is an international site with an English-only policy, could you [edit] and explain more on how to use this in English? – Andrew T. Nov 06 '21 at 12:25
0

You can use a keymapper app like octopus. This app mirrors the original app and adds keymapper. https://play.google.com/store/apps/details?id=com.chaozhuo.gameassistant Here's the link for this app!

  • This is the type of thing I would like, but after researching it.... I see that some app ban you for having it. I don't really play mobile games that much, but it would be nice to be able to if I decided too. Ill mark this answer as a solution if I do get a more generalized one. – ragnvaldr.js Apr 24 '20 at 17:24