t113链接无线鼠标无法识别鼠标上移动动作
-
使用100ask提供的sdk(tina-d1-h)和补丁,运行lvgl的demo程序,鼠标指针只能在屏幕顶端进行左右移动,无法下移。通过c程序读取相对y,发现鼠标向下移动y的相对值减小,但是向上移动y的相对值不会增加。是启用hid的方式不对?不是图片中这样设置吗?鼠标在win11和ubuntu 18.04的虚拟机上都是正常使用的。
lvgl鼠标无法下移:
c程序读取y轴相对位置:
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <linux/input.h> int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "Usage: %s /dev/input/eventX\n", argv[0]); return 1; } // 打开输入设备 int fd = open(argv[1], O_RDONLY); if (fd == -1) { perror("Failed to open device"); return 1; } printf("Listening to mouse events on %s...\n", argv[1]); printf("Press Ctrl+C to exit.\n"); struct input_event ev; int x = 0, y = 0; // 当前坐标(相对设备需累加) while (1) { if (read(fd, &ev, sizeof(ev)) != sizeof(ev)) { perror("Failed to read event"); close(fd); return 1; } // 处理坐标事件 if (ev.type == EV_ABS) { // 绝对坐标设备(如触摸屏) if (ev.code == ABS_X) x = ev.value; else if (ev.code == ABS_Y) y = ev.value; printf("abs x:%d, y:%d\n", x, y); } else if (ev.type == EV_REL) { // 相对位移设备(如普通鼠标) if (ev.code == REL_X) x += ev.value; else if (ev.code == REL_Y) y += ev.value; printf("x:%d, y:%d\n", x, y); } } close(fd); return 0; }
开启hid:
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号