diff options
Diffstat (limited to 'utils/nwztools/plattools/nwz_lib.h')
-rw-r--r-- | utils/nwztools/plattools/nwz_lib.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/utils/nwztools/plattools/nwz_lib.h b/utils/nwztools/plattools/nwz_lib.h new file mode 100644 index 0000000000..e9d885d87a --- /dev/null +++ b/utils/nwztools/plattools/nwz_lib.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2016 Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _NWZLIB_H_ | ||
22 | #define _NWZLIB_H_ | ||
23 | |||
24 | #include <stdio.h> | ||
25 | #include <stdbool.h> | ||
26 | #include <stdarg.h> | ||
27 | #include <unistd.h> | ||
28 | #include <sys/types.h> | ||
29 | #include <sys/wait.h> | ||
30 | #include <linux/input.h> | ||
31 | #include <fcntl.h> | ||
32 | |||
33 | #include "nwz_keys.h" | ||
34 | |||
35 | /* run a program and exit with nonzero status in case of error | ||
36 | * argument list must be NULL terminated */ | ||
37 | void nwz_run(const char *file, const char *args[], bool wait); | ||
38 | |||
39 | /* invoke /usr/bin/lcdmsg to display a message using the small font, optionally | ||
40 | * clearing the screen before */ | ||
41 | void nwz_lcdmsg(bool clear, int x, int y, const char *msg); | ||
42 | void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...); | ||
43 | |||
44 | /* open icx_key input device and return file descriptor */ | ||
45 | int nwz_key_open(void); | ||
46 | void nwz_key_close(int fd); | ||
47 | /* return HOLD status: 0 or 1, or -1 on error */ | ||
48 | int nwz_key_get_hold_status(int fd); | ||
49 | /* wait for an input event (and return 1), or a timeout (return 0), or error (-1) | ||
50 | * set the timeout to -1 to block */ | ||
51 | int nwz_key_wait_event(int fd, long tmo_us); | ||
52 | /* read an event from the device (may block unless you waited for an event before), | ||
53 | * return 1 on success, <0 on error */ | ||
54 | int nwz_key_read_event(int fd, struct input_event *evt); | ||
55 | /* return keycode from event */ | ||
56 | int nwz_key_event_get_keycode(struct input_event *evt); | ||
57 | /* return press/released status from event */ | ||
58 | bool nwz_key_event_is_press(struct input_event *evt); | ||
59 | /* return HOLD status from event */ | ||
60 | bool nwz_key_event_get_hold_status(struct input_event *evt); | ||
61 | /* get keycode name */ | ||
62 | const char *nwz_key_get_name(int keycode); | ||
63 | |||
64 | #endif /* _NWZLIB_H_ */ | ||