From 6cacc52ebfd9881eead9c5abd7bac3b2ce01007c Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 2 Jul 2010 15:48:42 +0000 Subject: [PATCH] Fix a bug in wiiuse that prevented a wiimote from being disconnected properly in linux. Also fixed a bug in wiiuse_set_leds on all platforms. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5819 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/WiiUseSrc/Src/io_nix.c | 2 +- Externals/WiiUseSrc/Src/wiiuse.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Externals/WiiUseSrc/Src/io_nix.c b/Externals/WiiUseSrc/Src/io_nix.c index 62ac73e046..da167bcdb0 100644 --- a/Externals/WiiUseSrc/Src/io_nix.c +++ b/Externals/WiiUseSrc/Src/io_nix.c @@ -250,7 +250,7 @@ static int wiiuse_connect_single(struct wiimote_t* wm, char* address) { * Note that this will not free the wiimote structure. */ void wiiuse_disconnect(struct wiimote_t* wm) { - if (!wm || WIIMOTE_IS_CONNECTED(wm)) + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) return; close(wm->out_sock); diff --git a/Externals/WiiUseSrc/Src/wiiuse.c b/Externals/WiiUseSrc/Src/wiiuse.c index f3b89e5849..5e56541137 100644 --- a/Externals/WiiUseSrc/Src/wiiuse.c +++ b/Externals/WiiUseSrc/Src/wiiuse.c @@ -237,12 +237,11 @@ void wiiuse_set_leds(struct wiimote_t* wm, int leds) { /* remove the lower 4 bits because they control rumble */ wm->leds = (leds & 0xF0); + buf = wm->leds; /* make sure if the rumble is on that we keep it on */ if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) - wm->leds |= 0x01; - - buf = wm->leds; + buf |= 0x01; wiiuse_send(wm, WM_CMD_LED, &buf, 1); }