I am trying to enable mouse pointer in android device and control it's movement with adb commands without actually connecting mouse.
2 Answers
This is a very valid question. Looks like the methods are limited, but I found some pretty promising info on this guys blog: PocketMagic article. He's a developer on Google Code, and I've used some of his stuff in the past. So, it looks like you can inject mouse pointer events kernel-level thru adb, by writing to /dev/input/eventXXX
, with X being each input method attached to the device. He has created a library to interface with the kernel, and also an installable app that may solve all your needs. However, if you need a pure adb solution, you can probably inspect his code to figure out the process of determining which alias to write to and what his adb commands look like.
Good luck!

- 2,227
- 3
- 19
- 31
-
This information is very useful. I am yet to use the above information, but looks like they solve my problem. – Deepak May 01 '15 at 09:39
Case: I wanted a pointer to move a mouse around the screen of my phone via my watch. If somebody finds this in the future:
Pointer image: Tasker allows to create scenes. Create a scene with a canvas as big as you want your pointer to be, add the image you want as pointer as the scene only element, filling the scene.
Coordinates static: Create variables for "X" and "Y" (these are STILL NOT pixels). You want to play around with values on the show scene location applying your variables. 0,0 is top left, 200,200 is bottom right.
Coordinates movement: My approach was having 2 variables "now" and "final" (or other names). So you can tell tasker: Hide scene in Xnow,Ynow; Show scene in Xfinal,Yfinal; Set variables Xnow to Xfinal and Ynow to Yfinal.
Click: Autoinput allows to make interaccions but needs pixels values, not relative values as scenes. Hence, before using coordinate variables above in ie Autoinput yo need to convert them. I had to create "Xpixel" and "Ypixel" to use in such cases - find the pixel size of the screen of your target device - ie GS9+ 1440x2960 - and do maths AND round the values, as pixels values do not allow floating values. Example: Ypixel = round((2960/200)*Xnow), Xpixel = round((1440/200)*Ynow) THEN Autoinput>Click (Xpixel,Ypixel)