Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android phone as computer mouse

Tags:

android

io

debian

I created an Android app that serves the touch screen sensor data to a java client that is listening on Debian Lenny machine.

The client maps this data to locations on the screen just like a wacom pad does. I would like to out put the x_loc and y_loc to a file and have the file recognized as a device.(I foggily believe this is how it is supposed to work)

I have experience with Linux but have not had to create a device before. How do I tell Linux that this file is a mouse. Do I have to create a driver?

like image 633
James Andino Avatar asked Oct 04 '10 11:10

James Andino


People also ask

Can I use my Android phone as a mouse?

All you need to do is download an app called Remote Mouse. With Remote Mouse, you can wirelessly control your computer from your phone. Whether you want your phone to act as a full-screen trackpad or simply need it to display media controls for quick access to options like pause or play, Remote Mouse is your best bet.

Can I use my phone as a mouse for my computer?

Bluetooth and WiFi connectivity allows you to transform your smartphone into a wireless mouse. Android devices can be used as a mouse for Windows laptops, Mac, and Chromebooks.

How can I use my Android phone as a mouse via USB?

Connect Your Device Next, you'll need to connect your Android device to your computer using a USB cable. In most cases, your usual charging cable will suffice. Connecting your device via USB should prompt your computer to automatically install your device's ADB drivers.


1 Answers

There's many ways to do this, ranging from writing an actual device driver, over writing X clients to generate X events (using the XTest extension for example), to using kernel interfaces to inject input subsystem events.

I'd go with the last one and use the uinput subsystem. That's part of pretty much all recent kernels and provides /dev/uinput, which you can open regularly and do various ioctls on to create input devices from regular userspace.

Please also note that some mechanisms for this already exist. Bluetooth Human Interface Devices, which work just fine on Linux, are one example. rinputd, a daemon to listen to rinput clients and generating uinput events based on the data they send. is another. You might want to consider just making your Android app akt as an rinput client.

like image 62
rafl Avatar answered Sep 22 '22 10:09

rafl