diff options
Diffstat (limited to 'utils/nwztools/plattools/nwz_lib.h')
-rw-r--r-- | utils/nwztools/plattools/nwz_lib.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/utils/nwztools/plattools/nwz_lib.h b/utils/nwztools/plattools/nwz_lib.h index 5c8ad3e50c..1dd7b4c85b 100644 --- a/utils/nwztools/plattools/nwz_lib.h +++ b/utils/nwztools/plattools/nwz_lib.h | |||
@@ -29,10 +29,13 @@ | |||
29 | #include <sys/wait.h> | 29 | #include <sys/wait.h> |
30 | #include <linux/input.h> | 30 | #include <linux/input.h> |
31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
32 | #include <string.h> | ||
32 | 33 | ||
33 | #include "nwz_keys.h" | 34 | #include "nwz_keys.h" |
34 | #include "nwz_fb.h" | 35 | #include "nwz_fb.h" |
35 | #include "nwz_adc.h" | 36 | #include "nwz_adc.h" |
37 | #include "nwz_ts.h" | ||
38 | #include "nwz_power.h" | ||
36 | 39 | ||
37 | /* run a program and exit with nonzero status in case of error | 40 | /* run a program and exit with nonzero status in case of error |
38 | * argument list must be NULL terminated */ | 41 | * argument list must be NULL terminated */ |
@@ -81,4 +84,70 @@ const char *nwz_adc_get_name(int ch); | |||
81 | /* read channel value, return -1 on error */ | 84 | /* read channel value, return -1 on error */ |
82 | int nwz_adc_get_val(int fd, int ch); | 85 | int nwz_adc_get_val(int fd, int ch); |
83 | 86 | ||
87 | /* open touchscreen device */ | ||
88 | int nwz_ts_open(void); | ||
89 | /* close touchscreen device */ | ||
90 | void nwz_ts_close(int fd); | ||
91 | /* structure to track touch state */ | ||
92 | struct nwz_ts_state_t | ||
93 | { | ||
94 | int x, y; /* current position (valid is touch is true) */ | ||
95 | int max_x, max_y; /* maximum possible values */ | ||
96 | int pressure, tool_width; /* current pressure and tool width */ | ||
97 | int max_pressure, max_tool_width; /* maximum possible values */ | ||
98 | bool touch; /* is the user touching the screen? */ | ||
99 | bool flick; /* was the action a flick? */ | ||
100 | int flick_x, flick_y; /* if so, this is the flick direction */ | ||
101 | }; | ||
102 | /* get touchscreen information and init state, return -1 on error, 1 on success */ | ||
103 | int nwz_ts_state_init(int fd, struct nwz_ts_state_t *state); | ||
104 | /* update state with an event, return -1 on unhandled event, >=0 on handled: | ||
105 | * 1 if sync event, 0 otherwise */ | ||
106 | int nwz_ts_state_update(struct nwz_ts_state_t *state, struct input_event *evt); | ||
107 | /* update state after a sync event to prepare for next round of events */ | ||
108 | int nwz_ts_state_post_syn(struct nwz_ts_state_t *state); | ||
109 | /* read at most N events from touch screen, and return the number of events */ | ||
110 | int nwz_ts_read_events(int fd, struct input_event *evts, int nr_evts); | ||
111 | |||
112 | /* wait for events on several file descriptors, return a bitmap of active ones | ||
113 | * or 0 on timeout, the timeout can be -1 to block */ | ||
114 | long nwz_wait_fds(int *fds, int nr_fds, long timeout_us); | ||
115 | |||
116 | /* open power device */ | ||
117 | int nwz_power_open(void); | ||
118 | /* close power device */ | ||
119 | void nwz_power_close(int fd); | ||
120 | /* get power status (return -1 on error, bitmap on success) */ | ||
121 | int nwz_power_get_status(int fd); | ||
122 | /* get vbus adval (or -1 on error) */ | ||
123 | int nwz_power_get_vbus_adval(int fd); | ||
124 | /* get vbus voltage in mV (or -1 on error) */ | ||
125 | int nwz_power_get_vbus_voltage(int fd); | ||
126 | /* get vbus current limit (or -1 on error) */ | ||
127 | int nwz_power_get_vbus_limit(int fd); | ||
128 | /* get charge switch (or -1 on error) */ | ||
129 | int nwz_power_get_charge_switch(int fd); | ||
130 | /* get charge current (or -1 on error) */ | ||
131 | int nwz_power_get_charge_current(int fd); | ||
132 | /* get battery gauge (or -1 on error) */ | ||
133 | int nwz_power_get_battery_gauge(int fd); | ||
134 | /* get battery adval (or -1 on error) */ | ||
135 | int nwz_power_get_battery_adval(int fd); | ||
136 | /* get battery voltage in mV (or -1 on error) */ | ||
137 | int nwz_power_get_battery_voltage(int fd); | ||
138 | /* get vbat adval (or -1 on error) */ | ||
139 | int nwz_power_get_vbat_adval(int fd); | ||
140 | /* get vbat voltage (or -1 on error) */ | ||
141 | int nwz_power_get_vbat_voltage(int fd); | ||
142 | /* get sample count (or -1 on error) */ | ||
143 | int nwz_power_get_sample_count(int fd); | ||
144 | /* get vsys adval (or -1 on error) */ | ||
145 | int nwz_power_get_vsys_adval(int fd); | ||
146 | /* get vsys voltage in mV (or -1 on error) */ | ||
147 | int nwz_power_get_vsys_voltage(int fd); | ||
148 | /* get accessory charge mode */ | ||
149 | int nwz_power_get_acc_charge_mode(int fd); | ||
150 | /* is battery fully charged? (or -1 on error) */ | ||
151 | int nwz_power_is_fully_charged(int fd); | ||
152 | |||
84 | #endif /* _NWZLIB_H_ */ | 153 | #endif /* _NWZLIB_H_ */ |