1 // Copyright 2016 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/compiler.h>
8 #include <zircon/types.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 
12 __BEGIN_CDECLS
13 
14 #define EYOYO_RPT_ID_TOUCH 1
15 
16 #define EYOYO_FINGER_ID_TSWITCH_MASK 0x01
17 #define EYOYO_FINGER_ID_CONTACT_MASK 0x7f
18 #define eyoyo_finger_id_tswitch(b) (b & EYOYO_FINGER_ID_TSWITCH_MASK)
19 #define eyoyo_finger_id_contact(b) ((b >> 1) & EYOYO_FINGER_ID_CONTACT_MASK)
20 
21 #define EYOYO_X_MAX 32767
22 #define EYOYO_Y_MAX 32767
23 
24 typedef struct eyoyo_finger {
25     uint8_t finger_id;
26     uint16_t x;
27     uint16_t y;
28 } __attribute__((packed)) eyoyo_finger_t;
29 
30 typedef struct eyoyo_touch {
31     uint8_t rpt_id;
32     eyoyo_finger_t fingers[10];
33     uint8_t unknown0;
34     uint16_t unknown1;
35 } __attribute__((packed)) eyoyo_touch_t;
36 
37 bool is_eyoyo_touch_report_desc(const uint8_t* data, size_t len);
38 zx_status_t setup_eyoyo_touch(int fd);
39 
40 __END_CDECLS
41