Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 3 multi touch report descriptor

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Posts
    8

    Teensy 3 multi touch report descriptor

    While I am waiting for Teensy 4 multi touch to be fixed, I bought a Teensy 3.2, and multi touch is working... kinda.

    Windows 10 is not really seeing multiple concurrent touches, but instead sees many single touches firing quickly, consecutively, which gives the illusion of multi touch, but breaks when you try to emulate certain multi touch features.

    This site here shows it perfectly
    ( http://dev.openlayers.org/examples/multitouch.html ). A regular multi touch screen puts the count up to 10 on that site, but the Teensy stays at one, sometimes flickers between 1 and 2, but never more.

    I was looking through the teensy 3 report descriptor in usb_desc.c and followed the link to MSFT site detailing hybrid mode report - https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

    There it gives an example on the bottom 'The following example shows 2 frames of 5 reports each for single-finger hybrid device representing 5 counts.' Where the report includes a Contact Count.

    Looking in the report descriptor in teensy, the contact count is emitted.

    So, I have added the contact count to the descriptor

    Code:
        0x09, 0x54,                         //   USAGE (Contact count)
        0x25, 0x7f,                         //   LOGICAL_MAXIMUM (127)
    But I can't see where to actually pass the contact count.

    I can get the contact count by checking the values in the pressure array in usb_touch.c, but I just don't know where to add that count to the report!?! I tried adding it to the end of tx_packet->buf in usb_touchscreen_update_callback (usb_touch.c) and updating the report size in the descriptor from 8 to 9, but that doesn't work.

    So, where can I add the Contact count?

    Thanks in advance

  2. #2
    Junior Member
    Join Date
    Feb 2020
    Posts
    8
    So, after a LOOOONG night, I have finally started to understand these HID report descriptors.

    I was missing some things, namely the report size and input...

    Code:
        0x09, 0x54,                         //   USAGE (Contact count)
        0x25, 0x7f,                         //   LOGICAL_MAXIMUM (127) 
        0x95, 0x01,                         //   REPORT_COUNT (1)
        0x75, 0x08,                         //   REPORT_SIZE (8)    
        0x81, 0x02,                         //   INPUT (Data,Var,Abs)
    After adding those, I then updated the multitouch callback report to include the contact count as per the microsoft guidelines (bottom of the page):
    https://docs.microsoft.com/en-us/win...ectedfrom=MSDN

    And then increased MULTITOUCH_SIZE from 8 to 16 to cater for the extra data.

    I've tested it now on windows 10 and can confirm that it is correctly identifying multiple touches, gestures are working (pinch to zoom on web browsers etc) and that test link above correctly spots up to 10 concurrent touches instead of flickering through 1 or 2 sequentially.

    I've made a PR... #443
    https://github.com/PaulStoffregen/cores/pull/443

    Hopefully you'll include it

    And for any one who might be interested, this was a really useful and insightful article about HID report descriptors.
    https://eleccelerator.com/tutorial-a...t-descriptors/

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,473
    Quick followup here... this was merged on github and also ported to Teensy 4.0.

    It will be in 1.52, which starts beta testing next week.

  4. #4
    Junior Member
    Join Date
    Feb 2020
    Posts
    8
    This is great news.

    I did try quickly on a Teensy 4 with the latest code from GitHub and couldn't seem to get multi touch working, but I will wait for the beta and try again. I'll let you know if any thing comes up.

    Thanks for the great support!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •