source: mainline/uspace/srv/hid/isdv4_tablet/isdv4.h@ b266f9e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since b266f9e was f66ca57f, checked in by Martin Sucha <sucha14@…>, 13 years ago

Rename wacomdump to isdv4_tablet and register with unique service name.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * Copyright (c) 2012 Martin Sucha
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __ISDV4_H__
30#define __ISDV4_H__
31
32typedef struct isdv4_event isdv4_event_t;
33
34typedef void (*isdv4_event_fn)(const isdv4_event_t *);
35
36typedef struct {
37 /* Stylus information */
38 unsigned int stylus_max_x;
39 unsigned int stylus_max_y;
40 unsigned int stylus_max_pressure;
41 unsigned int stylus_max_xtilt;
42 unsigned int stylus_max_ytilt;
43 bool stylus_tilt_supported;
44
45 /* Touch information */
46 unsigned int touch_type;
47 unsigned int touch_max_x;
48 unsigned int touch_max_y;
49
50 /* Event state */
51 bool stylus_in_proximity;
52 bool stylus_is_eraser;
53 bool tip_pressed; /* Reported as stylus button 1 */
54 bool button1_pressed; /* Reported as stylus button 2 */
55 bool button2_pressed; /* Reported as stylus button 3 */
56 bool finger1_pressed; /* Reported as touch button 1 */
57
58 /* Session to the serial device */
59 async_sess_t *sess;
60
61 /* Receive buffer state */
62 uint8_t *buf;
63 size_t buf_size;
64 size_t buf_end;
65
66 /* Callbacks */
67 isdv4_event_fn emit_event_fn;
68} isdv4_state_t;
69
70typedef enum {
71 UNKNOWN, PRESS, RELEASE, PROXIMITY_IN, PROXIMITY_OUT, MOVE
72} isdv4_event_type_t;
73
74typedef enum {
75 STYLUS_TIP, STYLUS_ERASER, TOUCH
76} isdv4_source_type_t;
77
78typedef struct isdv4_event {
79 isdv4_event_type_t type;
80 isdv4_source_type_t source;
81 unsigned int x;
82 unsigned int y;
83 unsigned int pressure;
84 unsigned int button;
85} isdv4_event_t;
86
87extern int isdv4_init(isdv4_state_t *, async_sess_t *, isdv4_event_fn);
88extern int isdv4_init_tablet(isdv4_state_t *);
89extern int isdv4_read_events(isdv4_state_t *state);
90extern void isdv4_fini(isdv4_state_t *);
91
92#endif
Note: See TracBrowser for help on using the repository browser.