input子系统 KeyPad-Touch上报数据格式与机制

原文地址:http://blog.youkuaiyun.com/android_huber/article/details/7469534


-----------------------------------------------------------------------
本文系本站原创,欢迎转载!
转载请注明出处:http://blog.youkuaiyun.com/android_huber
交流邮箱:dp.shao@gmail.com
-----------------------------------------------------------------------

linux driveinput子系统上报信息,调用函数

void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)

input子系统最终调用copy_to_user(buffer, event, sizeof(struct input_event))将信息上报给上层,eventstruct input_event类型结构体, 中间会有一些处理将 typecodevalue值打包成input_event类型的数据。底层上报该结构体给上层。

struct input_event {

struct timeval time;

__u16 type;

__u16 code;

__s32 value;

};

struct timeval {

__kernel_time_t tv_sec; /* seconds */

__kernel_suseconds_t tv_usec; /* microseconds */

};

typedef long        __kernel_time_t;

typedef int __kernel_suseconds_t;

对于按键

type为事件类型,按键为EV_KEY,include/linux/input.h,

#define EV_KEY    0x01

code为按键的值,value用于标记按键是按下还是弹起,1是按下,0是弹起。

按下和弹起事件只需上报一次。

对于touch

static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)  input_event的封装,函数如下

input_event(dev, EV_ABS, code, value);

typeEV_ABS,  #define EV_ABS   0X03,

code的值,根据上报属性的不同,分别如下:

(多点触摸)

#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */

#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */

#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */

#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */

#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */

#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */

#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */

#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */

#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */

#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */

#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */

ABS_MT_TOUCH_MAJORABS_MT_PRESSURE实现一个应该就可以了。

(单点触摸)input.h中列举了很多属性,但只需实现以下几种即可。

#define ABS_X 0x00

#define ABS_Y 0x01

#define ABS_Z 0x02  (一般不必实现)

#define ABS_PRESSURE 0x18

下面一个BTN_TOUCH为点击事件,单点触摸中需要上报点击事件

#define BTN_TOUCH 0x14a

touch点上报机制

多点触摸

value为对应属性的值,如codeABS_MT_POSITION_X,则value的值为就为x轴坐标。

当把一个点的信息发送完毕以后,还需加上input_mt_sync(注意:即使只有一个点也需要加上),这个函数转换成input_event事件为

input_event(dev, EV_SYN, SYN_MT_REPORT, 0);

其中#define EV_SYN  0x00,   #define SYN_MT_REPORT    2

type0x00code2value0

接着再上报第二个点,第二个点上报结束,依旧要上报input_mt_sync,直至最后一次报点结束,加上input_sync,转换成input_event事件为

input_event(dev, EV_SYN, SYN_REPORT, 0)

其中#define EV_SYN  0x00#define SYN_REPORT 0

type0x00code0value0。至此报点结束。

点需要一直上报。

Linux 驱动中的例子

input_report_abs(ssd2531_data.input, ABS_MT_TRACKING_ID, 1);

input_report_abs(ssd2531_data.input, ABS_MT_TOUCH_MAJOR, PRESS_STATUS);

input_report_abs(ssd2531_data.input, ABS_MT_POSITION_X, X_COOR);

input_report_abs(ssd2531_data.input, ABS_MT_POSITION_Y, Y_COOR);

input_mt_sync(ssd2531_data.input);

单点触摸

单点上报同多点上报差不多,只是不需要input_mt_sync了,上报过程中需要

input_event(dev, EV_KEY, BTN_TOUCH,  0/1 );  value1,代表按下,value0代表抬起。code值为BTN_TOUCH,  #define BTN_TOUCH 0x14a

 同样最后结束需要input_sync

linux驱动的例子

input_report_abs(ts.input, ABS_X, ts.xp);

input_report_abs(ts.input, ABS_Y, ts.yp);

input_report_key(ts.input, BTN_TOUCH, 1);

input_sync(ts.input);

input_event结构体中,有一个成员为struct timeval time;用来记录此刻的墙上时间。


### 关于ArcGIS License Server无法启动的解决方案 当遇到ArcGIS License Server无法启动的情况,可以从以下几个方面排查并解决问题: #### 1. **检查网络配置** 确保License Server所在的计算机能够被其他客户端正常访问。如果是在局域网环境中部署了ArcGIS Server Local,则需要确认该环境下的网络设置是否允许远程连接AO组件[^1]。 #### 2. **验证服务状态** 检查ArcGIS Server Object Manager (SOM) 的运行情况。通常情况下,在Host SOM机器上需将此服务更改为由本地系统账户登录,并重启相关服务来恢复其正常工作流程[^2]。 #### 3. **审查日志文件** 查看ArcGIS License Manager的日志记录,寻找任何可能指示错误原因的信息。这些日志可以帮助识别具体是什么阻止了许可服务器的成功初始化。 #### 4. **权限问题** 确认用于启动ArcGIS License Server的服务账号具有足够的权限执行所需操作。这包括但不限于读取/写入特定目录的权利以及与其他必要进程通信的能力。 #### 5. **软件版本兼容性** 保证所使用的ArcGIS产品及其依赖项之间存在良好的版本匹配度。不一致可能会导致意外行为完全失败激活license server的功能。 #### 示例代码片段:修改服务登录身份 以下是更改Windows服务登录凭据的一个简单PowerShell脚本例子: ```powershell $serviceName = "ArcGISServerObjectManager" $newUsername = ".\LocalSystemUser" # 替换为实际用户名 $newPassword = ConvertTo-SecureString "" -AsPlainText -Force Set-Service -Name $serviceName -StartupType Automatic New-ServiceCredential -ServiceName $serviceName -Account $newUsername -Password $newPassword Restart-Service -Name $serviceName ``` 上述脚本仅作为示范用途,请依据实际情况调整参数值后再实施。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值