| 1 |
/* Copyright (C) 2007 L. Donnie Smith <wiimote@abstrakraft.org> |
|---|
| 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 |
* ChangeLog: |
|---|
| 18 |
* 2007-06-01 L. Donnie Smith <cwiid@abstrakraft.org> |
|---|
| 19 |
* * changed wmplugin_exec prototype (pass mesg instead of &mesg) |
|---|
| 20 |
* * changed param interface (pass pointers) |
|---|
| 21 |
* |
|---|
| 22 |
* 2007-04-09 L. Donnie Smith <cwiid@abstrakraft.org> |
|---|
| 23 |
* * updated for libcwiid rename |
|---|
| 24 |
* |
|---|
| 25 |
* 2007-04-08 L. Donnie Smith <cwiid@abstrakraft.org> |
|---|
| 26 |
* * added param structs |
|---|
| 27 |
* |
|---|
| 28 |
* 2007-03-04 L. Donnie Smith <cwiid@abstrakraft.org> |
|---|
| 29 |
* * Initial ChangeLog |
|---|
| 30 |
* * type audit (stdint, const, char booleans) |
|---|
| 31 |
*/ |
|---|
| 32 |
|
|---|
| 33 |
#ifndef WMPLUGIN_H |
|---|
| 34 |
#define WMPLUGIN_H |
|---|
| 35 |
|
|---|
| 36 |
#include <stdint.h> |
|---|
| 37 |
#include <linux/input.h> |
|---|
| 38 |
#include <cwiid.h> |
|---|
| 39 |
|
|---|
| 40 |
#define WMPLUGIN_MAX_BUTTON_COUNT 16 |
|---|
| 41 |
#define WMPLUGIN_MAX_AXIS_COUNT 6 |
|---|
| 42 |
#define WMPLUGIN_MAX_PARAM_COUNT 16 |
|---|
| 43 |
|
|---|
| 44 |
#define WMPLUGIN_ABS 1 |
|---|
| 45 |
#define WMPLUGIN_REL 2 |
|---|
| 46 |
|
|---|
| 47 |
struct wmplugin_button_info { |
|---|
| 48 |
char *name; |
|---|
| 49 |
}; |
|---|
| 50 |
|
|---|
| 51 |
struct wmplugin_axis_info { |
|---|
| 52 |
char *name; |
|---|
| 53 |
__u16 type; |
|---|
| 54 |
int max; |
|---|
| 55 |
int min; |
|---|
| 56 |
int fuzz; |
|---|
| 57 |
int flat; |
|---|
| 58 |
}; |
|---|
| 59 |
|
|---|
| 60 |
enum wmplugin_param_type { |
|---|
| 61 |
WMPLUGIN_PARAM_INT, |
|---|
| 62 |
WMPLUGIN_PARAM_FLOAT |
|---|
| 63 |
}; |
|---|
| 64 |
|
|---|
| 65 |
struct wmplugin_param_info { |
|---|
| 66 |
char *name; |
|---|
| 67 |
enum wmplugin_param_type type; |
|---|
| 68 |
void *ptr; |
|---|
| 69 |
}; |
|---|
| 70 |
|
|---|
| 71 |
struct wmplugin_info { |
|---|
| 72 |
unsigned char button_count; |
|---|
| 73 |
struct wmplugin_button_info button_info[WMPLUGIN_MAX_BUTTON_COUNT]; |
|---|
| 74 |
unsigned char axis_count; |
|---|
| 75 |
struct wmplugin_axis_info axis_info[WMPLUGIN_MAX_AXIS_COUNT]; |
|---|
| 76 |
unsigned char param_count; |
|---|
| 77 |
struct wmplugin_param_info param_info[WMPLUGIN_MAX_PARAM_COUNT]; |
|---|
| 78 |
}; |
|---|
| 79 |
|
|---|
| 80 |
struct wmplugin_axis { |
|---|
| 81 |
char valid; |
|---|
| 82 |
__s32 value; |
|---|
| 83 |
}; |
|---|
| 84 |
|
|---|
| 85 |
struct wmplugin_data { |
|---|
| 86 |
uint16_t buttons; |
|---|
| 87 |
struct wmplugin_axis axes[WMPLUGIN_MAX_AXIS_COUNT]; |
|---|
| 88 |
}; |
|---|
| 89 |
|
|---|
| 90 |
typedef struct wmplugin_info *wmplugin_info_t(void); |
|---|
| 91 |
typedef int wmplugin_init_t(int, cwiid_wiimote_t *); |
|---|
| 92 |
typedef struct wmplugin_data *wmplugin_exec_t(int, union cwiid_mesg []); |
|---|
| 93 |
|
|---|
| 94 |
int wmplugin_set_rpt_mode(int id, uint8_t rpt_mode); |
|---|
| 95 |
void wmplugin_err(int id, char *str, ...); |
|---|
| 96 |
|
|---|
| 97 |
#endif |
|---|