/usr/include/libcwiimote/wiimote_report.h is in libcwiimote-dev 0.4+svn83ant-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /* $Id: wiimote_report.h 47 2007-03-08 02:34:23Z bja $
*
* Copyright (C) 2007, Joel Andersson <bja@kth.se>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _WIIMOTE_REPORT_H
#define _WIIMOTE_REPORT_H
/* TODO: The ReportIDs should be named consistently. */
#define WIIMOTE_RID_LEDS 0x11
#define WIIMOTE_RID_MODE 0x12
#define WIIMOTE_RID_IR_EN 0x13
#define WIIMOTE_RID_SPK_EN 0x14
#define WIIMOTE_RID_STATUS 0x15
#define WIIMOTE_RID_WRITE 0x16
#define WIIMOTE_RID_READ 0x17
#define WIIMOTE_RID_SPK 0x18
#define WIIMOTE_RID_SPK_MUTE 0x19
#define WIIMOTE_RID_IR2_EN 0x1a
#define WIIMOTE_RID_READ_IN 0x21
#define WIIMOTE_RID_WRITE_IN 0x22
#define WIIMOTE_HID_HEADER 0x52
#define WIIMOTE_HID_HEADER_IN 0xa1
#define WIIMOTE_WRITE_INIT {0x52,0x16,0x00}
#define WIIMOTE_READ_INIT {0x52,0x17,0x00}
#define WIIMOTE_RID_ISTATUS 0x20
#define WIIMOTE_RID_OSTATUS 0x15
#define WIIMOTE_REPORT_INIT {{0}}
/*
*
*/
struct req_write_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x16 */
uint32_t addr;
uint8_t size;
uint8_t data[16];
} __attribute__((packed));
/*
*
*/
struct req_write_in {
uint8_t header; /* 0xa1 */
uint8_t channel; /* 0x22 */
uint16_t data;
} __attribute__((packed));
/*
*
*/
struct req_read_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x17 */
uint32_t addr;
uint16_t size;
} __attribute__((packed));
/*
*
*/
struct req_read_in {
uint8_t header; /* 0xa1 */
uint8_t channel; /* 0x21 */
uint16_t buttons;
uint8_t err : 4;
uint8_t len : 4;
uint16_t addr;
uint8_t data[16];
} __attribute__((packed));
/*
*
*/
struct req_raw_out {
uint8_t header; /* 0x52 */
uint8_t channel;
uint8_t data[21];
} __attribute__((packed));
/*
*
*/
struct req_mode_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x12 */
struct {
uint8_t __1 : 4;
uint8_t continuous : 1;
uint8_t __2 : 2;
uint8_t rumble : 1;
} __attribute__((packed)) options;
uint8_t mode; /* 0x30-0x3f */
} __attribute__((packed));
/*
*
*/
struct req_mode_in {
uint8_t header; /* 0xa1 */
uint8_t channel; /* 0x30-0x3f */
wiimote_keys_t keys;
wiimote_point3_t accel;
wiimote_point2_t ir[8];
} __attribute__((packed));
/*
*
*/
struct req_led_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x11 */
uint8_t rumble : 4; /* 0x00,0x01 */
uint8_t leds : 4; /* 0x00-0x0f */
} __attribute__((packed));
/*
*
*/
struct req_status_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x20 */
uint8_t unknown;
} __attribute__((packed));
struct req_status_in {
uint8_t header; /* 0xa1 */
uint8_t channel; /* 0x20 */
wiimote_keys_t keys;
struct {
uint8_t reserved : 1;
uint8_t ext : 1;
uint8_t speaker : 1;
uint8_t ir : 1;
uint8_t leds : 4;
} __attribute__((packed));
uint16_t unknown;
uint8_t battery;
} __attribute__((packed));
struct req_speaker_out {
uint8_t header; /* 0x52 */
uint8_t channel; /* 0x18 */
uint8_t unused : 3;
uint8_t size : 5;
uint8_t data[20];
} __attribute__((packed));
/*
*
*/
typedef union {
struct {
uint16_t header : 8;
uint16_t channel : 8;
} __attribute__((packed));
struct req_read_out read;
struct req_write_out write;
struct req_mode_out mode;
struct req_led_out led;
struct req_raw_out raw;
struct req_status_out status;
struct req_speaker_out speaker;
} __attribute__((packed)) wiimote_report_t;
/*
*
*/
int wiimote_report(wiimote_t *wiimote, wiimote_report_t *report, uint8_t size);
#endif /*_WIIMOTE_REPORT_H*/
|