arpruss / USBComposite_stm32f1

USB Composite library for STM32F1 (HID, Serial, MIDI and XBox360 controller)
Other
382 stars 76 forks source link

Touch Screen Example, Help!!! #26

Closed okooo5km closed 4 years ago

okooo5km commented 5 years ago

Based on your work, I have developed the Touch Screen class after reading the document (DigitizerDrvs_touch),but it does not work well! Windows 10 can recognize it as the HID device not a pen or a touch panel. I think maybe it needs to send the feature data to win os. Now I have no idea about responsing the GET_REPORT or SET_REPORT request, Could you give me some suggestions?

Development Environment

ReportDescriptor

#define MAX_TOUCH_POINT 0x0a /* 最多支持多少点触摸 */
#define HID_MTS_REPORT_ID 0x01
#define HID_STS_REPORT_ID 0x02
#define FEAUTURE_REPORT_ID 0x03

#define HID_TOUCH_SCREEN_REPORT_DESCRIPTOR(...)                             \
  0x05, 0x0d,                  /*  USAGE_PAGE (Digitizers) */               \
      0x09, 0x04,              /*  USAGE (Touch Screen) */                  \
      0xa1, 0x01,              /*  COLLECTION (Application) */              \
      0x85, HID_MTS_REPORT_ID, /*    REPORT_ID */                           \
      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) */              \
      0x09, 0x32,              /*      USAGE (In Range) */                  \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x47,              /*      USAGE (Touch Valid) */               \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x05,              /*      REPORT_COUNT (5) */                  \
      0x81, 0x03,              /*      INPUT (Cnst,Ary,Abs) */              \
      0x25, MAX_TOUCH_POINT,   /*      LOGICAL_MAXIMUM (MAX_TOUCH_POINT) */ \
      0x75, 0x08,              /*      REPORT_SIZE (8) */                   \
      0x09, 0x51,              /*      USAGE (Contact Identifier) */        \
      0x95, 0x01,              /*      REPORT_COUNT (1) */                  \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs4) */             \
      0x05, 0x01,              /*      USAGE_PAGE (Generic Desktop) */      \
      0x26, 0x00, 0x10,        /*      LOGICAL_MAX9MUM (4096 ) */           \
      0x75, 0x10,              /*      REPORT_SIZE (16) */                  \
      0x55, 0x00,              /*      UNIT_EXPONENT (0) */                 \
      0x65, 0x00,              /*      UNIT (None) */                       \
      0x09, 0x30,              /*      USAGE (X) */                         \
      0x35, 0x00,              /*      PHYSICAL_MINIMUM (0) */              \
      0x46, 0x00, 0x00,        /*      PHYSICAL_MAXIMUM (0) */              \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x31,              /*      USAGE (Y) */                         \
      0x46, 0x00, 0x00,        /*      PHYSICAL_MAXIMUM (0) */              \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0xc0,                    /*    END_COLLECTION */                      \
      0xa1, 0x02,              /*    COLLECTION (Logical) */                \
      0x05, 0x0d,              /*      USAGE_PAGE (Digitizers) */           \
      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) */              \
      0x09, 0x32,              /*      USAGE (In Range) */                  \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x47,              /*      USAGE (Touch Valid) */               \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x05,              /*      REPORT_COUNT (5) */                  \
      0x81, 0x03,              /*      INPUT (Cnst,Ary,Abs) */              \
      0x25, MAX_TOUCH_POINT,   /*      LOGICAL_MAXIMUM (MAX_TOUCH_POINT) */ \
      0x75, 0x08,              /*      REPORT_SIZE (8) */                   \
      0x09, 0x51,              /*      USAGE (Contact Identifier) */        \
      0x95, 0x01,              /*      REPORT_COUNT (1) */                  \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x05, 0x01,              /*      USAGE_PAGE (Generic Desktop) */      \
      0x26, 0x00, 0x10,        /*      LOGICAL_MAX9MUM (4096 ) */           \
      0x75, 0x10,              /*      REPORT_SIZE (16) */                  \
      0x55, 0x00,              /*      UNIT_EXPONENT (0) */                 \
      0x65, 0x00,              /*      UNIT (None) */                       \
      0x09, 0x30,              /*      USAGE (X) */                         \
      0x35, 0x00,              /*      PHYSICAL_MINIMUM (0) */              \
      0x46, 0x00, 0x00,        /*      PHYSICAL_MAXIMUM (0) */              \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0x09, 0x31,              /*      USAGE (Y) */                         \
      0x46, 0x00, 0x00,        /*      PHYSICAL_MAXIMUM (0) */              \
      0x81, 0x02,              /*      INPUT (Data,Var,Abs) */              \
      0xc0,                    /*    END_COLLECTION */                      \
      0x05, 0x0d,              /*    USAGE_PAGE (Digitizers) */             \
      0x09, 0x54,              /*    USAGE (Contact Count) */               \
      0x95, 0x01,              /*    REPORT_COUNT (1) */                    \
      0x75, 0x08,              /*    REPORT_SIZE (8) */                     \
      0x15, 0x00,              /*    LOGICAL_MINIMUM (0) */                 \
      0x25, MAX_TOUCH_POINT,   /*    LOGICAL_MAXIMUM (MAX_TOUCH_POINT) */   \
      0x81, 0x02,              /*    INPUT (Data,Var,Abs) */                \
      0x09, 0x55,              /*    USAGE (COntact Count Maximum) */       \
      0xb1, 0x02,              /*    FEATURE (Data,Var,Abs) */              \
      0xc0,                    /*  END_COLLECTION */
arpruss commented 4 years ago

Sorry, I don't know how the touch panel profile works.