USB HID Touchscreen support needed

MajorTom

Member
Thanks for the USB HID Mouse, Keyboard, Joystick and Midi support. Also I need USB HID Touchscreen support.

In this post you find the USB Touchscreen Device Descriptor of my Touchscreen (10 Finger Multi-Touch) that is working fine with OSX, Linux and Android.

Infos about the MultiTouch Report you can find here: http://janaxelson.com/forum/index.php?topic=733.0


It would be nice if you can support it in the next Teensy updates, I'm using Teensy 3.2 with the Arduino IDE 1.6.6





Report Descriptor:
--------------------


Usage Page (Digitizer) 05 0D
Usage (Touch Screen) 09 04
Collection (Application) A1 01
Report ID (1) 85 01
Usage (Finger) 09 22
Collection (Logical) A1 02
Usage (Tip Switch) 09 42
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (1) 75 01
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (2) 95 02
Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03
Usage (Contact Identifier) 09 51
Logical Maximum (31) 25 1F
Report Size (5) 75 05
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage Page (Generic Desktop) 05 01
Logical Maximum (32767) 26 FF 7F
Report Size (16) 75 10
Unit Exponent (-2) 55 0E
Unit (SI Lin: Length (cm)) 65 11
Usage (X) 09 30
Physical Minimum (0) 35 00
Physical Maximum (5095) 46 E7 13
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (2866) 46 32 0B
Usage (Y) 09 31
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (0) 45 00
End Collection C0
Usage Page (Digitizer) 05 0D
Usage (Finger) 09 22
Collection (Logical) A1 02
Usage (Tip Switch) 09 42
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (1) 75 01
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (2) 95 02
Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03
Usage (Contact Identifier) 09 51
Logical Maximum (31) 25 1F
Report Size (5) 75 05
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage Page (Generic Desktop) 05 01
Logical Maximum (32767) 26 FF 7F
Report Size (16) 75 10
Unit Exponent (-2) 55 0E
Unit (SI Lin: Length (cm)) 65 11
Usage (X) 09 30
Physical Minimum (0) 35 00
Physical Maximum (5095) 46 E7 13
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (2866) 46 32 0B
Usage (Y) 09 31
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (0) 45 00
End Collection C0
Usage Page (Digitizer) 05 0D
Usage (Finger) 09 22
Collection (Logical) A1 02
Usage (Tip Switch) 09 42
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (1) 75 01
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (2) 95 02
Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03
Usage (Contact Identifier) 09 51
Logical Maximum (31) 25 1F
Report Size (5) 75 05
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage Page (Generic Desktop) 05 01
Logical Maximum (32767) 26 FF 7F
Report Size (16) 75 10
Unit Exponent (-2) 55 0E
Unit (SI Lin: Length (cm)) 65 11
Usage (X) 09 30
Physical Minimum (0) 35 00
Physical Maximum (5095) 46 E7 13
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (2866) 46 32 0B
Usage (Y) 09 31
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (0) 45 00
End Collection C0
Usage Page (Digitizer) 05 0D
Usage (Finger) 09 22
Collection (Logical) A1 02
Usage (Tip Switch) 09 42
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (1) 75 01
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (2) 95 02
Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03
Usage (Contact Identifier) 09 51
Logical Maximum (31) 25 1F
Report Size (5) 75 05
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage Page (Generic Desktop) 05 01
Logical Maximum (32767) 26 FF 7F
Report Size (16) 75 10
Unit Exponent (-2) 55 0E
Unit (SI Lin: Length (cm)) 65 11
Usage (X) 09 30
Physical Minimum (0) 35 00
Physical Maximum (5095) 46 E7 13
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (2866) 46 32 0B
Usage (Y) 09 31
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (0) 45 00
End Collection C0
Usage Page (Digitizer) 05 0D
Usage (Finger) 09 22
Collection (Logical) A1 02
Usage (Tip Switch) 09 42
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (1) 75 01
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (2) 95 02
Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03
Usage (Contact Identifier) 09 51
Logical Maximum (31) 25 1F
Report Size (5) 75 05
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage Page (Generic Desktop) 05 01
Logical Maximum (32767) 26 FF 7F
Report Size (16) 75 10
Unit Exponent (-2) 55 0E
Unit (SI Lin: Length (cm)) 65 11
Usage (X) 09 30
Physical Minimum (0) 35 00
Physical Maximum (5095) 46 E7 13
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (2866) 46 32 0B
Usage (Y) 09 31
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Physical Maximum (0) 45 00
End Collection C0
Usage Page (Digitizer) 05 0D
Logical Minimum (0) 15 00
Logical Maximum (65535) 27 FF FF 00 00
Report Size (16) 75 10
Report Count (1) 95 01
Usage (Scan Time) 09 56
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Logical Maximum (10) 25 0A
Report Size (8) 75 08
Usage (Contact Count) 09 54
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report ID (68) 85 44
Usage (Contact Count Maximum) 09 55
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Report ID (68) 85 44
Usage Page (Vendor-Defined 1) 06 00 FF
Usage (Vendor-Defined 197) 09 C5
Logical Maximum (255) 26 FF 00
Report Count (256) 96 00 01
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Report ID (240) 85 F0
Usage (Vendor-Defined 1) 09 01
Report Count (4) 95 04
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Report ID (242) 85 F2
Usage (Vendor-Defined 3) 09 03
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Usage (Vendor-Defined 4) 09 04
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Usage (Vendor-Defined 5) 09 05
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Report Count (1) 95 01
Usage (Vendor-Defined 6) 09 06
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Usage (Vendor-Defined 7) 09 07
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
Report ID (241) 85 F1
Usage (Vendor-Defined 2) 09 02
Report Count (7) 95 07
Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02
Report ID (243) 85 F3
Usage (Vendor-Defined 8) 09 08
Report Count (61) 95 3D
Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) B1 02
End Collection C0







static const uint8_t _hidReportDescriptor[] PROGMEM = {

0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x04, // Usage (Touch Screen)
0xA1, 0x01, // Collection (Application)
0x85, 0x01, // Report ID (1)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x95, 0x02, // Report Count (2)
0x81, 0x03, // Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x09, 0x51, // Usage (Contact Identifier)
0x25, 0x1F, // Logical Maximum (31)
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x05, 0x01, // Usage Page (Generic Desktop)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
0x65, 0x11, // Unit (SI Lin: Length (cm))
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xE7, 0x13, // Physical Maximum (5095)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x46, 0x32, 0x0B, // Physical Maximum (2866)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x45, 0x00, // Physical Maximum (0)
0xC0, // End Collection

0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x95, 0x02, // Report Count (2)
0x81, 0x03, // Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x09, 0x51, // Usage (Contact Identifier)
0x25, 0x1F, // Logical Maximum (31)
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x05, 0x01, // Usage Page (Generic Desktop)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
0x65, 0x11, // Unit (SI Lin: Length (cm))
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xE7, 0x13, // Physical Maximum (5095)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x46, 0x32, 0x0B, // Physical Maximum (2866)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x45, 0x00, // Physical Maximum (0)
0xC0, // End Collection

0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x95, 0x02, // Report Count (2)
0x81, 0x03, // Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x09, 0x51, // Usage (Contact Identifier)
0x25, 0x1F, // Logical Maximum (31)
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x05, 0x01, // Usage Page (Generic Desktop)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
0x65, 0x11, // Unit (SI Lin: Length (cm))
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xE7, 0x13, // Physical Maximum (5095)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x46, 0x32, 0x0B, // Physical Maximum (2866)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x45, 0x00, // Physical Maximum (0)
0xC0, // End Collection

0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x95, 0x02, // Report Count (2)
0x81, 0x03, // Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x09, 0x51, // Usage (Contact Identifier)
0x25, 0x1F, // Logical Maximum (31)
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x05, 0x01, // Usage Page (Generic Desktop)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
0x65, 0x11, // Unit (SI Lin: Length (cm))
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xE7, 0x13, // Physical Maximum (5095)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x46, 0x32, 0x0B, // Physical Maximum (2866)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x45, 0x00, // Physical Maximum (0)
0xC0, // End Collection

0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x95, 0x02, // Report Count (2)
0x81, 0x03, // Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x09, 0x51, // Usage (Contact Identifier)
0x25, 0x1F, // Logical Maximum (31)
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x05, 0x01, // Usage Page (Generic Desktop)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
0x65, 0x11, // Unit (SI Lin: Length (cm))
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xE7, 0x13, // Physical Maximum (5095)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x46, 0x32, 0x0B, // Physical Maximum (2866)
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x45, 0x00, // Physical Maximum (0)
0xC0, // End Collection

0x05, 0x0D, // Usage Page (Digitizer)
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65535)
0x75, 0x10, // Report Size (16)
0x95, 0x01, // Report Count (1)
0x09, 0x56, // Usage (Scan Time)
0x81 ,0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x25, 0x0A, // Logical Maximum (10)
0x75, 0x08, // Report Size (8)
0x09, 0x54, // Usage (Contact Count)
0x81, 0x02, // Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)
0x85, 0x44, // Report ID (68)
0x09, 0x55, // Usage (Contact Count Maximum)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x85, 0x44, // Report ID (68)
0x06, 0x00, 0xFF, // Usage Page (Vendor-Defined 1)
0x09, 0xC5, // Usage (Vendor-Defined 197)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x96, 0x00, 0x01, // Report Count (256)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x85, 0xF0, // Report ID (240)
0x09, 0x01, // Usage (Vendor-Defined 1)
0x95, 0x04, // Report Count (4)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x85, 0xF2, // Report ID (242)
0x09, 0x03, // Usage (Vendor-Defined 3)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x09, 0x04, // Usage (Vendor-Defined 4)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x09, 0x05, // Usage (Vendor-Defined 5)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x95, 0x01, // Report Count (1)
0x09, 0x06, // Usage (Vendor-Defined 6)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x09, 0x07, // Usage (Vendor-Defined 7)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x85, 0xF1, // Report ID (241)
0x09, 0x02, // Usage (Vendor-Defined 2)
0x95, 0x07, // Report Count (7)
0x91, 0x02, // Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0x85, 0xF3, // Report ID (243)
0x09, 0x08, // Usage (Vendor-Defined 8)
0x95, 0x3D, // Report Count (61)
0xB1, 0x02, // Feature (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)
0xC0 // End Collection






Information for device CoolTouch(TM) System (VID=0x2149 PID=0x2316):

Connection Information:
------------------------------
Connection status: Device connected
Device actual bus speed: FullSpeed
Device is hub: No
Device address: 0x0002
Current configuration value: 0x01
Number of open pipes: 4

Device Descriptor:
------------------------------
0x12 bLength
0x01 bDescriptorType
0x0200 bcdUSB
0x00 bDeviceClass
0x00 bDeviceSubClass
0x00 bDeviceProtocol
0x40 bMaxPacketSize0 (64 Bytes)
0x2149 idVendor
0x2316 idProduct
0x1331 bcdDevice
0x01 iManufacturer "Advanced Silicon S.A"
0x02 iProduct "CoolTouch(TM) System"
0x00 iSerialNumber
0x01 bNumConfigurations
Hex dump:
0x12 0x01 0x00 0x02 0x00 0x00 0x00 0x40 0x49 0x21
0x16 0x23 0x31 0x13 0x01 0x02 0x00 0x01

Configuration Descriptor:
------------------------------
0x09 bLength
0x02 bDescriptorType
0x0049 wTotalLength (73 Bytes)
0x02 bNumInterfaces
0x01 bConfigurationValue
0x03 iConfiguration "CoolTouch® System 104 "
0xA0 bmAttributes (Bus-powered Device, Remote-Wakeup)
0xFA bMaxPower (500 mA)
Hex dump:
0x09 0x02 0x49 0x00 0x02 0x01 0x03 0xA0 0xFA

Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x00 bInterfaceNumber
0x00 bAlternateSetting
0x02 bNumEndPoints
0x03 bInterfaceClass (Human Interface Device Class)
0x00 bInterfaceSubClass
0x00 bInterfaceProtocol
0x04 iInterface "CoolTouch® USB Interface 1 "
Hex dump:
0x09 0x04 0x00 0x00 0x02 0x03 0x00 0x00 0x04

HID Descriptor:
------------------------------
0x09 bLength
0x21 bDescriptorType
0x0110 bcdHID
0x00 bCountryCode
0x01 bNumDescriptors
0x22 bDescriptorType (Report descriptor)
0x019B bDescriptorLength
Hex dump:
0x09 0x21 0x10 0x01 0x00 0x01 0x22 0x9B 0x01

Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x01 bEndpointAddress (OUT Endpoint)
0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 Bytes)
0x01 bInterval
Hex dump:
0x07 0x05 0x01 0x03 0x40 0x00 0x01

Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x81 bEndpointAddress (IN Endpoint)
0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 Bytes)
0x01 bInterval
Hex dump:
0x07 0x05 0x81 0x03 0x40 0x00 0x01

Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x01 bInterfaceNumber
0x00 bAlternateSetting
0x02 bNumEndPoints
0x03 bInterfaceClass (Human Interface Device Class)
0x00 bInterfaceSubClass
0x00 bInterfaceProtocol
0x04 iInterface "CoolTouch® USB Interface 1 "
Hex dump:
0x09 0x04 0x01 0x00 0x02 0x03 0x00 0x00 0x04

HID Descriptor:
------------------------------
0x09 bLength
0x21 bDescriptorType
0x0110 bcdHID
0x00 bCountryCode
0x01 bNumDescriptors
0x22 bDescriptorType (Report descriptor)
0x001D bDescriptorLength
Hex dump:
0x09 0x21 0x10 0x01 0x00 0x01 0x22 0x1D 0x00

Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x02 bEndpointAddress (OUT Endpoint)
0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 Bytes)
0x01 bInterval
Hex dump:
0x07 0x05 0x02 0x03 0x40 0x00 0x01

Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x82 bEndpointAddress (IN Endpoint)
0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 Bytes)
0x01 bInterval
Hex dump:
0x07 0x05 0x82 0x03 0x40 0x00 0x01

Microsoft OS Descriptor:
------------------------------
0x12 bLength
0x03 bDescriptorType
Hex dump:
0x12 0x03 0x4D 0x00 0x53 0x00 0x46 0x00 0x54 0x00
0x31 0x00 0x30 0x00 0x30 0x00 0x01 0x00

String Descriptor Table
--------------------------------
Index LANGID String
0x00 0x0000 0x0409
Hex dump:
0x04 0x03 0x09 0x04

0x01 0x0409 "Advanced Silicon S.A"
Hex dump:
0x2A 0x03 0x41 0x00 0x64 0x00 0x76 0x00 0x61 0x00
0x6E 0x00 0x63 0x00 0x65 0x00 0x64 0x00 0x20 0x00
0x53 0x00 0x69 0x00 0x6C 0x00 0x69 0x00 0x63 0x00
0x6F 0x00 0x6E 0x00 0x20 0x00 0x53 0x00 0x2E 0x00
0x41 0x00

0x02 0x0409 "CoolTouch(TM) System"
Hex dump:
0x2A 0x03 0x43 0x00 0x6F 0x00 0x6F 0x00 0x6C 0x00
0x54 0x00 0x6F 0x00 0x75 0x00 0x63 0x00 0x68 0x00
0x28 0x00 0x54 0x00 0x4D 0x00 0x29 0x00 0x20 0x00
0x53 0x00 0x79 0x00 0x73 0x00 0x74 0x00 0x65 0x00
0x6D 0x00

0x03 0x0409 "CoolTouch® System 104 "
Hex dump:
0x4E 0x03 0x43 0x00 0x6F 0x00 0x6F 0x00 0x6C 0x00
0x54 0x00 0x6F 0x00 0x75 0x00 0x63 0x00 0x68 0x00
0xAE 0x00 0x20 0x00 0x53 0x00 0x79 0x00 0x73 0x00
0x74 0x00 0x65 0x00 0x6D 0x00 0x20 0x00 0x31 0x00
0x30 0x00 0x34 0x00 0x20 0x00 0x20 0x00 0x20 0x00
0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00
0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00
0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00

0x04 0x0409 "CoolTouch® USB Interface 1 "
Hex dump:
0x4E 0x03 0x43 0x00 0x6F 0x00 0x6F 0x00 0x6C 0x00
0x54 0x00 0x6F 0x00 0x75 0x00 0x63 0x00 0x68 0x00
0xAE 0x00 0x20 0x00 0x55 0x00 0x53 0x00 0x42 0x00
0x20 0x00 0x49 0x00 0x6E 0x00 0x74 0x00 0x65 0x00
0x72 0x00 0x66 0x00 0x61 0x00 0x63 0x00 0x65 0x00
0x20 0x00 0x31 0x00 0x20 0x00 0x20 0x00 0x20 0x00
0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00
0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00

------------------------------

Whole Device Descriptor as hex dump:
0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x49, 0x21,
0x16, 0x23, 0x31, 0x13, 0x01, 0x02, 0x00, 0x01

Whole Configuration Descriptor as hex dump:
0x09, 0x02, 0x49, 0x00, 0x02, 0x01, 0x03, 0xA0, 0xFA, 0x09,
0x04, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x04, 0x09, 0x21,
0x10, 0x01, 0x00, 0x01, 0x22, 0x9B, 0x01, 0x07, 0x05, 0x01,
0x03, 0x40, 0x00, 0x01, 0x07, 0x05, 0x81, 0x03, 0x40, 0x00,
0x01, 0x09, 0x04, 0x01, 0x00, 0x02, 0x03, 0x00, 0x00, 0x04,
0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0x1D, 0x00, 0x07,
0x05, 0x02, 0x03, 0x40, 0x00, 0x01, 0x07, 0x05, 0x82, 0x03,
0x40, 0x00, 0x01

Whole String Descriptor as hex dump:
0x12, 0x03, 0x4D, 0x00, 0x53, 0x00, 0x46, 0x00, 0x54, 0x00,
0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x01, 0x00


------------------------------

Connection path for device:
Standard OpenHCD USB-Hostcontroller
Root Hub
CoolTouch(TM) System (VID=0x2149 PID=0x2316) Port: 2

Running on: Windows 7 with Service Pack 1

Brought to you by TDD v1.84.0, Dec 14 2015, 09:19:38
 
Last edited:
This is built into a monitor, right?

If I wanted to dig into this (and I do) and if I had time to really investigage (that part is questionable), exactly which product would I need to buy or borrow, so I could watch its USB traffic?
 
Hello MajorTom

There is no need to use such a monster descriptor as the one that you have posted above.
But you are right, relative mouse movements (and even only in the range -127 ... + 127) are insufficient for most Teensy users.
Touch screen support is missing in Teensy and PJRC does everything to ignore the needs of the users.

I posted a solution in 2015 but Paul did not even answer me.

You find my article on Codeproject that contains a ready-to-use code for Teensy that allows to simulate THREE different types of touchscreens.
At least one of them should work for you.
 
Last edited:
I'm now working on USB touchscreen support. As a starting point, I've committed this experimental descriptor, based mostly on this single finger hybrid example from Microsoft. I also ordered a Dell P2314T monitor today, so I can have a real 10 touch device on hand for comparison.

I spent some time reviewing Elmue's prior posts and codeproject page. I believe this will be pretty similar to his second alternate touchscreen descriptor. But I am *not* planning to connect this touchscreen stuff to Mouse.moveTo(). Instead, I see USB Touchscreen as a separate option for Tools > USB Type, probably to be offered with Keyboard and maybe also Serial. Touchscreen will have its own API, which can support 10 fingers and features like variable pressure.

Since there's been some heated conversation before, I want be perfectly clear about Mouse.moveTo(). I'm considering adding a #define (not enabled by default) that will apply the "ugly hack" which removes relative move. But I'm not planning to use Usage Page 0x0D to fully support both relative+absolute modes on Linux. Doing so breaks things on Macintosh. It also seems like bad design and a poor long-term decision to implement the Mouse object with HID types that are actually for touch or stylus/pens. What we're doing now is fully HID protocol compliant, and it does work fine with Windows and Macintosh. Linux is simply limited by X11. Perhaps in the distant future X11 will improve or be replaced with Wayland or Mir. I'm going to implement touchscreen support as separate touchscreen API, not Mouse.moveTo() only to work around Linux X11 limitations.

What the touchscreen API will look like is still to be decided. I'm considering something like this:

Code:
TouchscreenUSB.press(finger, x, y, pressure=32);
TouchscreenUSB.release(finger);

I'm debating whether to build gestures into the API and Teensyduino code. These would automatically use 2 fingers centered at a coordinate to perform a gesture over time.

Code:
TouchscreenUSB.zoomIn(x, y, amount, speed);
TouchscreenUSB.rotate(x, y, amount, speed);

Of course this could be done by the Arduino sketch, but it's quite a lot of code to get correct. Done within Teensyduino, it can be timed precisely with the USB start of frame. Of course it'd be far more convenient that having to build the code to do it, especially in projects which need to do other stuff like scanning buttons, reading analog signals, updating addressable LEDs, and so on.

The API is still very much up in the air at this point. Before I make any final decisions, I want to spend some time actually using the Dell P2314T with Windows 10 and experience how the gestures really work. I also want to give the new Ubuntu LTS release a try and see how it supports touchscreens, and of course give the 3rd party Mac drivers a try.
 
Hi Paul

You are working on touchscreen.
That's good news!

Ok, you want to to do it even more perfect than what I suggested.

I completely aggree that an own Touchscreen class is indispensable when you want to implement more than just simple movement.
Gestures would be very very usefull at least the most important like flick, scroll, touch, drag'n drop.
_________________________________

> But I'm not planning to use Usage Page 0x0D to fully support both relative+absolute modes on Linux.

I don't understand?

Digitizers don't use relative movement.

If someone wants relative movement he will have to use the Mouse.move() command, not the touchscreen.

Also I don't understand what you say about Linux?
I wrote in my article that all 3 touchscreen desriptors have been tested on Suse, Ubuntu and Knoppix and work perfectly with absolute coordinates.
The third descriptor even works on Android.
The only feedback that is missing is from MAC.
Do you have a MAC ?
Did you test my descriptos on MAC ?
Is the coordinates calculation workaround for MAC still necessary with the touchscreen descriptor ?

__________________________________

Another important thing:
Please offer the combination "Keyboard, Mouse, Touchscreen"
These three are required for the total automation of another computer.

Mouse alone is lacking absolute positioning.
Touchscreen alone is lacking right click and mouse wheel.
Both are indispensable for automating a remote computer!
 
Last edited:
Basic USB Touchscreen functionality seems to be working (at least on Windows 10) with the code I've just now committed on github. If anyone's been waiting to give this a try, now's a good time...

https://github.com/PaulStoffregen/cores/commits/master

So far, the functions are:

Code:
TouchscreenUSB.press(finger, x, y);
TouchscreenUSB.release(finger);

where "finger" is an integer from 0 to 9, and x & y range from 0 to 32767.

Here's an updated boards.txt which adds the new combinations to the Tools > USB Type menu.
 

Attachments

  • boards.txt
    28.4 KB · Views: 418
What screens are planned to be supported?

Basic USB Touchscreen functionality seems to be working (at least on Windows 10) with the code I've just now committed on github. If anyone's been waiting to give this a try, now's a good time...

https://github.com/PaulStoffregen/cores/commits/master

So far, the functions are:

Code:
TouchscreenUSB.press(finger, x, y);
TouchscreenUSB.release(finger);

where "finger" is an integer from 0 to 9, and x & y range from 0 to 32767.

Here's an updated boards.txt which adds the new combinations to the Tools > USB Type menu.
 
USB Touchscreen isn't about connecting a screen to Teensy (several libraries already exist for that purpose). It's about Teensy emulating a USB Touchscreen to your PC, just like the USB Keyboard support allows Teensy to act as a keyboard to your PC.
 
Testing

Basic USB Touchscreen functionality seems to be working (at least on Windows 10) with the code I've just now committed on github. If anyone's been waiting to give this a try, now's a good time...

https://github.com/PaulStoffregen/cores/commits/master

So far, the functions are:

Code:
TouchscreenUSB.press(finger, x, y);
TouchscreenUSB.release(finger);

where "finger" is an integer from 0 to 9, and x & y range from 0 to 32767.

Here's an updated boards.txt which adds the new combinations to the Tools > USB Type menu.

Hi!

I have been playing around with the following code using the new functions. Using a teensy 3.0 and samsung galaxy s6 with android 6

I have one possible bug report and two possible suggestions. it could be that there is something wrong in my code also.

1) BUG
The release function doesn't release the finger properly in my case.

After calling "TouchscreenUSB.release(1);"

I cant call TouchscreenUSB.press again before i have restarted my phone. Even the disconnection of the usb doesn't help.

2) SUGGESTION
Instead of keyboard+touchscreen I would like to have touchscreen+serial. Because when teensy identifies itself as a keybord, then there is no way to use the androids touchscreens keyboard. And serial would be useful for printing out info.

3) SUGGESTION
Have some kind of aspect ratio input for coordinate remapping in the API. Of course this can be done before sending in commands to the API, but maybe through the API it would be cleaner?


Thank you for the great work! Teensy is a wonderful tool!



View attachment teensy_touch.ino
 
I have the same problem. release() does not work for me. The first press() works as expected, but subsequent calls were not successful. After a few tries, the press() ceases to work. Did I do something wrong?

Using Teensy LC

Code:
#define DEBUG Serial2

void setup() {
  DEBUG.begin(115200);
  TouchscreenUSB.begin();
}

void loop() {
  for (int i = 0 ; i < 10 ; i++) 
  {
    DEBUG.println("press");
    uint16_t x = i * 3000;
    uint16_t y = i * 3000;
    
    TouchscreenUSB.press(0, x, y);
    delay(2000);
    TouchscreenUSB.release(0);
  }
}
 
Just tried this on a Teensy 3.2 and still doesn't work. I'm not sure if it's a driver issue, but I have tried uninstalling the drivers and reinstalling the usb drivers.
 
The below sketch works on a teensy 3.2 using Arduino IDE 1.69 and teensyduino 1.29. On my Windows 10 machine each touch shows as a transparent circle in the upper left hand corner. I had no problems using the keyboard while this was running.

Code:
const int LED = 13;
void setup() {
  pinMode(LED,OUTPUT);
  digitalWrite(LED,LOW);
  TouchscreenUSB.begin();

}

void loop() {
  digitalWrite(LED,HIGH);
  TouchscreenUSB.press(0,1000,1000);
  delay(100);
  TouchscreenUSB.release(0);
  digitalWrite(LED,LOW);
  delay(900);

}
 
Last edited:
I can confirm that multitouch works on a Teensy LC with Arduino 1.6.8 and the zip from https://github.com/PaulStoffregen/cores (206-08-07).
I use the following code and open mspaint fullscreen in windows 10 and get a couple of pretty lines. I have also tested it in a multitouch test app I found here and get multiple touches moving as expected.

Code:
const int LED = 13;
void setup() {
  pinMode(LED,OUTPUT);
  digitalWrite(LED,LOW);
  TouchscreenUSB.begin();

}

float mtmax = 32767.0;
float screenW = 1920.0;
float screenH = 1200.0;
//float ax, bx, cx;
//float ay, by, cy;

void loop() {
  delay(1000);
  digitalWrite(LED,HIGH);
  
  int i;
  for (i=0; i<40; i++) {
    //Mouse.move(2, -1);
    TouchscreenUSB.press(0, mtmax/2 + mtmax/screenW * i * 2, mtmax/2 + mtmax/screenH * i * -1);
    TouchscreenUSB.press(1, 1000 + mtmax/2 + mtmax/screenW * i * 2, -500 + mtmax/2 + mtmax/screenH * i * -1);
    delay(25);
  }
  TouchscreenUSB.release(0);
  //TouchscreenUSB.release(1);
  
  delay(3000);
  for (i=0; i<40; i++) {
    //Mouse.move(2, 2);
    TouchscreenUSB.press(2, mtmax/2 + mtmax/screenW * i * 2, mtmax/2 + mtmax/screenH * i * 2);
    TouchscreenUSB.press(1, 1000 + mtmax/2 + mtmax/screenW * i * 2, -500 + mtmax/2 + mtmax/screenH * i * 2);
    delay(25);
  }

  delay(3000);
  TouchscreenUSB.release(2);
  TouchscreenUSB.release(1);
  for (i=0; i<40; i++) {
    //Mouse.move(-4, -1);
    TouchscreenUSB.press(3, mtmax/2 + mtmax/screenW * i * -4, mtmax/2 + mtmax/screenH * i * -1);
    TouchscreenUSB.press(4, 1000 + mtmax/2 + mtmax/screenW * i * -4, -500 + mtmax/2 + mtmax/screenH * i * -1);
    delay(25);
  }
  
  delay(100);
  TouchscreenUSB.release(3);
  TouchscreenUSB.release(4);
  digitalWrite(LED,LOW);
  //delay(10000);
  while(1);
}
 
Last edited:
Hi, I'm currently working on a touch screen where the finger position is computed using one strain gauge on each corner. This touchscreen is connected to a raspberry pi. At first, I used the Mouse HID but recently discovered your (undocumented) touchscreen HID. Any idea on how to make it work with Serial ? I really need it in order to debug the strain gauges values (as they change during the day).
 
They change during the day? Why not use a passive strain gauge to temperature correct them?
 
This is a suggestion I made, but i'm not the one who is making choices on the design. The drift may be caused by the temperature, electronic drift or mechanical drift. Unfortunately, I have to deal with it anyway.
 
This touchscreen is connected to a raspberry pi. At first, I used the Mouse HID but recently discovered your (undocumented) touchscreen HID. Any idea on how to make it work with Serial ?
Touchscreen HID includes an extra HID endpoint to provide a serial channel that works with both Arduino serial monitor and TyQt. You can also use a network gateway utility (e.g. with telnet):
https://forum.pjrc.com/threads/2347...Teensy-when-it-is-configured-as-Disk-Keyboard

On the Teensy side, just use the normal 'Serial' object.
 
That is some great information. However I still have a small issue that must be solved with just the right advice : i'm using Atom with the Platformio framework. I can locate the teensy_gateway executable and start it, however nothing shows off and I can't connect through telnet. Is there anything more to do in order to make it work (parameter maybe) ?

Thank you for your fast and useful answer :)

EDIT: I forgot to add that I'm using ArchLinux with Teensyduino v1.30 (according to the file version.txt found in the platformio files).
 
Last edited:
That is some great information. However I still have a small issue that must be solved with just the right advice : i'm using Atom with the Platformio framework. I can locate the teensy_gateway executable and start it, however nothing shows off and I can't connect through telnet. Is there anything more to do in order to make it work (parameter maybe) ?

Thank you for your fast and useful answer :)
I shouldn't post without actually testing things. It looks like none of Arduino serial monitor, teensy_gateway and TyQt recognize the new USB ID that USB Touchscreen uses.

The USB ID is defined in "/hardware/teensy/avr/cores/teensy3/usb_desc.h" under USB_TOUCHSCREEN / PRODUCT_ID. If I replace "0x048B" with an existing /older ID ("0x0482"), Arduino serial monitor, teensy_gateway and TyQt all work. A possible gotcha is that at least Windows caches USB descriptors, so it will be confused if you already used that Product Id before on the same USB port. So you may have to clean up the USB descriptors.

You shouldn't need a parameter for teensy_gateway. It works fine for me, I immediately get a greeting when connecting:

> nc 127.0.0.1 28541
teensy_gateway

(nc is netcat, I don't have telnet installed.)
 
Sorry for not giving feedback the last few weeks : I was relying on an email to notify me from new messages plus i'm an apprentice and wasn't at the company lastly. So I just got a new computer from the company, W7 and stuff. I finally succeeded in making the touchscreen works but I noticed an error (maybe ?), when I use the mouse on the computer, the touchscreen doesn't work anymore, I have to plug and unplug it. That is not a problem as I'm using a mouse only when I program it and the device will go on a Raspberry pi later (which will not have any mouse).

Anyway, I'm able to start teensy_gateway and connect to it through telnet (using telnet from Microsoft). But no data is coming. I tried changing the baudrate, reinstall the drivers and change the Product_ID in usb_desc.h, with no luck. I'll try with teensyduino by tomorrow.

Thank you all for your help.
 
Hello, I have bought 15pcs teensy 3.2.

Touch Simulation is working fine on Windows unfortunately Raspberry/Raspbian OS has problems with the release function.

I now have asked to add support for teensy, see:
https://github.com/raspberrypi/linux/issues/2336

Is there something I /we/ teensy can do to speed up support for raspberry (raspbian jessie)?

thankyou
 
no help? I am willing to pay for that! I wrote a Code on the teensy compatible to Focaltech, Goodix, Cypress and Ilitek I2C capacitive Touchscreens which converts the I2C touchscreen data to USB data with your press and release function and that works very good with windows OS but not with Raspbian. I am little bit frustrated...:-(( I am surprised that USB Touchscreen are still not full Plug&Play on all OS like USB Mouse
 
Back
Top