Coder Social home page Coder Social logo

wiiuse's Introduction

WiiUse README

Semi-Official Fork, located at http://github.com/wiiuse/wiiuse

Issue/bug tracker: https://github.com/wiiuse/wiiuse/issues

Mailing list: [email protected] - just email to subscribe. See http://librelist.com/browser/wiiuse/ for archives and http://librelist.com/ for more information.

Changelog: https://github.com/wiiuse/wiiuse/blob/master/CHANGELOG.mkd

CI

NOTE: This library sees little change not because it is dead, but because it is effectively "complete". That being said, if you think there are changes that it could use, and are willing to step up to assist with maintenance, please file an issue.

About

Wiiuse is a library written in C that connects with several Nintendo Wii remotes. Supports motion sensing, IR tracking, nunchuk, classic controller, Balance Board, and the Guitar Hero 3 controller. Single threaded and nonblocking makes a light weight and clean API.

Distributed under the GPL 3+.

This is a friendly fork, prompted by apparent non-maintained status of upstream project but proliferation of ad-hoc forks without project infrastructure. Balance board support has been merged from TU-Delft cross-referenced with other similar implementations in embedded forks of WiiUse in other applications. Additional community contributions have since been merged. Hopefully GitHub will help the community maintain this project more seamlessly now.

Patches and improvements are greatly appreciated - the easiest way to submit them is to fork the repository on GitHub and make the changes, then submit a pull request. The "fork and edit this file" button on the web interface should make this even simpler.

Authors

Mostly-absentee (but delegating!) Fork Maintainer: Rylie Pavlik https://github.com/rpavlik [email protected]

Original Author: Michael Laforest < para > < thepara (--AT--) g m a i l [--DOT--] com >

Additional Contributors:

License

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 3 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, see http://www.gnu.org/licenses/.

Audience

This project is intended for developers who wish to include support for the Nintendo Wii remote with their third party application.

Supported Hardware

Official Nintendo controllers:

  • Wiimotes:

    • Gen 1.0 - Original Wiimote without Motion Plus (Bluetooth name: RVL-CNT-01)
    • Gen 1.5 - Same as gen 1 but has integrated Motion Plus (Bluetooth name: RVL-CNT-01)
    • Gen 2.0 - New Wiimote (since about 2011), has integrated Motion Plus and different firmware (Bluetooth name: RVL-CNT-01-TR)
  • Wii Balance Board (Bluetooth name: RVL-WBC-01)

  • Expansions:

    • Nunchuk
    • Classic controller
    • Guitar controller
    • Motion Plus dongle (for the gen 1 Wiimote)

Clones and 3rdparty devices

3rdparty controllers (wiimotes, nunchuks etc.) may or may not work - some manufacturers take major liberties with the protocols so it is impossible to guarantee functionality. However, most will probably just work.

Platforms and Dependencies

Wiiuse currently operates on Linux, Windows and Mac. You will need:

For Linux

  • The kernel must support Bluetooth
  • The BlueZ Bluetooth drivers must be installed
  • If compiling, you'll need the BlueZ dev files (Debian/Ubuntu package libbluetooth-dev)

For Windows

  • Bluetooth driver (tested with Microsoft's stack with Windows XP SP2 thru Windows 10)

For Mac

  • Mac OS X 10.2 or newer (to have the Mac OS X Bluetooth protocol stack)

For all platforms

  • If compiling, CMake is needed to generate a makefile/project

Compiling

You need SDL and OpenGL installed to compile the (optional) SDL example.

Linux & Mac

mkdir build
cd build
cmake .. [-DCMAKE_INSTALL_PREFIX=/usr/local] [-DCMAKE_BUILD_TYPE=Release] [-DBUILD_EXAMPLE_SDL=NO]

OR

cmake-gui ..
make [target]

If target is omitted then everything is compiled.

Where target can be any of the following:

  • wiiuse - Compiles libwiiuse.so
  • wiiuseexample - Compiles wiiuse-example
  • wiiuseexample-sdl - Compiles wiiuse-sdl
  • doc - Generates doxygen-based API documentation in HTML and PDF format in docs-generated

For a system-wide install, become root (or run with sudo) and:

make install
  • libwiiuse.so is installed to CMAKE_INSTALL_PREFIX/lib
  • wiiuse-example and wiiuse-sdl are installed to CMAKE_INSTALL_PREFIX/bin

Windows

The CMake GUI can be used to generate a Visual Studio solution.

You may need to install the Windows SDK (in recent versions) or DDK (driver development kit - for old Windows SDK only) to compile wiiuse.

With Visual Studio Community 2017, this is very easy to build now: if you have chosen to install the "desktop C++" tools, you'll automatically have what you need.

Using the Library

To use the library in your own program you must first compile wiiuse as a module. Include include/wiiuse.h in any file that uses wiiuse.

For Linux you must link libwiiuse.so ( -lwiiuse ). For Windows you must link wiiuse.lib. When your program runs it will need wiiuse.dll.

Known Issues

On Windows using more than one wiimote (usually more than two wiimotes) may cause significant latency.

If you are going to use Motion+, make sure to call wiiuse_poll or wiiuse_update in a loop for some 10-15 seconds before enabling it. Ideally you should be checking the status of any expansion (nunchuk) you may have connected as well. Otherwise the extra expansion may not initialize correctly - the initialization and calibration takes some time.

Mac OS X

Wiiuse can only connect to a device if it is in discoverable mode. Enable discoverable mode by pressing the button on the inside of the battery cover.

Wiiuse may not be able to connect to the device if it has been paired to the operating system. Unpair it by opening Bluetooth Preferences (Apple > System Preferences > Bluetooth), selecting the device (e.g., "Nintendo RVL-CNT-01"), and pressing the X next to the device (alternatively: right-click and select "Remove"). It is not enough to simply disconnect it.

Enable discoverable mode and try again.

Acknowledgements by Michael Laforest (Original Author)

http://wiibrew.org/

This site and their users have contributed an immense amount of information about the wiimote and its technical details. I could not have written this program without the vast amounts of reverse engineered information that was researched by them.

Nintendo

Of course Nintendo for designing and manufacturing the Wii and Wii remote.

BlueZ

Easy and intuitive Bluetooth stack for Linux.

Thanks to Brent for letting me borrow his Guitar Hero 3 controller.

Known Forks/Derivative Versions

The last "old upstream" version of WiiUse was 0.12. A number of projects forked or embedded that version or earlier, making their own improvements. A (probably incomplete) list follows, split between those whose improvements are completed integrated into this new mainline version, and those whose improvements have not yet been ported/merged into this version. An eventual goal is to integrate all appropriate improvements (under the GPL 3+) back into this mainline community-maintained "master fork" - contributions are greatly appreciated.

Forks that have been fully integrated

Forks not yet fully integrated

Other Links

Original project (0.12 and earlier):

wiiuse's People

Contributors

baumgartl avatar bryanquigley avatar casallas avatar cboulay avatar eidorb avatar forrcaho avatar freso avatar fta2012 avatar godbyk avatar janoc avatar jzarl avatar lysannschlegel avatar madmaxoft avatar phhartl avatar rpavlik avatar shackbei avatar thomasgeissl avatar wintermute avatar xloem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wiiuse's Issues

Nunchuk never detected

I despair to get a nunchuk detection (wiiuseexample).

OS: Fedora 16 + kernel RT 3.0 ; x86_64

Debug mode (uncomment #define WITH_WII_DEBUG):
no change when plug/unplug the nunchuk...

Devices: non original Wiimote "Motion+" + Nunchuk ; RVL-CNT-01 / RVL-003

Hope you will have an idea!

Pitch and Roll change together

Hi, when I connect the wiimote, and pitch, the value is changing, but near to -70 is the roll is also changing. What I'm missing?

Wrong battery level

I have a problem with the battery level. Indeed, when I used battery level, that returned me something close to 1.4*10^-45.
I tried again with batteries wich are new and I had the same result.
I primary thought it was a problem of conversion (I would like to set the battery level in a QProgressBar) but I tried other things and I always get this number.
Do you have any idea of the origin of the problem ?

PS : Sorry for my English level, I'm still really bad even if I'm learnig it since 8 years.

Connecting wii devices in windows 8.1

Hi, I'm making a plugin for Unreal Engine 4 (Therefore would like to compile visual studio 2013 windows 8.1 x86/x64 static libarys)

I've done this and they seem to mostly work (see https://github.com/rpavlik/wiiuse/issues/42)

However I had to add a insane/brittle bit of code to the win_os connect for loop:

I'll clean the following up later when im at my machine but basically..

In the windows os connect code, the connect fails to read a wii device unless I have a printf statement at some point during the for loop that checks through each bluetooth device during connection. I have the printf inside the first few lines of the

If (nintendo device is found) branch of that loop.

I thought this might be some kind of timing issue with the windows 8.1 bluetooth stack but when replacing the printf statement with various pauses/sleeps it didn't change anything.

It works (but I don't know why).. My guess is its either a timing issue AND/OR something to do with printf flushing a buffer

I'll tidy this up and provide sample code later on today

Nunchuk handshake in pass-throgh mode

Hi. I am trying to write a win32 console to use the wiimote as a controller for FPS. I have done something like that in GlovePIE, but this program seems very unrelieable, so I decided myself to write it in C (I am not an expert, as you can imagine). To do this I have been looking for a library that gives me support por IR, motionplus and nunchuk.

Wiiuse seemed to have all this, but the nunchuk in pass-though mode only gives me the joystick data (and not calibrated), it doesn't give me the acc data netiher the C and Z buttons. When I try a wiimote withput WM+ everythong is perfect with the nunchuk data.

I guess the nunchuk in pass-through mode is missing its own initialization-handshake; I mean, this is done when the wiimote is a normal one, but not when there is a WM+ present, because in this case only the handshake of the WM+ is done, but nothing about the nunchuk.

Thank you very much.

Support for Mayflash DolphinBar (braindump + RFC)

The DolphinBar is an interesting device. For $20 you can get a "sensor bar" (http://www.mayflash.com/Products/NINTENDOWiiGC/W010.html) that eliminates essentially all difficulties in using Wiimotes on a PC, including the latest -TR ones.

It works as a sensor bar (i.e. provides the tracking IR LEDs) but also acts as a translator between the Nintendo version of the HID over Bluetooth and normal USB HID. This makes pairing Wiimotes effortless (they pair to the bar), the PC support is also very simple, because the device acts as 4 HID controllers (gamepads). There are no drivers to install. Especially for Windows users this makes the Wiimote usable without having to battle different Bluetooth stacks, deal with incompatible Bluetooth dongles, add/remove device drivers or deal with external utilities that break randomly.

The bar has 4 modes, three focus on emulating mouse+keyboard or a gamepad, the mode 4 acts as a pass-through for the connected Wiimotes, re-sending the received Bluetooth HID messages as normal USB HID.

The bar works with Wiiuse out of the box in Windows in mode 4, however it doesn't with Linux & (most likely) Mac. The reason is that the Windows code actually enumerates HID devices and thus will detect the 4 emulated HID devices from the bar as well. Linux & Mac code attempt to use Bluetooth directly and are launching discovery - this will obviously fail, because the Wiimote is connected to the bar already.

If we want to support this device in Wiiuse, we need to look at how to integrate the platform-specific parts of HID better. E.g. Mac apparently allows to pair and connect a Wiimote similarly as Windows does (#65) and there is also similar support in recent Linux kernels. Linux actually does not only detects and pair the Wiimote itself but it also exposes the individual pieces of hw as separate HID devices - IR, accelerometer, Motion+, buttons, including external expansions like a Nunchuck (tested with kernel 4.1.12).

Implementation-wise we have several options:

  1. Either we switch to the HID support, similar to how the Windows code works, breaking compatibility with older code,
  2. Either we implement the HID support as a separate "mode", allowing the client code to talk to the Wiimote either over Bluetooth directly or to go through HID.
  3. We decide that it is time for Wiiuse 2.0, implement the API in a new, reengineered library (see also #45) and keep the existing API as "legacy", frozen version.

The HID support could probably be handled by HIDAPI, saving us a lot of work dealing with platform-specific code.

CMAKE error on Windows 10

Im getting an error where CMAKE is not finding the WINHID libraries

CMake Error at E:/Applications/cMake3.3/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find WinHID (missing: WINHID_LIBRARY WINHID_INCLUDE_DIR) Call Stack (most recent call first): E:/Applications/cMake3.3/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) cmake/FindWinHID.cmake:123 (find_package_handle_standard_args) CMakeLists.txt:53 (find_package)

I've installed the driver development kit but cannot find the correct lib's (libhid.lib, hidsdi.h, inc/crt/stdio.h). Im new to windows so im not sure if I've done something incorrect or if the W10 WDK uses different names for these files. Any help is greatly appreciated.

Regression in reconnection

Following report is an email communication from @jzarl - attachment at https://gist.github.com/0da060e5936046066c87


On upgrading our version of wiiuse I encountered a strange bug:
The first connection (when running a vrpn server) to the Wiimote
works fine. However, if I turn off the wiimote and then turn it
back on, it does not get reconnected anymore.

I narrowed the bug down a little bit:
The behaviour first shows up in revision 1a9293a
(That revision doesn't compile on its own, but you can apply the
attached "patch_endian.diff" from a later revision to make it work)

By reducing the changeset in rev 1a9293a,
I could further narrow down the problem to the following patch:
(to be applied to rev 1572f38)

diff --git a/src/wiiuse.h b/src/wiiuse.h
index 2a7d500..598a437 100644
--- a/src/wiiuse.h
+++ b/src/wiiuse.h
@@ -589,6 +589,11 @@ typedef struct wiimote_state_t {
       struct vec3b_t exp_accel;
       float exp_r_shoulder;
       float exp_l_shoulder;
+
+       /* motion plus */
+       short drx;
+       short dry;
+       short drz;

       /* wiiboard */
       uint16_t exp_wb_rtr;

I must say I'm a little lost here. I understand that the only wiimote_state_t
is the lstate member of the wiimote_t structure. lstate is only ever touched by
save_state() and state_changed() in events.c.

I have no idea how introducing a simple member to this structure would introduce
the bug mentioned above.

Do you have any idea on what causes this behaviour and how to solve the bug?

Accelerometer Pitch Giving Incorrect Values

I am unsure if this is intentional or not but in the current (master) version, the pitch from the accelerometer gives values between -90 and 90, and then wraps around instead of between the -180 and 180 as it is supposed to. I identified the problem (in dynamics.c), and changed it from
float pitch = RAD_TO_DEGREE(atan2f(y, sqrtf(x*x + z*z))); to float pitch = RAD_TO_DEGREE(atan2f(y, z));, which works as expected, I am just reporting this as an issue I had, it is fixed for me now, but I am unsure whether this change should be incorporated into the master version or not (cannot see any possible reason for current version). Also could not figure out how to get motion plus orientation to work properly (though not sure I need it for what I'm trying to do).

0.15.0 Tag

I think we've arrived to a point where we should create a new version and a corresponding Tag. The previous numbered one, 0.14.0 is kind of old (May 2011), and there have been lots of changes since then. If we are planning to do new major changes on function signatures, etc, a Tag would be appropriate to save this current, stable version.

Question about unique ID

Is there a way to get a unique ID per device connected, like a serial number? Something that is the same every time I execute an application that links to the wiimotes? Also needs to be cross-platform.

Unable to stop bluetooth device inquiry - OSX El Capitan

Hello everybody,

I'm not able to connect my WiiMote Controller on OSX

Environment:

  • OSX 10.11.5 (15F34) - MacBook Pro Retina (El Capitan!)
  • Newest commit of vrpn from https://github.com/vrpn/vrpn
  • Newest release of wiiuse v0.14.2

Installation:

  • Wiiuse (ccmake -> make -> make install)
  • Vrpn (ccmake (Enable Wiiuse and set plattform) -> make)
  • Remove # from WiiMote0 in vrpn.cfg

Start:

  • Enable Bluetooth
  • Starting the vrpn_server (./vrpn_server)

Output:
XXX-MacBook-Pro:server_src XXX$ ./vrpn_server -v
Reading from config file vrpn.cfg
Opening vrpn_WiiMote: WiiMote0
wiiuse v0.14.2 loaded.
Fork at http://github.com/rpavlik/wiiuse
Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[ERROR] Unable to stop bluetooth device inquiry.

Other attempts without success:

  • Disabled Bluetooth
  • Connected WiiController to OSX manually through Bluetooth Manager
  • Deleted WiiController manually through Bluetooth Manager

Does anybody has yet a solution for this problem?

Thanks a lot!

Flo

Add build options to compile as C99, C++, C++11

As code-quality measures, build options should be added to compile as C++, as well as C99 and C++11 (where possible - CMake module to detect), since I think it's reasonable to shoot for the same "clean C" subset as Lua does:

Lua is implemented as a library, written in clean C, the common subset of Standard C and C++. (source: http://www.lua.org/manual/5.2/manual.html)

All should result in the same API and ABI (I believe) since we've got extern "C" { } around the headers.

On Windows, motion+ and extensions don't work the second time a WiiUse app is run.

In Win7, I pair the wiimote with motion+, with no pairing code. It stays blinking until I run a WiiUse app. The first wiiuse app can successfully turn on and off the motion+, passthrough extensions and extensions without m+ work fine.

If I close the app, then while the wiimote is still displaying the same LED state (indicating "connected"), start it or another app again, that app will not be able to activate Motion+ or recognize any extensions, whether or not they go through the M+ itself.

Workaround is to power off the Wiimote, remove the device from bluetooth devices, and re-pair.

Destination for install

On OpenSuSE x86_64 the libraries should go in /usr/lib64 or /usr/local/lib64 but I do not see an option for that. Have I missed something, or do I need to move it by hand after it has been placed in /usr/local/lin ?

Weird behavior with "unlocked" motion+

Visual Studio 2010 - This is using the code from #30. I accidentally apparently had the "lock" switch unlocked on the Motion+ for this whole time. I get this startup log, and cannot turn on motion+:

wiiuse v0.14.0 loaded.
  Fork at http://github.com/rpavlik/wiiuse
  Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[DEBUG] wiiuse.c:347: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30
[DEBUG] wiiuse.c:347: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30
[DEBUG] io.c:224: Wiimote reset!

[DEBUG] (id 1) SEND: (17) 00 00 00 16 00 08
[WARNING] (id 1) dropping report 0x22, waiting for 0x21
[WARNING] (id 1) dropping report 0x30, waiting for 0x21
[DEBUG] (id 1) RECV: (21) 00 00 70 00 16 7f 80 7f 10 98 99 99 32 00 00 00 00 00
00 00 00
[DEBUG] io.c:242: Calibrated wiimote acc

[DEBUG] io.c:257: Asking for status ...

[DEBUG] wiiuse.c:496: Requested wiimote status.
[DEBUG] (id 1) SEND: (15) 00
[INFO] Connected to wiimote [id 1].
Connected to 1 wiimotes (of 1 found).
[DEBUG] (id 1) SEND: (11) 10
[DEBUG] wiiuse.c:215: Starting rumble...
[DEBUG] (id 1) SEND: (13) 11
[DEBUG] wiiuse.c:219: Stopping rumble...
[DEBUG] (id 1) SEND: (13) 10
[DEBUG] (id 1) SEND: (17) 04 a6 00 fa 00 06
[DEBUG] (id 1) RECV: (21) 00 00 50 00 fa 00 00 a6 20 05 05 00 00 00 00 00 00 00
00 00 00
[DEBUG] motion_plus.c:54: No Motion+ available, stopping probe.
[DEBUG] events.c:548: Setting timeout to normal 10 ms.
[DEBUG] wiiuse.c:347: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30


--- CONTROLLER STATUS [wiimote id 1] ---
attachment:      0
speaker:         0
ir:              0
leds:            1 0 0 0
battery:         0.455000 %
[DEBUG] (id 1) RECV: (30) 00 00 50 00 fa 00 00 a6 20 05 05 00 00 00 00 00 00 00
00 00 00
[DEBUG] (id 1) RECV: (30) 00 02 50 00 fa 00 00 a6 20 05 05 00 00 00 00 00 00 00
00 00 00

When plugging in a nunchuk into the Motion+, I get this (but no nunchuk reports):

--- EVENT [id 1] ---
[DEBUG] (id 1) RECV: (20) 00 00 12 00 00 5a 00 a6 20 05 05 00 00 00 00 00 00 00
00 00 00
[DEBUG] (id 1) SEND: (17) 04 a6 00 fa 00 06
[DEBUG] (id 1) RECV: (21) 00 00 50 00 fa 00 00 a6 20 00 05 00 00 00 00 00 00 00
00 00 00
[DEBUG] motion_plus.c:72: Detected inactive Motion+!
[DEBUG] wiiuse.c:549: Writing 1 bytes to memory location 0x4a600f0...
Write data is: 55
[DEBUG] (id 1) SEND: (16) 04 a6 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[DEBUG] wiiuse.c:549: Writing 1 bytes to memory location 0x4a400f0...
Write data is: 55
[DEBUG] (id 1) SEND: (16) 04 a4 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[DEBUG] wiiuse.c:549: Writing 1 bytes to memory location 0x4a400fb...
Write data is: 0
[DEBUG] (id 1) SEND: (16) 04 a4 00 fb 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[DEBUG] wiiuse.c:347: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30
[DEBUG] events.c:518: Attachment detected!
[DEBUG] events.c:634: handshake_expansion with state 0
[DEBUG] events.c:642: write 0x55 - Setting timeout to expansion 10 ms.
[DEBUG] wiiuse.c:613: Data write request can be sent out immediately.
[DEBUG] wiiuse.c:549: Writing 1 bytes to memory location 0x4a400f0...
Write data is: 55
[DEBUG] (id 1) SEND: (16) 04 a4 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[DEBUG] wiiuse.c:347: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30


--- CONTROLLER STATUS [wiimote id 1] ---
attachment:      0
speaker:         0
ir:              0
leds:            1 0 0 0
battery:         0.450000 %
[DEBUG] events.c:634: handshake_expansion with state 1
[DEBUG] events.c:652: write 0x00 - Setting timeout to expansion 10 ms.
[DEBUG] wiiuse.c:619: chaud2fois
[DEBUG] wiiuse.c:625: Added pending data write request.
[DEBUG] wiiuse.c:549: Writing 1 bytes to memory location 0x4a400fb...
Write data is: 0
[DEBUG] (id 1) SEND: (16) 04 a4 00 fb 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[DEBUG] events.c:634: handshake_expansion with state 2
[DEBUG] wiiuse.c:403: Data read request can be sent out immediately.
[DEBUG] wiiuse.c:477: Request read at address: 0x4a40020  length: 224
[DEBUG] (id 1) SEND: (17) 04 a4 00 20 00 e0
[WARNING] Transmitting data packet when no request was made.
[DEBUG] (id 1) RECV: (22) 00 00 16 00 fa 00 00 a6 20 00 05 00 00 00 00 00 00 00
00 00 00
[WARNING] Transmitting data packet when no request was made.
[DEBUG] (id 1) RECV: (21) 00 00 f0 00 20 ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   32 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 0 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           208 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] (id 1) RECV: (21) 00 00 f0 00 30 ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   48 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 16 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           192 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff
[DEBUG] (id 1) RECV: (21) 00 00 f0 00 40 ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   64 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 32 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           176 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   80 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 48 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           160 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   96 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 64 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           144 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   112 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 80 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           128 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   128 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 96 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           112 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   144 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 112 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           96 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   160 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 128 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           80 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   176 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 144 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           64 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   192 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 160 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           48 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   208 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 176 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           32 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   224 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 192 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           16 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:373: Received read packet:
[DEBUG] events.c:374:     Packet read offset:   240 bytes
[DEBUG] events.c:375:     Request read offset:  32 bytes
[DEBUG] events.c:376:     Read offset into buf: 208 bytes
[DEBUG] events.c:377:     Read data size:       16 bytes
[DEBUG] events.c:378:     Still need:           0 bytes
Read: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
f ff ff ff ff ff ff ff ff ff ff ff ff
[DEBUG] events.c:634: handshake_expansion with state 3
[WARNING] Unknown expansion type. Code: 0xffffffff
[WARNING] Could not handshake with expansion id: 0xffffffff
[DEBUG] wiiuse.c:496: Requested wiimote status.
[DEBUG] (id 1) SEND: (15) 00
[DEBUG] (id 1) RECV: (20) 00 00 12 00 00 5a ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff
[DEBUG] events.c:518: Attachment detected!
[DEBUG] wiiuse.c:347: Setting report type: 0x34
[DEBUG] (id 1) SEND: (12) 00 34


--- CONTROLLER STATUS [wiimote id 1] ---
attachment:      0
speaker:         0
ir:              0
leds:            1 0 0 0
battery:         0.450000 %
[DEBUG] (id 1) RECV: (34) 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff

Flipping the Lock switch does allow normal operation again.

[MSVC2015] 'WM_PLUS_PRODUCT_ID': undeclared identifier

Using Windows 10, following the instructions in the README, I am unable to build wiiuse library in any configuration.

cmake goes reasonably well, with warnings about missing SDL and GLUT.

Building the library in MSVC 2015 Community, Debug or Release configuration, fails with the following error:

wiiuse\src\os_win.c(123): error C2065: 'WM_PLUS_PRODUCT_ID': undeclared identifier

Searching the repository on GitHub reveals that this comes up only in the offending line and in a issue #58 comment. The line was added with commit d5dc22c and merged with #61 in April 2015.

It would be very surprising to me if something that breaks all Windows builds has been in master for over a year. Maybe the declaration of WM_PLUS_PRODUCT_ID was removed recently? Or am I missing something?

Not compatible with C99 - should be mentioned

I am using wiiuse as a library in a larger C project. In this project, I am using C99 by default (-std=c99 in gcc).

The strange behavior I had was the fact that I only got WIIUSE_NONE events from the wiiuse_poll method. I also noticed the following warning when compiling:
"lib/wiiuse/src/wiiuse.h:617: warning: declaration does not declare anything"

Not using the C99 standard (removing -std=c99 from makefile) from the files that use the wiiuse library fixed my problem. Is it possible to note this in the README file? It took me hours of debugging. Or is this something that's too obvious to mention?

Long-term reengineering

In another issue janoc pointed out the need for a reengineering of this project. In order to track ideas and opinions independent of that issue, I am opening a new issue.

Possible incorrect use of atanf

In dynamics.c - Used to calculate joystick angle - does weird things when y is 0. I'm thinking that probably atan2 is desired

Compile error osx 10.11

I am not able to compile wiiuse on my osx 10.11 machine.

dhcp-10-176-88-115:build thomasgeissl$ make
Scanning dependencies of target wiiuse
[  5%] Building C object src/CMakeFiles/wiiuse.dir/classic.c.o
[ 11%] Building C object src/CMakeFiles/wiiuse.dir/dynamics.c.o
[ 17%] Building C object src/CMakeFiles/wiiuse.dir/events.c.o
[ 23%] Building C object src/CMakeFiles/wiiuse.dir/guitar_hero_3.c.o
[ 29%] Building C object src/CMakeFiles/wiiuse.dir/io.c.o
[ 35%] Building C object src/CMakeFiles/wiiuse.dir/ir.c.o
[ 41%] Building C object src/CMakeFiles/wiiuse.dir/nunchuk.c.o
[ 47%] Building C object src/CMakeFiles/wiiuse.dir/wiiuse.c.o
/Users/thomasgeissl/programming/libs/wiiuse/src/wiiuse.c:661:12: warning: address of array 'req->data' will
      always evaluate to 'true' [-Wpointer-bool-conversion]
        if (!req->data || !req->len) {
            ~~~~~~^~~~
1 warning generated.
[ 52%] Building C object src/CMakeFiles/wiiuse.dir/wiiboard.c.o
[ 58%] Building C object src/CMakeFiles/wiiuse.dir/motion_plus.c.o
[ 64%] Building C object src/CMakeFiles/wiiuse.dir/util.c.o
[ 70%] Building C object src/CMakeFiles/wiiuse.dir/os_mac/os_mac.m.o
[ 76%] Building C object src/CMakeFiles/wiiuse.dir/os_mac/os_mac_interface.m.o
[ 82%] Building C object src/CMakeFiles/wiiuse.dir/os_mac/os_mac_find.m.o
[ 88%] Linking C shared library libwiiuse.dylib
Undefined symbols for architecture x86_64:
  "_wiiuse_os_ticks", referenced from:
      _wiiuse_wait_report in io.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/libwiiuse.dylib] Error 1
make[1]: *** [src/CMakeFiles/wiiuse.dir/all] Error 2
make: *** [all] Error 2

2e81a87 compiles fine.
Any pointers?

Regression: WIIUSE_DISCONNECT event no longer emitted

New(ish) versions of wiiuse no longer emit disconnect signals when a WiiMote is powered down. I believe this to be a regression introduced in rev f2bf07c.

Newer versions only call propagate_event when wiiuse_os_read returns with success (os_nix.c:302).

To me it seems that one can just remove the check on the return value and call propagate_event anyways. Is this a viable fix?

Unplugging Nunchuk while MotionPlus is reporting results in bad Nunchuk data

This is with the osx-refactor_sync-mplus branch which I anticipate merging soon. Start the example, and plug in a nunchuk. Then, press 1+2 to turn on motion plus reporting. You'll see you're getting reports from the motion+ and the various sensors in the nunchuk. Now, unplug the nunchuk. The same output will be given, except that the accel data will all be 0 for the nunchuk and the analog stick data will appear the same as it did during the last report.

Only after disabling the Motion+ (by pressing 1+2, I seem to have to do it a few times), does the nunchuk stop "reporting". Plugging it back in resumes correct operation.

Not realy an 'Issue': Unreal Engine 4 Intergration

Haya

I'm working in intergrating wiiuse into Unreal Engine 4 in the form of a plugin.

The engine looks great, having a few teething issues but thats to be expected.

I'm compiling it on vs 2013 (as that the native compiler for UE4) and using windows 8.1 (as that the os I live on these days shudder). I decided to forgo cmake as it didn't play nicely with my development environment (vs2013, win8.1) but manually constructed the solution and it seems to be nice and stable.

I've got it compiling nicely to a static library, but I had to add a hack to the connect method for windows os.
see: https://github.com/rpavlik/wiiuse/issues/51

and im haveing a balance board sensor issue (may be code, may be hardware)
see: https://github.com/rpavlik/wiiuse/issues/42

Library seems great though :)

Ill keep this 'updated' with my progress

Matthew Spencer

Wiimote use Python wiiuse error

Excuse me my wiiuse generator error

error message is
""
"[WARNING] Packet ignored. This may indicate a problem (timeout is 5 ms)."

What the message is mean?

and my wiimote reach realtime motion sessing is not good

Wrong data returned from WiiBoard in fresh build

Running the included wiiuseexample.exe with a fresh build of wiiuse is returning wrong values for the balance board. Specifically the top left sensor always returns 0, while the other 3 are not scaled correctly. Running a debug build we get this raw data coming in:

--- EVENT [id 1] ---
Weight: 0.000000 kg @ (-1.#IND00, -1.#IND00)
[DEBUG](id 1) RECV: (34) 00 00 03 d0 19 1a 00 17 15 23 19 00 6e 00 00 00 00 00
00 00 00

Putting pressure on the top left sensor only increases its value from 0017 to 0018, which still registers as 0 after the conversion and calibration.

Strangely if we run the prebuilt wiiuse.dll (the one included in the 0.14 package) once with the example, then the freshly built dll also returns the right values, at least so long as the Wiiboard isn't turned off in between. So this might be a calibration problem, or something set in the bluetooth stack itself. We're using the native stack on Windows 7.

Reverting the repository to the commit "added forgotten Balance board support" from Jan 15th also gives the right values, but isn't very stable.

We're also having trouble disconnecting the board. Both wiiuse_disconnect and wiiuse_cleanup leave the board in a connected state (led is still on), any ideas here?

[MacOS Sierra] Wiimote not detected by wiiuse but found by dolphin

Using MacOS Sierra.

The controller is a black Wiimote that shows up in bluetooth preferences as Nintendo RVL-CNT-01. The below behaviours are identical whether I have the motion plus attached or not.

When I first connect the controller, all 4 LEDs continuously flash. In this state, if I run wiiuseexample I get the following output.

wiiuse v0.15.0 loaded.
  Fork at http://github.com/rpavlik/wiiuse
  Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[DEBUG] /Volumes/STORE/Tools/Misc/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=NO
[DEBUG] /Volumes/STORE/Tools/Misc/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=YES
[ERROR] Unable to stop bluetooth device inquiry.
[INFO] Found 0 Wiimote device(s).
No wiimotes found.
Program ended with exit code: 0

If I open dolphin controller configuration then press the "Refresh" button, the controller vibrates twice, the LEDs stop flashing and instead I get a solid single LED1. In this state, the messages from wiiuseexample are identical.

wiiuse v0.15.0 loaded.
  Fork at http://github.com/rpavlik/wiiuse
  Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[DEBUG] /Volumes/STORE/Tools/Misc/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=NO
[DEBUG] /Volumes/STORE/Tools/Misc/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=YES
[ERROR] Unable to stop bluetooth device inquiry.
[INFO] Found 0 Wiimote device(s).
No wiimotes found.
Program ended with exit code: 0

attachments not correctly detected

I've just cloned the master branch and tried the wiiuse example and it seems as if the attachments are not detected.
A status event seems to be fired:

--- CONTROLLER STATUS [wiimote id 1] ---
attachment: 0
speaker: 0
ir: 0
leds: 1 0 0 0
battery: 0.385000 %
[WARNING] Unknown event, can not handle it [Code 0x0].

and the same when it gets disconnected.

Any thoughts on this? I've tried this on OSX 10.7.4
I've tried with both the nunchuck and the classic attachment, both give the same results.

release 0.14.2

@rpavlik can you release the tag 0.14.2?
Your documentation states this as the current version, but it is not available as tag!

I'm considering to ship this to Arch Linux's [community] repository as makedepends to csound.
Would be great to not ship the seven years old 0.14.0 (and I'm not even sure I'll be able to build csound with it properly in the first place).

Linux - Can't connect to Wiimote -TR

To reproduce:

  1. Compile and install Wiiuse
  2. Run wiiuseexample
  3. Press the red button on the back of the remote

The lights on the remote flash until wiiuseexample is killed (CTL+C) or Wiimote battery is removed, output from wiiuseexample:

wiiuse v0.15.0 loaded.
  Fork at http://github.com/rpavlik/wiiuse
  Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[INFO] Found 1 bluetooth device(s).
[INFO] Found wiimote (type:  (motion plus inside)) (9C:E6:35:B3:07:97) [id 1].
[INFO] Connected to wiimote [id 1].

If the Wiimote battery is removed, after about 10 seconds, wiiuseexample starts spitting out:

[ERROR] Receiving wiimote data (id 1).
Error Details: Bad file descriptor

100's of times per second, like this:
image
Master branch.

Can wiiuse permiantly pair wii controllers to windows?

I'm interested in streamlining the connection process...

At the moment each time I restart windows or a controller I go to bluetooth settings and manually pair my wii controllers to the windows bt stack. Then I can run wiiuse and find the controllers.

Am I doing something wrong, or is automatic wiimote discovery/pairing not a part of windows wiiuse

WIIUSE_GET_IR_SENSITIVITY Macro

The macro WIIUSE_GET_IR_SENSITIVITY in wiiuse.h line 294 is declared with parameter "dev" but definition uses "wm" instead.

=> Error at compile time (only when used).

Suggestion: rename "dev" param to "wm".

Regression in balance board

From personal email:


Specifically I need to use the wii board. After running the project to create the libraries and the example for the new version I get a warning right of the bat saying that the expansion code 0x4200402 could not be recognized, and the board is treated as regular controller, while incoming data is ignored (another warning).

I then tried v0.14 and the example there runs perfectly.

Could it be something I did wrong? Any pointers you could give me would be appreciated.

[MacOS Sierra] [ERROR] Could not start run loop while waiting for read [id 1].

I wrote an app that uses wiiuse and streams the data out to labstreaminglayer (a library for transmitting, syncing, & storing scientific data). I kept this Wiimote app consistent with the other labstreaminglayer apps, thus I have a Qt5 GUI running on the main thread, the Wii devices are connected on the main thread, but then they are accessed by a member function running in a separate std::thread.

This seems to work OK for a few seconds then I get a lot of errors as stated in the topic. Below is the log.

Before I go and restructure the app so everything happens in the main thread, is this error due to the Wiimote communication happening in a secondary thread? Is that not allowed?
Or is it just because I'm polling the device too fast?

wiiuse v0.15.0 loaded.
  Fork at http://github.com/rpavlik/wiiuse
  Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/os_mac/os_mac_find.m:200: Found a wiimote
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=NO
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/os_mac/os_mac_find.m:211: Inquiry complete, error=0, aborted=YES
[ERROR] Unable to stop bluetooth device inquiry.
[INFO] Found Wiimote (e8-4e-ce-a5-7b-20) [id 1]
[INFO] Found 1 Wiimote device(s).
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/os_mac/os_mac_interface.m:80: Connecting to Wiimote [id 1].
[INFO] Connected to Wiimote [id 1].
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4a400f0...
Write data is: 55 
[DEBUG] (id 1) SEND: (16) 04 a4 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:275: Wiimote reset!

[DEBUG] (id 1) SEND: (17) 00 00 00 16 00 08 
[DEBUG] (id 1) RECV: (30) 00 00 
[DEBUG] (id 1) RECV: (30) 00 00 
[DEBUG] (id 1) RECV: (22) 00 00 16 07 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:140: (id 1) dropping report 0x22, waiting for 0x21
[DEBUG] (id 1) RECV: (21) 00 00 70 00 16 74 74 73 26 8b 8c 8b 32 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:293: Calibrated wiimote acc

[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:316: Asking for status, attempt 0 ...

[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:505: Requested wiimote status.
[DEBUG] (id 1) SEND: (15) 00 
[DEBUG] (id 1) RECV: (20) 00 00 00 00 00 85 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:316: Asking for status, attempt 1 ...

[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:505: Requested wiimote status.
[DEBUG] (id 1) SEND: (15) 00 
[DEBUG] (id 1) RECV: (20) 00 00 00 00 00 85 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/io.c:316: Asking for status, attempt 2 ...

[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:505: Requested wiimote status.
[DEBUG] (id 1) SEND: (15) 00 
[DEBUG] (id 1) RECV: (20) 00 00 00 00 00 85 
[DEBUG] (id 1) SEND: (17) 04 a6 00 fa 00 06 
[DEBUG] (id 1) RECV: (21) 00 00 50 00 fa 00 00 a6 20 00 05 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/motion_plus.c:73: Detected inactive Motion+!
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4a600f0...
Write data is: 55 
[DEBUG] (id 1) SEND: (16) 04 a6 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4a400f0...
Write data is: 55 
[DEBUG] (id 1) SEND: (16) 04 a4 00 f0 01 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4a400fb...
Write data is: 0 
[DEBUG] (id 1) SEND: (16) 04 a4 00 fb 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x30
[DEBUG] (id 1) SEND: (12) 00 30 
[DEBUG] (id 1) SEND: (11) 10 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:217: Starting rumble...
[DEBUG] (id 1) SEND: (13) 11 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:221: Stopping rumble...
[DEBUG] (id 1) SEND: (13) 10 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x31
[DEBUG] (id 1) SEND: (12) 00 31 
[DEBUG] (id 1) SEND: (13) 04 
[DEBUG] (id 1) SEND: (1a) 04 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4b00030...
Write data is: 8 
[DEBUG] (id 1) SEND: (16) 04 b0 00 30 01 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 9 bytes to memory location 0x4b00000...
Write data is: 2 0 0 71 1 0 aa 0 64 
[DEBUG] (id 1) SEND: (16) 04 b0 00 00 09 02 00 00 71 01 00 aa 00 64 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 2 bytes to memory location 0x4b0001a...
Write data is: 63 3 
[DEBUG] (id 1) SEND: (16) 04 b0 00 1a 02 63 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:560: Writing 1 bytes to memory location 0x4b00033...
Write data is: 3 
[DEBUG] (id 1) SEND: (16) 04 b0 00 33 01 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/wiiuse.c:356: Setting report type: 0x33
[DEBUG] (id 1) SEND: (12) 00 33 
[DEBUG] ~/Wiimote/deps/wiiuse/src/wiiuse/src/ir.c:165: Enabled IR camera for wiimote id 1 (sensitivity level 3).
[DEBUG] (id 1) RECV: (22) 00 00 16 04 
[DEBUG] (id 1) RECV: (22) 00 00 16 07 
[DEBUG] (id 1) RECV: (30) 00 00 
[DEBUG] (id 1) RECV: (31) 40 40 73 6f 89 
[DEBUG] (id 1) RECV: (31) 60 20 71 6e 8a 
[DEBUG] (id 1) RECV: (22) 00 00 16 00 
[DEBUG] (id 1) RECV: (31) 60 00 74 6f 8b 
[DEBUG] (id 1) RECV: (31) 60 20 71 6e 8a 
[DEBUG] (id 1) RECV: (31) 40 00 73 6f 8d 
[DEBUG] (id 1) RECV: (31) 00 00 73 6f 8a 
[DEBUG] (id 1) RECV: (22) 00 00 16 04 
[DEBUG] (id 1) RECV: (22) 00 00 16 00 
[DEBUG] (id 1) RECV: (22) 00 00 16 00 
[DEBUG] (id 1) RECV: (31) 40 00 74 6f 8c 
[DEBUG] (id 1) RECV: (31) 60 00 72 6f 8c 
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[ERROR] Could not start run loop while waiting for read [id 1].
[DEBUG] (id 1) RECV: (33) 00 20 72 6e 8a ff ff ff ff ff ff ff ff ff ff ff ff 
[ERROR] Could not start run loop while waiting for read [id 1].

New revision of wiimote: RVL-CNT-01-TR

I don't have one, but apparently there are breaking changes, at least to the bluetooth/hid product ID, etc.

http://glovepie.org/blog/2012/01/03/wii-remote-plus/
https://bugs.launchpad.net/wiican/+bug/954546

Per WiiBrew: "The newer Wiimote RVL-CNT-01-TR shuts down immediately upon receiving any HID output report if it has been turned on using the 1 + 2 method, although it works using the sync button. It is possible that authentication is now mandatory for the 1 + 2 temporary sync[check]." http://wiibrew.org/wiki/Wiimote

Motion+ in VRPN

Coming from the VRPN email list...
I was trying to implement Motion+ in vrpn_WiiMote.C, given that there is support already in Wiiuse, so with the data passing I had no problem until I realized there is a pretty random issue which I don't know where it comes from.

Just like in the wiiuseexample, I use the function wiiuse_set_motion_plus(wiimote->device, 2) to activate the Motion+ extension with the nunchuk pass-through. The problem is that whenever I'm using it, the nunchuk is not working, but the motion+ is giving the right data. Any idea about it? Also, if I disable the Motion+ using that same function, the nunchuk doesn't come back, it's still not working.

Thanks!
Jafet

Compiliaton error in events.c under MS Visual Studio 2010

When compiliing wiiuse under Windows with Visual Studio 2010, I encountered compilation errors which originate in events.c line 760

WIIUSE_DEBUG("handshake_expansion with state %d", wm->expansion_state);

As this is a C program, the compilation does not like to have executable statements before declarations. After moving the line to after the declaration (line 765), I managed to compile the program and it works great. Indeed, the "wiiuseexmaple" runs more reliably than the one from wiiuse v0.13.

Please help to update the source code so that those using wiiuse on Windows can benefit. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.