Android phone like a computer mouse

I created an Android application that serves touch screen data for a java client that is listening on a Debian Lenny machine.

The client matches this data with the locations on the screen, as wacom does. I would like to put x_loc and y_loc in a file and recognize the file as a device (I vaguely believe that this is how it should work)

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

+6
android io debian
source share
2 answers

There are many ways to do this, from writing the actual device driver to recording X clients to generate X events (for example, using the XTest extension), using kernel interfaces to input events from the input subsystem.

I would go with the latter and use the uinput subsystem. This part of almost all the latest kernels provides /dev/uinput , which you can open regularly and run various ioctl to create input devices from regular user space.

Also note that some mechanisms for this already exist. Bluetooth devices with Bluetooth that work great on Linux are one example. rinputd , a daemon for listening to rinput clients and creating uinput events based on the data they send. Other. Perhaps you should consider making your akt Android app an affordable client.

+1
source share

You can either write a Linux device driver to interpret your data as a real mouse, or you can convince the X server (or something else) to accept input from something else, such as a named pipe.

Actual device files are not files with any content - they are just links to the primary and secondary numbers used to talk with the driver in the kernel, which can work with some file parameters on any device. You create device files with mknod, but they will not work until they are supported by the kernel driver with the corresponding numbers. Believe me, now there are some stub mechanisms, so the bulk of the actual driver can work in user space.

0
source share

All Articles