Unity-Wiimote icon indicating copy to clipboard operation
Unity-Wiimote copied to clipboard

HIDAPI error on build

Open DKDiep opened this issue 8 years ago • 12 comments

Testing the wiimote on editor runs as expected but on build it does not respond. Reading the output log shows: Incorrent Input to HIDAPI. No data has been sent.

This also occurs on the test scene provided. Has anyone been able to successfully use the wiimote on a built project?

Attempted on both Windows 10 and OSX Wiimote model RVL-CNT-01

DKDiep avatar Mar 02 '16 18:03 DKDiep

Is the Unity editor open when you try to run the game? If so then close it.

Flafla2 avatar Mar 02 '16 19:03 Flafla2

Hey, I was getting the same error. With the editor closed.

Some more info from the log:

Couldn't open /Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi, error: dlopen(/Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi, 2): no suitable image found. Did find: /Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi: mach-o, but wrong architecture

knarfrank avatar Mar 02 '16 19:03 knarfrank

Hi, sorry for the late response - the editor is indeed closed. Revisiting this issue at Wiimote::SendWithType/2 it seems that res is 0 in editor, but -2 on build when finding wiimotes.

DKDiep avatar Mar 06 '16 20:03 DKDiep

Hey Everyone,

Rebuilding the hidapi library from the source (found here https://github.com/signal11/hidapi) and using the produced dll to replace the hidapi.dll found in ...\Assets\Wiimote\Plugins\win32. It seems to work for me.

samtherussell avatar Nov 04 '16 16:11 samtherussell

I FOUND IT. You guys need to CLEAN after you stop the game. If you don't do something like this:

void OnApplicationQuit() {
		if (remote != null) {
			WiimoteManager.Cleanup(remote);
			remote = null;
		}
	}
}

you're going to be screwed next time you start up and have to literally use the power button of your wii remote to turn off and turn it back on.

If you somehow manage to stop the game and "WiimoteManager.Cleanup(remote);" did not run, you have to restart the wiimote. I'm currently looking for alternatives on how to make the wiimote work from that broken state without the need to turn off and turn on again.

B0M avatar Dec 11 '16 11:12 B0M

Sorry, can someone upload the hidapi for windows 10?? I don't understand how to rebuild for this hidapi.

jerry900287 avatar Dec 14 '16 18:12 jerry900287

@jerry900287 Try my way. I didn't have to rebuild the HIDAPI at all, and I doubt that's the issue. It works for me, because I cleaned before closing.

B0M avatar Dec 15 '16 07:12 B0M

@B0M Have you tried to build on desktop and run ? It is successful to run on unity but I build on desktop is fail. I have tried your way but it does not work. It still prints " Incorrent Input to HIDAPI. No data has been sent. " Do I misunderstand ?

jerry900287 avatar Dec 15 '16 07:12 jerry900287

I only just tried the wiimote on build and it worked identically, no problems so far on desktop build. when it said "Incorrect input to HIDAPI. No data has been sent.", did you try to hold the power button multiple times until the LED lights start flashing to fix the problem?

B0M avatar Dec 17 '16 10:12 B0M

Also for the odd occasions when the wiimotes stop working, you want to detect and event like this, clean the remotes and refind it. The event i looked for was this

if (WiimoteManager.Wiimotes [i].ReadWiimoteData () < 0)

not sure if there exists a better way.

B0M avatar Dec 17 '16 10:12 B0M

Thank God !!!! I solved it. The problem is my project's "Architecture" of build settings needs to set on x86_64, not to set on x86. Thank for your help !!!!

jerry900287 avatar Dec 17 '16 15:12 jerry900287

@jackoson Thank you very much :)

fuxiaochun1 avatar Aug 30 '17 10:08 fuxiaochun1