代码之家  ›  专栏  ›  技术社区  ›  OJ287

Linux中如何从cirque触摸板读取tap的绝对位置

  •  0
  • OJ287  · 技术社区  · 16 年前

    我们有一个马戏团的触摸板。 http://www.cirque.com/downloads/docs/tsm9925.pdf

    现在我们想用C + C++应用程序从这个触摸板上读取TAP的绝对位置。不幸的是,公司只开发了Windows驱动程序,但我们需要读取Linux中的位置。我们尝试使用/dev/input/eventn子系统,但只接收到手指移动的方向和手指移动的速度。

    有可能吗?我们怎么做?

    3 回复  |  直到 14 年前
        1
  •  1
  •   Peter M    16 年前

    从您提供的链接:

    For custom functionality at the product design stage, we offer software that 
    allows OEMs to enable, disable or personalize advanced settings and/or 
    reprogram the touch sensitive area.
    

    我建议直接联系马戏团

        2
  •  1
  •   jonsca    14 年前

    这就是它的工作原理:

    马戏团的智能猫(型号GDU410-这是旧型号!)报告一个8字节的数据包。 最初,数据包如下所示:

    Byte 0, bit 0: Left button
    Byte 0, bit 1: Right button
    Byte 0, bit 2: Side buttons (they cannot be distinguished)
    Byte 1: Relative X data
    Byte 2: Relative Y data
    Bytes 3-7: 0
    

    要切换到绝对模式,您必须向设备发送以下USB控制请求:

    unsigned char buf[8];
    do {
        Usb_Control_Request(Type=0xC1, Request=0x6A, Index=0,
            Value=0, Data Length=8, Data Buffer=buf)
    } while(buf[0] & 8);
    Usb_Control_Request(Type=0x41, Request=0x66, Index=0xBB, Value=1, No data)
    do { ... /* C1/6A, see above */ } while(buf[0] & 8);
    Usb_Control_Request(Type=0x41, Request=0x66, Index=0xB5, Value=0x3E0, No data)
    do { ... /* C1/6A */ } while(buf[0] & 8);
    Usb_Control_Request(Type=0x41, Request=0x66, Index=0xA2, Value=0xFEE, No data)
    do { ... /* C1/6A */ } while(buf[0] & 8);
    Usb_Control_Request(Type=0x41, Request=0x66, Index=0xB4, Value=0xE, No data)
    do { ... /* C1/6A */ } while(buf[0] & 8);
    Usb_Control_Request(Type=0x41, Request=0x64, Index=0, Value=0, No data)
    do { ... /* C1/6A */ } while(buf[0] & 8);
    

    也许在Linux下,可以使用“libusb”来实现这一点。虽然我已经在Linux下进行了一些驱动程序开发,但我还没有使用“libusb”。

    完成此操作后,8字节数据包如下所示:

    Byte 0: Buttons, as before
    Bytes 1-3: 0
    Byte 4: low 8 bits of X finger position
    Byte 5: bits 0-2: high 3 bits of X finger position
            bits 3-7: low 5 bits of Y finger position
    Byte 6: bits 0-5: high 6 bits of Y finger position
    Byte 7, low 7 (?) bits: non-zero if finger touches pad, 0 if not
            some pads report the finger pressure;
            MAYBE this is done in this field.
    
    Finger positions:
    X position: left ~0x790, right ~0x70
    Y position: top ~0, bottom ~0x5B0
    

    Cirque提供的设备驱动程序使用绝对位置模式执行滚动和类似的功能,这些功能依赖于绝对手指位置。

        3
  •  0
  •   relet    16 年前

    触摸板很少报告绝对位置。

    只是为了让你能接受一些答案;)