| 1 | /* Copyright (C) 2007 L. Donnie Smith <donnie.smith@gatech.edu> |
|---|
| 2 | * |
|---|
| 3 | * This program is free software; you can redistribute it and/or modify |
|---|
| 4 | * it under the terms of the GNU General Public License as published by |
|---|
| 5 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 6 | * (at your option) any later version. |
|---|
| 7 | * |
|---|
| 8 | * This program is distributed in the hope that it will be useful, |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | * GNU General Public License for more details. |
|---|
| 12 | * |
|---|
| 13 | * You should have received a copy of the GNU General Public License |
|---|
| 14 | * along with this program; if not, write to the Free Software |
|---|
| 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 16 | * |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | #ifndef WMPLUGIN_H |
|---|
| 20 | #define WMPLUGIN_H |
|---|
| 21 | |
|---|
| 22 | #include <stdint.h> |
|---|
| 23 | #include <linux/input.h> |
|---|
| 24 | #include <cwiid.h> |
|---|
| 25 | |
|---|
| 26 | #define WMPLUGIN_MAX_BUTTON_COUNT 16 |
|---|
| 27 | #define WMPLUGIN_MAX_AXIS_COUNT 6 |
|---|
| 28 | #define WMPLUGIN_MAX_PARAM_COUNT 16 |
|---|
| 29 | |
|---|
| 30 | #define WMPLUGIN_ABS 1 |
|---|
| 31 | #define WMPLUGIN_REL 2 |
|---|
| 32 | |
|---|
| 33 | struct wmplugin_button_info { |
|---|
| 34 | char *name; |
|---|
| 35 | }; |
|---|
| 36 | |
|---|
| 37 | struct wmplugin_axis_info { |
|---|
| 38 | char *name; |
|---|
| 39 | __u16 type; |
|---|
| 40 | int max; |
|---|
| 41 | int min; |
|---|
| 42 | int fuzz; |
|---|
| 43 | int flat; |
|---|
| 44 | }; |
|---|
| 45 | |
|---|
| 46 | enum wmplugin_param_type { |
|---|
| 47 | WMPLUGIN_PARAM_INT, |
|---|
| 48 | WMPLUGIN_PARAM_FLOAT |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | struct wmplugin_param_info { |
|---|
| 52 | char *name; |
|---|
| 53 | enum wmplugin_param_type type; |
|---|
| 54 | void *ptr; |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | struct wmplugin_info { |
|---|
| 58 | unsigned char button_count; |
|---|
| 59 | struct wmplugin_button_info button_info[WMPLUGIN_MAX_BUTTON_COUNT]; |
|---|
| 60 | unsigned char axis_count; |
|---|
| 61 | struct wmplugin_axis_info axis_info[WMPLUGIN_MAX_AXIS_COUNT]; |
|---|
| 62 | unsigned char param_count; |
|---|
| 63 | struct wmplugin_param_info param_info[WMPLUGIN_MAX_PARAM_COUNT]; |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | struct wmplugin_axis { |
|---|
| 67 | char valid; |
|---|
| 68 | __s32 value; |
|---|
| 69 | }; |
|---|
| 70 | |
|---|
| 71 | struct wmplugin_data { |
|---|
| 72 | uint16_t buttons; |
|---|
| 73 | struct wmplugin_axis axes[WMPLUGIN_MAX_AXIS_COUNT]; |
|---|
| 74 | }; |
|---|
| 75 | |
|---|
| 76 | typedef struct wmplugin_info *wmplugin_info_t(void); |
|---|
| 77 | typedef int wmplugin_init_t(int, cwiid_wiimote_t *); |
|---|
| 78 | typedef struct wmplugin_data *wmplugin_exec_t(int, union cwiid_mesg []); |
|---|
| 79 | |
|---|
| 80 | int wmplugin_set_rpt_mode(int id, uint8_t rpt_mode); |
|---|
| 81 | void wmplugin_err(int id, char *str, ...); |
|---|
| 82 | |
|---|
| 83 | #endif |
|---|