Android手机如电脑鼠标 [英] Android phone as computer mouse

查看:217
本文介绍了Android手机如电脑鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Android应用程序,供应触摸屏传感器数据到Java客户端正在监听Debian Lenny的机器。

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

客户端映射这些数据就像一个WACOM板确实在屏幕上的位置。我想出来把x_loc和y_loc到一个文件中,并有公认的设备中的文件。(我foggily相信这是它是如何工作的)

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)

我有Linux的经验,但还没有之前创建的设备。我怎么告诉Linux的这个文件是一个鼠标。我一定要创建驱动程序?

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?

推荐答案

有很多方法可以做到这一点,从写一个实际的设备驱动程序,在写X客户机产生X事件(使用XTEST扩展为例),以使用内核接口来注入输入子系统事件。

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.

我会去的最后一个,并使用 uinput 子系统。这就是pretty的部分太多所有最新的内核,并提供了的/ dev / uinput ,你可以经常打开,并做各种的ioctl S上,从普通用户空间创建输入设备。

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.

另外请注意,某些机制,这已经存在。蓝牙人机接口设备,它工作得很好Linux上,就是一个例子。 rinputd ,一个守护进程来听rinput客户产生uinput基础上,他们发送的数据的事件。是另一回事。你可能要考虑只是让你的Andr​​oid应用AKT为rinput客户端。

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.

这篇关于Android手机如电脑鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆