导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    t113链接无线鼠标无法识别鼠标上移动动作

    T Series
    1
    1
    24
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • L
      luckyloogn LV 2 最后由 编辑

      使用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:
      IMG_20250630_231658.jpg
      IMG_20250630_231714.jpg

      1 条回复 最后回复 回复 引用 分享 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策