Merge remote-tracking branch 'upstream/sync-mplus' into osx-refactor_sync-mplus

Conflicts:
	src/events.c
	src/io.c
	src/io.h
	src/io_mac.m
	src/os_nix.c
	src/wiiuse_internal.h
This commit is contained in:
Lysann Schlegel
2012-12-08 17:59:47 +01:00
14 changed files with 317 additions and 52 deletions

View File

@@ -503,9 +503,16 @@ static void event_status(struct wiimote_t* wm, byte* msg) {
if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_3) led[2] = 1;
if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_4) led[3] = 1;
/* probe for Motion+ */
if(!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT))
wiiuse_probe_motion_plus(wm);
/* is an attachment connected to the expansion port? */
if ((msg[2] & WM_CTRL_STATUS_BYTE1_ATTACHMENT) == WM_CTRL_STATUS_BYTE1_ATTACHMENT)
{
WIIUSE_DEBUG("Attachment detected!");
attachment = 1;
}
/* is the speaker enabled? */
if ((msg[2] & WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED) == WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED)
@@ -561,7 +568,6 @@ static void event_status(struct wiimote_t* wm, byte* msg) {
req->state = REQ_DONE;
/* if(req->cb!=NULL) req->cb(wm,msg,6); */
free(req);
wiiuse_send_next_pending_write_request(wm);
}

202
src/io.c
View File

@@ -33,8 +33,9 @@
#include "io.h"
#include "ir.h" /* for wiiuse_set_ir_mode */
#include "wiiuse_internal.h"
#include "os.h" /* for wiiuse_os_* */
#include "os.h" /* for wiiuse_os_* */
#include <stdlib.h> /* for free, malloc */
@@ -108,25 +109,91 @@ void wiiuse_disconnect(struct wiimote_t* wm) {
wiiuse_os_disconnect(wm);
}
static void wiiuse_disable_motion_plus2(struct wiimote_t *wm,byte *data,unsigned short len)
{
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE);
wiiuse_set_ir_mode(wm);
wm->handshake_state++;
wiiuse_handshake(wm, NULL, 0);
}
static void wiiuse_disable_motion_plus1(struct wiimote_t *wm,byte *data,unsigned short len)
{
byte val = 0x00;
wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus2);
}
/**
* @brief Wait until specified report arrives and return it
*
* @param wm Pointer to a wiimote_t structure.
* @param buffer Pre-allocated memory to store the received data
* @param bufferLength size of buffer in bytes
*
* Synchronous/blocking, this function will not return until it receives the specified
* report from the Wiimote.
*
*/
void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength)
{
for(;;)
{
if(wiiuse_os_read(wm, buffer, bufferLength) > 0) {
if(buffer[1] == report) {
break;
} else {
WIIUSE_WARNING("(id %i) dropping report 0x%x, waiting for 0x%x", wm->unid, buffer[1], report);
}
}
}
}
/**
* @brief Read memory/register data synchronously
*
* @param wm Pointer to a wiimote_t structure.
* @param memory If set to non-zero, reads EEPROM, otherwise registers
* @param addr Address offset to read from
* @param size How many bytes to read
* @param data Pre-allocated memory to store the received data
*
* Synchronous/blocking read, this function will not return until it receives the specified
* amount of data from the Wiimote.
*
*/
void wiiuse_read(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data)
{
byte pkt[8];
byte buf[MAX_PAYLOAD];
unsigned n_full_reports;
unsigned last_report;
byte *output;
int i;
/*
* address in big endian first, the leading byte will
* be overwritten (only 3 bytes are sent)
*/
to_big_endian_uint32_t(pkt + 2, addr);
pkt[0] = 0x52; /* HID read command */
pkt[1] = 0x17; /* report 17 - read */
pkt[2] = (memory != 0) ? 0x00 : 0x04; /* read from registers or memory*/
/*
* length in big endian
*/
to_big_endian_uint16_t(pkt + 6, size);
/* calculate how many 16B packets we have to get back */
n_full_reports = size / 16;
last_report = size % 16;
output = data;
wiiuse_os_write(wm, pkt, 8);
for(i = 0; i < n_full_reports; ++i)
{
wiiuse_wait_report(wm, 0x21, buf, MAX_PAYLOAD);
memmove(output, buf + 7, 16);
output += 16;
}
/* read the last incomplete packet */
if(last_report)
{
wiiuse_wait_report(wm, 0x21, buf, MAX_PAYLOAD);
memmove(output, buf + 7, last_report);
}
}
/**
* @brief Get initialization data from the wiimote.
*
* @param wm Pointer to a wiimote_t structure.
@@ -139,18 +206,95 @@ static void wiiuse_disable_motion_plus1(struct wiimote_t *wm,byte *data,unsigned
* The handshake will be concluded when the wiimote responds
* with this data.
*/
#define SYNC_HANDSHAKE 1
#ifdef SYNC_HANDSHAKE
void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len)
{
/* send request to wiimote for accelerometer calibration */
byte buf[MAX_PAYLOAD];
/* step 0 - Reset wiimote */
{
//wiiuse_set_leds(wm, WIIMOTE_LED_NONE);
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE);
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP);
WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS);
wiiuse_set_report_type(wm);
wiiuse_millisleep(500);
WIIUSE_DEBUG("Wiimote reset!\n");
}
/* step 1 - calibration of accelerometers */
{
struct accel_t* accel = &wm->accel_calib;
wiiuse_read(wm, 1, WM_MEM_OFFSET_CALIBRATION, 8, buf);
/* received read data */
accel->cal_zero.x = buf[0];
accel->cal_zero.y = buf[1];
accel->cal_zero.z = buf[2];
accel->cal_g.x = buf[4] - accel->cal_zero.x;
accel->cal_g.y = buf[5] - accel->cal_zero.y;
accel->cal_g.z = buf[6] - accel->cal_zero.z;
WIIUSE_DEBUG("Calibrated wiimote acc\n");
}
/* step 2 - re-enable IR and ask for status */
{
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE);
/* now enable IR if it was set before the handshake completed */
if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR))
{
WIIUSE_DEBUG("Handshake finished, enabling IR.");
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR);
wiiuse_set_ir(wm, 1);
}
WIIUSE_DEBUG("Asking for status ...\n");
wm->event = WIIUSE_CONNECT;
wiiuse_status(wm);
}
}
#else
static void wiiuse_disable_motion_plus1(struct wiimote_t *wm,byte *data,unsigned short len);
static void wiiuse_disable_motion_plus2(struct wiimote_t *wm,byte *data,unsigned short len);
void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len) {
if (!wm) return;
switch (wm->handshake_state) {
case 0:
{
/* send request to wiimote for accelerometer calibration */
byte* buf;
/* continous reporting off, report to buttons only */
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE);
wiiuse_set_leds(wm, WIIMOTE_LED_NONE);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE);
WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS);
wiiuse_set_report_type(wm);
/* send request to wiimote for accelerometer calibration */
buf = (byte*)malloc(sizeof(byte) * 8);
wiiuse_read_data_cb(wm, wiiuse_handshake, buf, WM_MEM_OFFSET_CALIBRATION, 7);
wm->handshake_state++;
@@ -216,3 +360,21 @@ void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len) {
}
}
}
static void wiiuse_disable_motion_plus1(struct wiimote_t *wm,byte *data,unsigned short len)
{
byte val = 0x00;
wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus2);
}
static void wiiuse_disable_motion_plus2(struct wiimote_t *wm,byte *data,unsigned short len)
{
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE);
wiiuse_set_ir_mode(wm);
wm->handshake_state++;
wiiuse_handshake(wm, NULL, 0);
}
#endif

View File

@@ -43,6 +43,9 @@ extern "C" {
/** @defgroup internal_io Internal: Device I/O */
/** @{ */
void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len);
void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength);
void wiiuse_read(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data);
/** @} */
#ifdef __cplusplus

View File

@@ -30,6 +30,7 @@
#include "motion_plus.h"
#include "io.h" /* for wiiuse_read */
#include "events.h" /* for disable_expansion */
#include "ir.h" /* for wiiuse_set_ir_mode */
#include "nunchuk.h" /* for nunchuk_pressed_buttons */
@@ -42,6 +43,68 @@ static void wiiuse_calibrate_motion_plus(struct motion_plus_t *mp);
static void calculate_gyro_rates(struct motion_plus_t* mp);
void wiiuse_probe_motion_plus(struct wiimote_t *wm)
{
byte buf[MAX_PAYLOAD];
unsigned id;
wiiuse_read(wm, 0, WM_EXP_MOTION_PLUS_IDENT, 6, buf);
/* check error code */
if(buf[4] & 0x0f)
{
WIIUSE_DEBUG("No Motion+ available, stopping probe.");
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT);
return;
}
/* decode the id*/
id = from_big_endian_uint32_t(buf + 2);
if(id != EXP_ID_CODE_INACTIVE_MOTION_PLUS &&
id != EXP_ID_CODE_NLA_MOTION_PLUS &&
id != EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK &&
id != EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC)
{
/* we have read something weird */
WIIUSE_DEBUG("Motion+ ID doesn't match, probably not connected.");
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT);
return;
}
WIIUSE_DEBUG("Detected inactive Motion+!");
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT);
/* init M+ */
buf[0] = 0x55;
wiiuse_write_data(wm, WM_EXP_MOTION_PLUS_INIT, buf, 1);
/* Init whatever is hanging on the pass-through port */
buf[0] = 0x55;
wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, buf, 1);
buf[0] = 0x00;
wiiuse_write_data(wm, WM_EXP_MEM_ENABLE2, buf, 1);
/* Init gyroscope data */
wm->exp.mp.cal_gyro.roll = 0;
wm->exp.mp.cal_gyro.pitch = 0;
wm->exp.mp.cal_gyro.yaw = 0;
wm->exp.mp.orient.roll = 0.0;
wm->exp.mp.orient.pitch = 0.0;
wm->exp.mp.orient.yaw = 0.0;
wm->exp.mp.raw_gyro_threshold = 10;
wm->exp.mp.nc = &(wm->exp.nunchuk);
wm->exp.mp.classic = &(wm->exp.classic);
wm->exp.nunchuk.flags = &wm->flags;
wm->exp.mp.ext = 0;
wiiuse_set_ir_mode(wm);
wiiuse_set_report_type(wm);
}
void wiiuse_motion_plus_handshake(struct wiimote_t *wm,byte *data,unsigned short len)
{
uint32_t val;
@@ -133,7 +196,11 @@ void wiiuse_set_motion_plus(struct wiimote_t *wm, int status)
{
byte val;
if(status && !WIIMOTE_IS_SET(wm,WIIMOTE_STATE_EXP_HANDSHAKE))
if(!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT) ||
WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP_HANDSHAKE))
return;
if(status)
{
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE);
val = (status == 1) ? 0x04 : 0x05;

View File

@@ -49,6 +49,8 @@ void motion_plus_event(struct motion_plus_t* mp, int exp_type, byte* msg);
void wiiuse_motion_plus_handshake(struct wiimote_t *wm, byte *data,unsigned short len);
void wiiuse_probe_motion_plus(struct wiimote_t *wm);
/** @} */
#ifdef __cplusplus

View File

@@ -52,7 +52,7 @@ int wiiuse_os_connect(struct wiimote_t** wm, int wiimotes);
void wiiuse_os_disconnect(struct wiimote_t* wm);
int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes);
int wiiuse_os_read(struct wiimote_t* wm);
int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len);
int wiiuse_os_write(struct wiimote_t* wm, byte* buf, int len);
/** @} */

View File

@@ -67,14 +67,14 @@
- (IOReturn) connect;
- (void) disconnect;
- (int) read;
- (int) readBuffer: (byte*) buffer length: (NSUInteger) bufferLength;
- (int) writeBuffer: (byte*) buffer length: (NSUInteger) length;
@end
@protocol WiiuseReceivedMessage <NSObject>
- (int) applyToStruct: (wiimote*) wm; // <0: not copied, 0: copied empty, >0: copied
- (int) applyToStruct: (wiimote*) wm buffer: (byte*) buffer length: (NSUInteger) bufferLength; // <0: not copied, 0: copied empty, >0: copied
@end
@interface WiiuseReceivedData : NSObject<WiiuseReceivedMessage> {

View File

@@ -152,14 +152,14 @@
#pragma mark read, write
// <0: nothing received, else: length of data received (can be 0 in case of disconnection message)
- (int) checkForAvailableData {
- (int) checkForAvailableDataForBuffer: (byte*) buffer length: (NSUInteger) bufferLength {
int result = -1;
[receivedDataLock lock];
if([receivedData count]) {
// look at first item in queue
NSObject<WiiuseReceivedMessage>* firstMessage = [receivedData objectAtIndex:0];
result = [firstMessage applyToStruct:wm];
result = [firstMessage applyToStruct:wm buffer: buffer length: bufferLength];
if(result >= 0)
[receivedData removeObjectAtIndex:0];
}
@@ -195,15 +195,15 @@
}
// result = length of data copied to event buffer
- (int) read {
- (int) readBuffer:(byte *)buffer length:(NSUInteger)bufferLength {
// is there already some data to read?
int result = [self checkForAvailableData];
int result = [self checkForAvailableDataForBuffer: buffer length: bufferLength];
if(result < 0) {
// wait a short amount of time, until data becomes available or a timeoutis reached
// wait a short amount of time, until data becomes available or a timeout is reached
[self waitForIncomingData:1];
// check again
result = [self checkForAvailableData];
result = [self checkForAvailableDataForBuffer: buffer length: bufferLength];
}
return result >= 0 ? result : 0;
@@ -305,12 +305,12 @@
[super dealloc];
}
- (int) applyToStruct:(wiimote *)wm {
- (int) applyToStruct:(wiimote *)wm buffer:(byte *)buffer length:(NSUInteger)bufferLength {
byte* bytes = (byte*) [data bytes];
NSUInteger length = [data length];
if(length > sizeof(wm->event_buf)) {
if(length > bufferLength) {
WIIUSE_WARNING("Received data was longer than event buffer. Dropping excess bytes.");
length = sizeof(wm->event_buf);
length = bufferLength;
}
// log the received data
@@ -325,7 +325,7 @@
#endif
// copy to struct
memcpy(wm->event_buf, bytes, length);
memcpy(buffer, bytes, length);
return length;
}
@@ -334,7 +334,7 @@
@implementation WiiuseDisconnectionMessage
- (int) applyToStruct:(wiimote *)wm {
- (int) applyToStruct:(wiimote *)wm buffer:(byte *)buffer length:(NSUInteger)bufferLength {
wiiuse_disconnected(wm);
return 0;
}

View File

@@ -146,13 +146,15 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
for (i = 0; i < wiimotes; ++i) {
wm[i]->event = WIIUSE_NONE;
if (wiiuse_os_read(wm[i])) {
if (wiiuse_os_read(wm[i], wm[i]->event_buf, sizeof(wm[i]->event_buf))) {
/* propagate the event, messages should be read as in linux, starting from the second element */
propagate_event(wm[i], wm[i]->event_buf[1], wm[i]->event_buf+2);
/* clear out the event buffer */
memset(wm[i]->event_buf, 0, sizeof(wm[i]->event_buf));
} else {
/* send out any waiting writes */
wiiuse_send_next_pending_write_request(wm[i]);
idle_cycle(wm[i]);
}
@@ -162,7 +164,7 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
return evnt;
}
int wiiuse_os_read(struct wiimote_t* wm) {
int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len) {
if(!wm || !wm->objc_wm) return 0;
if(!WIIMOTE_IS_CONNECTED(wm)) {
WIIUSE_ERROR("Attempting to read from unconnected Wiimote");
@@ -172,7 +174,7 @@ int wiiuse_os_read(struct wiimote_t* wm) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
WiiuseWiimote* objc_wm = (WiiuseWiimote*) wm->objc_wm;
int result = [objc_wm read];
int result = [objc_wm readBuffer: buf length: len];
[pool drain];
return result;

View File

@@ -312,6 +312,8 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
propagate_event(wm[i], wm[i]->event_buf[1], wm[i]->event_buf+2);
evnt += (wm[i]->event != WIIUSE_NONE);
} else {
/* send out any waiting writes */
wiiuse_send_next_pending_write_request(wm[i]);
idle_cycle(wm[i]);
}
}
@@ -319,14 +321,25 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
return evnt;
}
int wiiuse_os_read(struct wiimote_t* wm) {
/* not used */
return 0;
int wiiuse_io_read(struct wiimote_t* wm, byte* buf, int len) {
int rc;
rc = read(wm->in_sock, buf, len);
if(rc <= 0)
wiiuse_disconnected(wm);
return rc;
}
int wiiuse_io_write(struct wiimote_t* wm, byte* buf, int len) {
int rc;
rc = write(wm->out_sock, buf, len);
int wiiuse_os_write(struct wiimote_t* wm, byte* buf, int len) {
return write(wm->out_sock, buf, len);
if(rc < 0)
wiiuse_disconnected(wm);
return rc;
}
void wiiuse_init_platform_fields(struct wiimote_t* wm) {

View File

@@ -188,7 +188,7 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
for (i = 0; i < wiimotes; ++i) {
wm[i]->event = WIIUSE_NONE;
if (wiiuse_os_read(wm[i])) {
if (wiiuse_os_read(wm[i], wm[i]->event_buf, sizeof(wm[i]->event_buf))) {
/* propagate the event */
propagate_event(wm[i], wm[i]->event_buf[0], wm[i]->event_buf+1);
evnt += (wm[i]->event != WIIUSE_NONE);
@@ -196,6 +196,8 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
/* clear out the event buffer */
memset(wm[i]->event_buf, 0, sizeof(wm[i]->event_buf));
} else {
/* send out any waiting writes */
wiiuse_send_next_pending_write_request(wm[i]);
idle_cycle(wm[i]);
}
}
@@ -203,13 +205,13 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
return evnt;
}
int wiiuse_os_read(struct wiimote_t* wm) {
int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len) {
DWORD b, r;
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
return 0;
if (!ReadFile(wm->dev_handle, wm->event_buf, sizeof(wm->event_buf), &b, &wm->hid_overlap)) {
if (!ReadFile(wm->dev_handle, buf, len, &b, &wm->hid_overlap)) {
/* partial read */
b = GetLastError();

View File

@@ -621,7 +621,7 @@ void wiiuse_send_next_pending_write_request(struct wiimote_t* wm) {
* This function should replace any write()s directly to the wiimote device.
*/
int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) {
byte buf[32]; /* no payload is better than this */
byte buf[MAX_PAYLOAD]; /* no payload is better than this */
int rumble = 0;
#ifdef WIIUSE_WIN32

View File

@@ -135,9 +135,10 @@
#define WIIMOTE_STATE_IR_SENS_LVL3 0x0800
#define WIIMOTE_STATE_IR_SENS_LVL4 0x1000
#define WIIMOTE_STATE_IR_SENS_LVL5 0x2000
#define WIIMOTE_STATE_EXP_HANDSHAKE 0x10000 /* actual M+ connection exists but no handshake yet */
#define WIIMOTE_STATE_EXP_EXTERN 0x20000 /* actual M+ connection exists but handshake failed */
#define WIIMOTE_STATE_EXP_FAILED 0x40000 /* actual M+ connection exists but handshake failed */
#define WIIMOTE_STATE_EXP_HANDSHAKE 0x10000 /* actual M+ connection exists but no handshake yet */
#define WIIMOTE_STATE_EXP_EXTERN 0x20000 /* actual M+ connection exists but handshake failed */
#define WIIMOTE_STATE_EXP_FAILED 0x40000 /* actual M+ connection exists but handshake failed */
#define WIIMOTE_STATE_MPLUS_PRESENT 0x80000 /* Motion+ is connected */
#define WIIMOTE_ID(wm) (wm->unid)

View File

@@ -173,6 +173,7 @@
#define WM_EXP_MEM_ENABLE1 0x04A400F0
#define WM_EXP_MEM_ENABLE2 0x04A400FB
#define WM_EXP_MEM_CALIBR 0x04A40020
#define WM_EXP_MOTION_PLUS_IDENT 0x04A600FA
#define WM_EXP_MOTION_PLUS_ENABLE 0x04A600FE
#define WM_EXP_MOTION_PLUS_INIT 0x04A600F0
#define WM_REG_IR 0x04B00030
@@ -210,10 +211,16 @@
#define EXP_ID_CODE_WII_BOARD 0xA4200402
#define EXP_ID_CODE_CLASSIC_CONTROLLER 0xA4200101
#define EXP_ID_CODE_GUITAR 0xA4200103
#define EXP_ID_CODE_MOTION_PLUS 0xa4200405
#define EXP_ID_CODE_MOTION_PLUS 0xA4200405
#define EXP_ID_CODE_MOTION_PLUS_NUNCHUK 0xA4200505 /** Motion Plus ID in Nunchuck passthrough mode */
#define EXP_ID_CODE_MOTION_PLUS_CLASSIC 0xA4200705 /** Motion Plus ID in Classic control. passthrough */
/* decrypted M+ codes at 0x04A600FA */
#define EXP_ID_CODE_INACTIVE_MOTION_PLUS 0xA6200005 /** Inactive Motion Plus ID */
#define EXP_ID_CODE_NLA_MOTION_PLUS 0xA6200405 /** No longer active Motion Plus ID */
#define EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK 0xA6200505 /** No longer active Motion Plus ID in Nunchuck passthrough mode */
#define EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC 0xA6200705 /** No longer active Motion Plus ID in Classic control. passthrough */
#define EXP_HANDSHAKE_LEN 224
/********************