How to enable mouse pointer on Android devices using adb commands

I am trying to turn on the mouse pointer on an Android device and control its movement using adb commands without actually connecting the mouse.

+7
source share
2 answers

This is a very important issue. The methods seem to be limited, but I found some pretty promising information about this blog: PocketMagic article . He is a developer at Google Code, and I have used some of his stuff in the past. So it looks like you can input kernel level mouse events through adb by writing to /dev/input/eventXXX , whereby X is each input method attached to the device. He created a library for interacting with the kernel, as well as an installable application that can solve all your needs. However, if you need a clean adb solution, you can probably check its code to find out the process of determining which alias to write and what its adb commands look like.

Good luck

+2
source

Case: I wanted the pointer to move the mouse on the screen of the phone through the clock. If someone finds this in the future:

  • Image Pointer: Tasker allows you to create scenes. Create a scene with as large a canvas as you want the pointer to be, add the desired image as a pointer as an element of the scene only, filling the scene.

  • Static coordinates: Create variables for "X" and "Y" (these are NOT pixels anyway). You want to play around with the values ​​at the scene location using your variables. 0.0 top left, 200,200 bottom right.

  • Coordinate movement: in my approach there were two variables β€œnow” and β€œfinal” (or other names). So you can tell Tasker: Hide the scene in Xnow, Ynow; Show the scene in Xfinal, Yfinal; Set the Xnow variables to Xfinal and Ynow to Yfinal.

  • Click: Autoinput allows you to create interactions, but requires pixel values, not relative values, like scenes. Therefore, before using the coordinate variables above in i.e. Autoinput need to convert them. I had to create "Xpixel" and "Ypixel" for use in such cases - to find the pixel size of the screen of the target device - that is, GS9 + 1440x2960 ​​- and perform mathematical operations AND around the values, since the pixel values ​​do not allow floating values. Example: Ypixel = round ((2960/200) * Xnow), Xpixel = round ((1440/200) * Ynow) THEN Autoinput> Click (Xpixel, Ypixel)

0
source

Source: https://habr.com/ru/post/984613/


All Articles