HID Wiimote Gamepad 0.2.7.0

Rather small technical changes for HID Wiimote. First one is primary a fix for Unity3D, when you want to use the Wiimote as gamepad. Unity3D uses RawInput instead if DirectInput, when reading from generic non XInput Gamepads. It seems RawInput has some issues with axes that have a negative value range, e.g. -127 to 127. So the change is to simply use a value range from 0 to 255.

The support for the Balance Board and Guitar Hero Guitar are completely untested and therefore pure experimental. I do not have a Balance Board nor a Guitar, therefore i am not able to test it(i might get a Balance Board in February). So use on your own risk, but you are welcome to report any issues and i’ll attempt to fix them.

Downloads are available on the HID Wiimote page.

Changes

  • Fix RawInput not reading the primary axes correctly
  • Add experimental untested Balance Board support
  • Add experimental untested Guitar Hero Guitar support

Current State of Windows HIDAPI and Wiimotes

Introduction

This is a small follow up on my testings. Long time it was believed that the PlusInside Wiimotes (“-TR”) are not working with the default Bluetooth Windows Stack. Every program and library recommends the common Toshiba Bluetooth “hack” to get “-TR” Wiimotes and Wii U Pro controllers working on Windows. I did some research with the HIDAPI on Windows and came to the result, that on Windows 8 and above using the proper API Calls, “-TR” Wiimotes, as well as the Wii U Pro Controller is working perfectly fine.

I implemented and fixed the Wiimote Code in the Dolphin Project, which also lead to improved Wiimote Audio for “-TR” Wiimotes.

TLDR;

Using the proper API Calls the Toshiba Bluetooth Stack is not needed anymore on Windows 8 and above. Both Wiimotes types (TR & non-TR) and the Wii U Pro are working fine. Here is the code repository of my test program.

The following post is basically just a copy & paste of the Readme, as it got quite extensive.

Windows 7

The API Calls would also work fine on Windows 7, but there is a bug in the Microsoft HID Class Driver. This renders the “WriteFile”-Method unusable on Windows 7, therefore it is not possible to use the HIDAPI to send data to “-TR” Wiimotes.

HIDAPI

Sending & Receiving

Sending HID Reports:

Recieving HID Reports:

The MSDN Design Guides Sending HID Reports and Obtaining HID Reports are stating, that WriteFile and ReadFile are the preferred methods to send and recieve data from the device. Additionally sending data to a “-TR” Wiimote via WriteFile is working fine, whereas using HidD_SetOutputReport will result in the Wiimote turning off.

Issues with WriteFile

As the MSDN Desgin Guide Sending HID Reports by Kernel-Mode Drivers (WriteFile will send out an IRP_MJ_WRITE request to the driver interface) suggests, the output report buffers shall have the size of the largest output report supported by the device. In case of the Wiimote this is 22 Byte.

This seems to be currently enforced by the Microsoft HID Class Driver on Windows 7 and the Toshiba Bluetooth Stack, as they will fail WriteFile attempts with the error ERROR_INVALID_USER_BUFFER, when the buffer size is less.

On Windows 7 however more bytes than the acutal report are sent to the device, which produces an error on the Wiimote. It is unknown whether this is a bug or intented behaviour. The Toshiba Bluetooth Stack in contrast only sends the appropiate amount of bytes according to the used report to the device.

On Windows 8 and higher, the output report buffer can be arbitrary in size, as the given amount of byte are submitted to the device.

This results in the following table of compability.

Table of compability

x Toshiba Stack Win 7 Win 8.1 Win 10
WriteFile Largest Report Size +
WriteFile Acutal Report Size + +
SetOutputReport +* +* +*

* does not support “-TR” when connected via Bluetooth

Method Priority Order

This leads us to the following order of prioritized methods:

  1. Detect whether the Microsoft Stack or the Toshiba Stack is used for the Wii Remote.
  2. In case of Toshiba Stack, use WriteFile with the largest report size for the buffer
  3. In case of Microsoft Stack, try WriteFile with the actual report size
  4. If WriteFile fails, fall back to HidD_SetOutputReport

Detecting Stack

To detect the used stack for the Wiimote, the provider property of the used HID Class Driver is evaluated. As the enumerated Wiimote Devices are just raw PDO’s, that are acting as interfaces for the HID Class Driver and don’t have a driver directly associated with, it is neccessary to move one node up in the device tree to get to the device node that is associated with the HID Class Driver. To do so the PnP Configuration Manager API is used.

Why WriteFile supports “-TR”

It is believed, that the usage of HidD_SetOutputReport will result in sending the output report via the Control Channel. This is not supported by “-TR” Wiimotes, as they will immediately shut down. In contrast WriteFile seems to send the data to device via the Interrput/Data Channel.

DolphinBar

The Mayflash DolphinBar enumerates Wiimotes as USB Devices, resulting in using the Microsoft HID Class Driver. Therefore WriteFile won’t work on Windows 7 for Wiimotes connected through the DolphinBar either. However as the DolphinBar takes care of the Bluetooth communication and the outgoing data is send via USB to the DolphinBar, HidD_SetOutputReport does support “-TR” Wiimotes as long as they are connected through a DolphinBar.

HID Wiimote 0.2.6

New Year; i am back in Berlin and can continue to work on HID Wiimote. Yay!

Rather small update with just one and a half fix. Regarding the connectivity issue on Windows 10 Version 1511, i had no issues while testing. Therefore i assume either the updated WDK or another Windows update fixed it. If the problem persists, please report back, so i can take another look at it.

Direct Download Links: Gamepad, IR-Mouse, DPad-Mouse

Links have been replaced with Hotfix 0.2.6.1 0.2.6.2: The installer had some problems on non English Windows Systems (and then i messed up the installer config).

Changes

  • Fix #11: Improved Extension Controller detection
  • Package now includes EULA and Readme file
  • Replaced Multilingual Driver Package Installer with only-English one
  • Introduced proper versioning, starting with 0.2.6
  • Build with WDK 10.0.10586.15, to hopefully fix connectivity issues with Windows 10 Version 1511 (November Update)

HID Wiimote Update – 13.07.15

Just two small fixes.

Changes

  • Fixed LED Battery Level display for Wii U Pro Controller
  • Each Classic Controller (Pro) & Wii U Pro Controller Trigger has its own input axis

HID Wiimote Source Code available

Wuhu! I have published the Source Code of HID Wiimote on Github.
Some have already asked for it, now i finally did it!

Check it out: https://github.com/jloehr/HID-Wiimote

I am going to fill it with Issues and Milestones in the next days.
But you can add Issues on your own, when encountering a bug.
If you manage to fix a bug, or come up with a cool feature, feel free to contribute.
Fork it, fix it, send a Pull Request!

 

IR-Mouse HID Wiimote Hotfix

Small hotfix for the IR-Mouse version of HID Wiimote. I stupidly removed the Hardware ID from the .inf file, thinking the IR-Mouse doesn’t need it, because the “-TR” Wii Remote shares it with the Wii U Pro Controller.

Added it back to the .inf file and made a new package batch. When you want to use the newer Wii Remotes with the IR-Mouse driver, uninstall the old one and get the fresh packages from the download page.

Since the Wii U Pro Controller has the same Hardware ID as the newer Wiimotes, the IR-Mouse driver gets also loaded for the Wii U Pro Controller, although it doesn’t have an IR-Sensor.

Changes to IR-Mouse

  • Hotfix for IR-Mouse to enable “-TR” Wii Remotes

HID Wiimote Update 01.06.15

I’ve finally finished the IR-Mouse Version of HID Wiimote!
With that driver you are able to control your mouse pointer by pointing your Wii Remote at your screen. You just need some kind of IR source with up to four points, but best is a Sensor Bar.
The input is slightly steadied but has therefore a small input delay. You can download the driver from the HID Wiimote page. If you are looking for the old DPad-Version you can find it here.

Additionally i made a small update to the Gamepad Version. I fixed a small issue, so the input state is reset when the connection to the controller is lost. You can get the update from the project site as well.

Next i am going to work on the XUSB communication, so i can create a XUSB/XInput Driver for the Wii U Pro Controller.

New IR-Mouse Version

  • Tracks up to four IR-Points
  • Interpolates with previous points to steady
  • Therefore slight delay

Changes to Gamepad

  • Input State is reset, when the connection is lost

HID Wiimote Update 12.10.2014

It has been a while since the last update, but i didn’t had a lot of time in the last couple of months. Due to that this is just a minor update. I looked into the problem with the certificates and the driver signing. Unfortunately i wasn’t able to remove or avoid the necessary driver signature verification deactivation on 64bit systems. But at least i got Windows into loading my driver over the default one, so changing the driver each time should be gone now.

Additionally someone requested to have a driver to use the Wii Remote as mouse.  I’ve made a special build, so the Wii Remote is recognized as mouse. You can move the mouse with the DPad, left and right click is on 1 and 2 and the middle mouse button is mapped to B. In the future i’m going to work on another build to control the mouse with the IR sensor, but this will take some additional time.

Last but not least someone other requested also to have Vista builds. So from now on i will provide Vista builds as well.

Get the newest version here, or the direct download directory

Changes

    • Added another installer, so Windows will use HID Wiimote as default driver for the Wii Remote
    • PDad-Mouse Build

HID Wiimote Update 01.07.2014

Today i borrowed a Wii Remote with Plus inside, one of the newer ones (RVL-CNT-01-TR) with the Sync Button on the battery cover. My hearings were true, they have a different hardware ID, but that was just a minor problem and fixed with one line in the INF-file. The bigger problem was, that they differ a little bit in behavior. So in the end you can’t connect the new Wii Remotes by pressing the 1 and 2 buttons, instead you have to use the Sync button each time. There were some additional trouble, but i fixed that as well.

Another new feature are a second X and Y axes for tilt. Currently tilt is only tracked by the accelerometer, so it’s a little bit inaccurate and you have to hold the Wii Remote still. The Motion Plus gyroskop is not supported yet, but that will be my next task. You might need to recalibrate the asxes via the gamecontroller properties dialog. The reason is, that all Wii Remotes are not well calibrated, so the middle, minima and maxiuma are a little bit shifted.

Hower, newest version can be downloaded here: HID Wiimote

Changes

  • Added support of the newer Wii Remotes (RVL-CNT-01-TR)
  • Added second X/Y axes representing tilt (Currently only tracked by the accelerometer) 
Properties dialog with driver
Properties dialog of the new driver verion

HID Wiimote Update 26.06.2014

In the past days i’ve worked a lot on the driver. Unfortunatly there were some problems with the last uploads. Now i’ve tested everything and it should work properly. If you still encounter any error, please let me know.

For download visit: HID Wiimote

Changes

Driver

  • The d-pad is represented as X/Y axes now, instead of four different buttons.
  • The four LEDs will now represent the remaining battery charge.
  • On Windows 8 the Wii Remote will now be marked as Offline, when powering it off or Windows is rebooted.

Installation

  • Added an Installer. DPInst.exe is a Microsoft provided default installer for driver packages. The installer will also add an entry to your Programs and Features for uninstalling the driver.