Update Wiiuse to 0.15.6
STK-specific patches are kept, CI related changes are not included
This commit is contained in:
parent
97faf4a492
commit
48764a6202
@ -14,6 +14,16 @@ Original project (0.12 and earlier):
|
||||
most recent archive from 2010 (looks identical on homepage to 2011 snapshot above)
|
||||
<https://web.archive.org/web/20100216015311/http://wiiuse.sourceforge.net/>
|
||||
|
||||
v0.15.6 -- 18-Feb-2024
|
||||
--------------------
|
||||
|
||||
Fixed:
|
||||
|
||||
- Linux - Fixed hang with kernels 6.6.x and newer
|
||||
- Corrected historical record about Wiiuse origins
|
||||
- Require CMake > 3.6.x to avoid deprecation warnings
|
||||
- Support for Balance Board calibration
|
||||
|
||||
v0.15.5 -- 24-Nov-2019
|
||||
--------------------
|
||||
|
||||
|
@ -68,6 +68,12 @@ Additional Contributors:
|
||||
- Chadwick Boulay <https://github.com/cboulay>
|
||||
- Florian Baumgartl <https://github.com/Baumgartl>
|
||||
- Philipp Hartl <https://github.com/phHartl>
|
||||
Bryan Quigley <https://github.com/BryanQuigley>
|
||||
Bart Ribbers <https://github.com/PureTryOut>
|
||||
Samuel Hackbeil <https://github.com/shackbei>
|
||||
Jean-Michaël Celerier <https://github.com/jcelerier>
|
||||
Dave Murphy <https://github.com/WinterMute>
|
||||
Forrest Cahoon <https://github.com/forrcaho>
|
||||
|
||||
## License
|
||||
|
||||
@ -253,10 +259,10 @@ greatly appreciated.
|
||||
|
||||
### Forks not yet fully integrated
|
||||
|
||||
- [libogc/WPAD/DevKitPro](http://wiibrew.org/wiki/Libogc)
|
||||
- Started before the disappearance of the original upstream
|
||||
- [libogc/wiiuse](https://github.com/devkitPro/libogc/tree/master/wiiuse)
|
||||
- wii port created by Shagkur and contributed upstream
|
||||
- Focused on Wiimote use with Wii hardware
|
||||
- Functions renamed, copyright statements removed
|
||||
- code unfortunately diverged
|
||||
- Additional functionality unknown?
|
||||
- git-svn mirror found here: <https://github.com/xloem/libogc-wiiuse>
|
||||
- [fwiine](http://sourceforge.net/projects/fwiine/files/wiiuse/0.13/)
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
#define WIIUSE_MAJOR 0
|
||||
#define WIIUSE_MINOR 15
|
||||
#define WIIUSE_MICRO 5
|
||||
#define WIIUSE_MICRO 6
|
||||
|
||||
#define WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) (MAJ * 1000000 + MIN * 1000 + MICRO)
|
||||
#define WIIUSE_HAS_VERSION(MAJ, MIN, MICRO) \
|
||||
@ -953,7 +953,6 @@ WIIUSE_EXPORT extern void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t *
|
||||
WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t *wm, int threshold);
|
||||
|
||||
/* wiiboard.c */
|
||||
/* this function not currently implemented... */
|
||||
WIIUSE_EXPORT extern void wiiuse_set_wii_board_calib(struct wiimote_t *wm);
|
||||
|
||||
WIIUSE_EXPORT extern void wiiuse_set_motion_plus(struct wiimote_t *wm, int status);
|
||||
|
@ -150,8 +150,10 @@ int wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int buffe
|
||||
if (elapsed > timeout_ms && timeout_ms > 0)
|
||||
{
|
||||
result = -1;
|
||||
WIIUSE_DEBUG("(id %i) timeout waiting for report 0x%x, aborting!", wm->unid, report);
|
||||
break;
|
||||
}
|
||||
wiiuse_millisleep(10);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -328,7 +330,7 @@ void wiiuse_handshake(struct wiimote_t *wm, byte *data, uint16_t len)
|
||||
wiiuse_status(wm);
|
||||
rc = wiiuse_wait_report(wm, WM_RPT_CTRL_STATUS, buf, MAX_PAYLOAD, WIIUSE_READ_TIMEOUT);
|
||||
|
||||
if (buf[3] != 0)
|
||||
if (rc && buf[3] != 0)
|
||||
break;
|
||||
|
||||
wiiuse_millisleep(500);
|
||||
|
@ -374,21 +374,32 @@ int wiiuse_os_read(struct wiimote_t *wm, byte *buf, int len)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = read(wm->in_sock, buf, len);
|
||||
rc = recv(wm->in_sock, buf, len, MSG_DONTWAIT);
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
/* error reading data */
|
||||
WIIUSE_ERROR("Receiving wiimote data (id %i).", wm->unid);
|
||||
perror("Error Details");
|
||||
|
||||
if (errno == ENOTCONN)
|
||||
switch(errno)
|
||||
{
|
||||
case ENOTCONN:
|
||||
/* this can happen if the bluetooth dongle is disconnected */
|
||||
WIIUSE_ERROR("Receiving wiimote data (id %i).", wm->unid);
|
||||
perror("Error Details");
|
||||
|
||||
WIIUSE_ERROR("Bluetooth appears to be disconnected. Wiimote unid %i will be disconnected.",
|
||||
wm->unid);
|
||||
wiiuse_os_disconnect(wm);
|
||||
wiiuse_disconnected(wm);
|
||||
break;
|
||||
|
||||
case EAGAIN:
|
||||
/* no data available yet */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* error reading data */
|
||||
WIIUSE_ERROR("Receiving wiimote data (id %i).", wm->unid);
|
||||
perror("Error Details");
|
||||
break;
|
||||
}
|
||||
} else if (rc == 0)
|
||||
{
|
||||
@ -406,7 +417,7 @@ int wiiuse_os_read(struct wiimote_t *wm, byte *buf, int len)
|
||||
{ /* hack for chatty Balance Boards that flood the logs with useless button reports */
|
||||
int i;
|
||||
printf("[DEBUG] (id %i) RECV: (%.2x) ", wm->unid, buf[0]);
|
||||
for (i = 1; i < rc; i++)
|
||||
for (i = 1; i < rc - 1; i++)
|
||||
{
|
||||
printf("%.2x ", buf[i]);
|
||||
}
|
||||
@ -427,7 +438,7 @@ int wiiuse_os_write(struct wiimote_t *wm, byte report_type, byte *buf, int len)
|
||||
write_buffer[1] = report_type;
|
||||
memcpy(write_buffer + 2, buf, len);
|
||||
|
||||
rc = write(wm->in_sock, write_buffer, len + 2);
|
||||
rc = send(wm->in_sock, write_buffer, len + 2, 0);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -161,6 +161,45 @@ void wii_board_event(struct wii_board_t *wb, byte *msg)
|
||||
}
|
||||
|
||||
/**
|
||||
@todo not implemented!
|
||||
* @brief Calib wii board
|
||||
*
|
||||
* @param wm Pointer to a wiimote_t struct the calib values are used.
|
||||
*/
|
||||
void wiiuse_set_wii_board_calib(struct wiimote_t *wm) {}
|
||||
void wiiuse_set_wii_board_calib(struct wiimote_t *wm)
|
||||
{
|
||||
byte pkt[21];
|
||||
uint16_t test = 1;
|
||||
memset(pkt, 0, sizeof(pkt));
|
||||
|
||||
/*
|
||||
* address in big endian first, the leading byte will
|
||||
* be overwritten (only 3 bytes are sent)
|
||||
*/
|
||||
to_big_endian_uint32_t(pkt, WM_EXP_MEM_CALIBR + 4);
|
||||
|
||||
pkt[0] = 0x04; //write register
|
||||
pkt[4] = 0x0f; //size of data
|
||||
|
||||
to_big_endian_uint16_t(&pkt[5], wm->exp.wb.ctr[0]);
|
||||
to_big_endian_uint16_t(&pkt[7], wm->exp.wb.cbr[0]);
|
||||
to_big_endian_uint16_t(&pkt[9], wm->exp.wb.ctl[0]);
|
||||
to_big_endian_uint16_t(&pkt[11], wm->exp.wb.cbl[0]);
|
||||
to_big_endian_uint16_t(&pkt[13], wm->exp.wb.ctr[1]);
|
||||
to_big_endian_uint16_t(&pkt[15], wm->exp.wb.cbr[1]);
|
||||
to_big_endian_uint16_t(&pkt[17], wm->exp.wb.ctl[1]);
|
||||
to_big_endian_uint16_t(&pkt[19], wm->exp.wb.cbl[1]);
|
||||
if (wiiuse_send(wm, WM_CMD_WRITE_DATA, pkt, sizeof(pkt)) < 0)
|
||||
return;
|
||||
wiiuse_millisleep(100);
|
||||
|
||||
to_big_endian_uint32_t(pkt, WM_EXP_MEM_CALIBR + 20);
|
||||
pkt[0] = 0x04; //write register
|
||||
pkt[4] = 0x08; //size of data
|
||||
|
||||
to_big_endian_uint16_t(&pkt[5], wm->exp.wb.ctr[2]);
|
||||
to_big_endian_uint16_t(&pkt[7], wm->exp.wb.cbr[2]);
|
||||
to_big_endian_uint16_t(&pkt[9], wm->exp.wb.ctl[2]);
|
||||
to_big_endian_uint16_t(&pkt[11], wm->exp.wb.cbl[2]);
|
||||
wiiuse_send(wm, WM_CMD_WRITE_DATA, pkt, sizeof(pkt));
|
||||
wiiuse_millisleep(100);
|
||||
}
|
Loading…
Reference in New Issue
Block a user