This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM3358:空中触摸屏

Guru**** 2553600 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/623288/linux-am3358-aerial-touchscreen

器件型号:AM3358

工具/软件:Linux

MCU:AM3358   + SDK6.0

我想知道如何 驱动一个串行触摸屏。 参考了一些文档、我 更改了 cgtouit213.c 的数据帧并编写了一个在用户空间中工作的代码。

 就像这样:

  1. #define Serio_any   0xff   
  2. #define Serio_MD    0x3f   
  3.   
  4. int main (int argc、 char* argv[])   
  5. {   
  6.     内部 开发、转台;   
  7.     char comdev[20];   
  8.     Int ldisc;   
  9.     unsigned long 类型;   
  10.     struct termios 选项;   
  11.     int fd = -1;   
  12.     if (argc != 2)   
  13.     {   
  14.         printf ("---------------------------------------------- \n");   
  15.         printf ("\n 用法: %s [串行 设备(1-5)]\n"、 argv[0]);   
  16.         printf ("示例: %s 5 n"、 argv[0]);   
  17.         printf ("---------------------------------------------- \n");   
  18.         返回 0;   
  19.     }   
  20.   
  21.     dev = strtol (argv[1]、NULL、10);   
  22.     sprintf (comdev、"/dev/ttyAMA %d "、dev);   
  23.     FD = 开路(comdev、O_RDWR|O_NONBLOCK_O_NOCTTY);   
  24.     如果 (FD < 0) {   
  25.         镜像(comdev);   
  26.         退出(1);   
  27.     }   
  28.       
  29.     tcgetattr (fd、 &option);   
  30.     option.c_iflag = IGNPAR | IGNBRK;   
  31.     option.c_cflag = HUPCL | CS8 | CREAD | CLOCAL | B9600;   
  32.     option.c_cc[Vmin] = 1;   
  33.     option.c_cc[VTIME] = 0;   
  34.       
  35.     cfsetispeed (可选、B9600);   
  36.     cfsetospeed (&OPTION、B9600);   
  37.   
  38.     RET = tcsetattr (fd、 tcSANOW、 可选);   
  39.     if (ret < 0) {   
  40.         perror ("TCSANOW");   
  41.         退出(1);   
  42.     }   
  43.   
  44.     ldisc = n_mouse;   
  45.     RET = ioctl (FD、TIOCSETD、&ldoc);   
  46.     if (ret) {   
  47.         Perror ("TIOSETD");   
  48.     }   
  49.     type = Serio_MD | (Serio_any << 8) | (Serio_any << 16);   
  50.     RET = ioctl (FD、SPIOCSTYPE、 &TYPE);   
  51.     if (ret) {   
  52.         Perror ("SPIOCSTYPE");   
  53.     }   
  54.     读取(FD、NULL、0);   
  55.     //关闭(FD);   
  56.     返回 0;   
  57. }   

但是返回 ioctl (fd、TIOCSETD、&ldoc)和 ioctl (fd、SPIOCSTYPE、&type)都是-1。

请尽快支持我! 谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尝试包括 errno.h 并收集有关返回错误的更多信息。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好。Kemal。
    我得到了器件节点问题的结果。 我的。就像 touchit213 μ s 一样连接,但我有一些关于 calibirate 的问题。 该系统可以进入反腐败系统并报告 xy 位置、但我无法使用 slib 进行校准。您能给我一些答案吗、谢谢!