Necesito averiguar la estructura de datos de entrada de la pantalla táctil compatible con HID (toque único) (como el orden de bytes y lo que debe escribirse en cada byte).
He usado el descriptor de pantalla táctil compatible con HID de los documentos oficiales de Microsoft
y en la PC host usando el Administrador de dispositivos puedo ver que enumera con éxito el dispositivo compatible con HID. Ahora quiero enviar un informe HID al host, pero el problema es que no he encontrado algo como el protocolo de inicio HID para la pantalla táctil (para el mouse y el teclado está claramente definido en la especificación de la organización USB). Esta es una muestra de código que estoy usando para crear un informe HID de pantalla táctil y funciona, pero no como se esperaba. Encontré esta combinación de bytes investigando muchos códigos de github y leyendo artículos, pero quiero encontrar algún documento mediante el cual pueda probar que el orden es correcto.
char report[8] = {0}; uint16_t x_access = 10000; uint16_t y_access = 10000; report[0] = 0x01; //reportid report[1] = 0x3; //statuss report[2] = LOWBYTE(x_access); //x low byte report[3] = HIGHBYTE(x_access); //x high byte report[4] = LOWBYTE(y_access); //y low byte report[5] = HIGHBYTE(y_access); //y high byte report[6] = 0x65; //touch parsing time low byte report[7] = 0x00; //touch parsing time high byte //report[8] = 1 //this doesn't have any impact (touch count)Enlaces útiles que he usado
Gracias de antemano por la ayuda.
Con RDD! Con la herramienta HID Report Descriptor Decoder , podemos generar fácilmente estructuras C desde la pantalla táctil proporcionada por Microsoft "Sample Report Descriptor" :
//-------------------------------------------------------------------------------- // Digitizer Device Page inputReport 01 (Device --> Host) //-------------------------------------------------------------------------------- typedef struct { uint8_t reportId; // Report ID = 0x01 (1) // Collection: CA:TouchScreen CL:Finger uint8_t DIG_TouchScreenFingerTipSwitch : 1; // Usage 0x000D0042: Tip Switch, Value = 0 to 1 uint8_t : 7; // Pad uint8_t DIG_TouchScreenFingerContactIdentifier; // Usage 0x000D0051: Contact Identifier, Value = 0 to 1 uint16_t GD_TouchScreenFingerX[2]; // Usage 0x00010030: X, Value = 0 to 4095, Physical = Value x 241 / 819 in 10⁻² inch units uint16_t GD_TouchScreenFingerY[2]; // Usage 0x00010031: Y, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerWidth; // Usage 0x000D0048: Width, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerHeight; // Usage 0x000D0049: Height, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerAzimuth; // Usage 0x000D003F: Azimuth, Value = 0 to 62831, Physical = Value in 10⁻⁴ rad units uint8_t DIG_TouchScreenFingerTipSwitch_1 : 1; // Usage 0x000D0042: Tip Switch, Value = 0 to 1, Physical = Value x 62831 in 10⁻⁴ rad units uint8_t : 7; // Pad uint8_t DIG_TouchScreenFingerContactIdentifier_1; // Usage 0x000D0051: Contact Identifier, Value = 0 to 1, Physical = Value x 62831 in 10⁻⁴ rad units uint16_t GD_TouchScreenFingerX_1[2]; // Usage 0x00010030: X, Value = 0 to 4095, Physical = Value x 241 / 819 in 10⁻² inch units uint16_t GD_TouchScreenFingerY_1[2]; // Usage 0x00010031: Y, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerWidth_1; // Usage 0x000D0048: Width, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerHeight_1; // Usage 0x000D0049: Height, Value = 0 to 4095, Physical = Value x 302 / 1365 in 10⁻² inch units uint16_t DIG_TouchScreenFingerAzimuth_1; // Usage 0x000D003F: Azimuth, Value = 0 to 62831, Physical = Value in 10⁻⁴ rad units // Collection: CA:TouchScreen uint16_t DIG_TouchScreenRelativeScanTime; // Usage 0x000D0056: Relative Scan Time, Value = 0 to 65535, Physical = Value in 10⁻⁴ s units uint8_t DIG_TouchScreenContactCount; // Usage 0x000D0054: Contact Count, Value = 0 to 127, Physical = Value x 65535 / 127 in 10⁻⁴ s units } inputReport01_t;