Wiimote Project

Hardware Support => Bluetooth & Connectivity Help Center => Topic started by: atomriot on January 13, 2008, 11:09:32 AM

Title: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on January 13, 2008, 11:09:32 AM
I initially had issues with the apps i would get from his blog so i started digging around and found that Blue Soliel or whatever its called, has to install its own bluetooth driver on top of yours to get this to work. seeing as how it eventually costs money to use, i wanted to find a way around it.

luckily the fix is pretty easy. I ran the wiilib test app and it worked by itself....hmm but whiteboard doesnt.... What i did was compared the Connect method in the wiimote.cs file from the lib and the whitebaord app (and all of Johnny's other apps) and noticed there was a very small difference.

this is the code from Johnny's apps

Code: [Select]
if(attrib.VendorID == VID && attrib.ProductID == PID)
{
    if (!IsRemoteConnected((int)index))
    {
        Debug.WriteLine("Found it!");
        found = true;
        remoteID = (int)index;
        connectedRemoteIDs.Add(remoteID);

        // create a nice .NET FileStream wrapping the handle above
        mStream = new FileStream(mHandle, FileAccess.ReadWrite, REPORT_LENGTH, true);

        // start an async read operation on it
        BeginAsyncRead();

        // read the calibration info from the controller
        ReadCalibration();
        break;
    }
}

What i noticed is the including of the options
Code: [Select]
if (!IsRemoteConnected((int)index))and
Code: [Select]
        remoteID = (int)index;
        connectedRemoteIDs.Add(remoteID);

then they have in the wiilib a try catch around teh calibrate method. here is the wiilib snippet

Code: [Select]
if (attrib.VendorID == VID && attrib.ProductID == PID)
{
    Debug.WriteLine("Found it!");
    found = true;

    // create a nice .NET FileStream wrapping the handle above
    mStream = new FileStream(mHandle, FileAccess.ReadWrite, REPORT_LENGTH, true);

    // start an async read operation on it
    BeginAsyncRead();

    // read the calibration info from the controller
    try
    {
        ReadCalibration();
    }
    catch
    {
        // if we fail above, try the alternate HID writes
        mAltWriteMethod = true;
        ReadCalibration();
    }

    break;
}

so if you take out the code and make it like the wiilib code, then it should work. i have not, however tried this with multiple wiimotes as i only have one.

hope this helps, and happy wii'ing
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: dice on January 13, 2008, 10:52:55 PM
Sticked it!
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: DiMo on January 17, 2008, 01:35:07 AM
after editing these lines of code... what is done next? if this source needs to be compiled at all... i wouldn't know what to compile it into, and if it doesn't need to be compiled... this technique hasn't worked out for me. my wiimote is also found by the wiilib test app and not by any of johnny's apps. i just am a little clueless about what to compile the file as, and if it doesn't need to be compiled it's odd that the program doesn't crash because of the lack of the whole file... unless that is exactly what the output would be if there was no file; false.
lets just say that i don't know what to do after that information as been altered and saved because johnny's app is responding the same exact way.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: ZaPPZion on January 17, 2008, 01:44:42 AM
You need to open the project with visual studio C# (2005 i think, 2008 works for me as well). Then edit the lines, and let it run (press f5) that should already work. So what you need to compile, is the project.
If you edit one of the .cs files, nothing gets changed when running the program from the .exe, because the .cs is just a source file, you can even delete the whole file without any changes to the .exe. So you'll need to download Visual Studio C# i guess. If you don't want to do that, i'll create a .exe with the changes for you (i might just do that right away... ;D)

greetings,
Bart
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: DiMo on January 17, 2008, 01:49:38 AM
You need to open the project with visual studio C# (2005 i think, 2008 works for me as well). Then edit the lines, and let it run (press f5) that should already work. So what you need to compile, is the project.
If you edit one of the .cs files, nothing gets changed when running the program from the .exe, because the .cs is just a source file, you can even delete the whole file without any changes to the .exe. So you'll need to download Visual Studio C# i guess. If you don't want to do that, i'll create a .exe with the changes for you (i might just do that right away... ;D)

greetings,
Bart

In doing so you may have just officially made the macbook running Windows Vista with boot camp 2.0  compatible with all of johnny's apps WITHOUT installing any other stack but the original. :)
because bluesoleil is extremely not compatible with this setup.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: ZaPPZion on January 17, 2008, 01:57:59 AM
this is the application i made, i couldn't test it myself because my wiimote isn't at home.
http://rapidshare.com/files/84443940/WiiDesktopVR.exe.html (http://rapidshare.com/files/84443940/WiiDesktopVR.exe.html)
didn't find any other place to host it. Please test this, and report any bugs to me;)
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: DiMo on January 17, 2008, 02:06:29 AM
i replaced the original WiiDesktopVR.exe with this one and the same message still pops up "Cannot find a wii remote: Error reading data from Wiimote...is it connected?"
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: ZaPPZion on January 17, 2008, 02:16:19 AM
Ok, then this solution isn't working for you i guess (unfortunately). I replaced the code like atomriot described and i recompiled the .exe, but it's not working. Ok that's annoying for you :( . But maybe someone else will come up with some solution. At least my .exe downloadable for anyone that wants to try this method, but doesnt want to install VC#
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: DiMo on January 17, 2008, 02:17:39 AM
does this method work for you if you do not use bluesoleil?
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: ZaPPZion on January 17, 2008, 02:26:47 AM
Unfortunately i don't have my wiimote at home (left it at a friends place), but I hope I can try it tonight. Going to school right now as well. Anyway, hope you find a solution soon, since i know how annoying it is when stuff doesnt work like it's supposed to do. On top of that, bluetooth should be a standard by now, and everything should just be able to connect. Apperently it's hard to keep things work with the protocol for some weird reason.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Thomas B. on January 19, 2008, 11:53:06 AM
You need to open the project with visual studio C# (2005 i think, 2008 works for me as well). Then edit the lines, and let it run (press f5) that should already work. So what you need to compile, is the project.
If you edit one of the .cs files, nothing gets changed when running the program from the .exe, because the .cs is just a source file, you can even delete the whole file without any changes to the .exe. So you'll need to download Visual Studio C# i guess.

Hi Bart, your fix got the Grid app working on my setup by:
1. Changing the code in WiimoteLib>Wiimote.cs file
2. Running the app by opening WiiMultipointGrid.csproj in Visual C# 2008 and pressing F5

I've scared my wife as I was controlling the grid by moving lighters in mid-air, great fun  ;D.

However, I can't seem to achieve this for the Whiteboard app (which is the one I'm really interested in).
1. I changed the code in WiimoteWhiteboard\source\WiimoteLib\Wiimote.cs
2. Which file should I open in Visual C# 2008 and press F5 to get the app to work? The various ones I tried always crashed at the end of calibration.

I know very little about programming but assumed that if I can get the grid to work there's not reason why the whiteboard should resist me :).

Thanks for your help, and thanks to Johnny for a fantastic idea!
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on January 19, 2008, 11:56:54 AM
the crash at the end of calibration is a cross thread call. in the wiimote.cs add this to your main form constructor

Code: [Select]
CheckForIllegalCrossThreadCalls = false;
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Thomas B. on January 19, 2008, 12:00:04 PM
the crash at the end of calibration is a cross thread call.

Indeed, that's what it said.


in the wiimote.cs add this to your main form constructor

Code: [Select]
CheckForIllegalCrossThreadCalls = false;

*newbie blushes* I don't know what my main form constructor is and where it is, but I'm willing to learn!
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on January 19, 2008, 12:05:03 PM
nah man, dont be affraid to ask, thats how you learn.

I have changed the name on mine but it will be after the initialization of the mutex so start at the top and hit control-f for search then type Mutex and hit enter.

the next few lines should contain it.

for example mine looks like this

Code: [Select]
public frmMain()
its going to have the same name as your class (hence it being a constructor) so you alternatively can go to the top and where it says

Code: [Select]
public partial class frmMain : Form
you can see the name of it and find it below.

good luck!
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Thomas B. on January 19, 2008, 12:38:24 PM
Awesome, you just made my day! It works, well, I'll play a bit with hardware now (I did the calibration with a LazerTag IR toy gun).
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on January 19, 2008, 12:40:09 PM
HAHAHAH, that has to be one of the coolest implementations i have heard of yet

i knew i could justify getting laser tag again somehow, haha
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Thomas B. on January 20, 2008, 04:29:58 PM
HAHAHAH, that has to be one of the coolest implementations i have heard of yet

I've tried it with Paint and Photoshop , it's kinda like virtual paintball :). Very virtual as a matter of fact as I'm doing it without a projector (I just measured stuff on the wall and checked what I was doing with the laptop screen). Anyway, it's kinda off topic now.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: paul.urban on January 21, 2008, 02:16:52 AM
I experienced the same issue as the original post: test app distributed with the lib worked, but the whiteboard app (and possibly others) fails to launch and asks if the Wiimote is connected.

Hardware: HP Compaq 6720S laptop running Windows Vista.

I can confirm that the code fix mentioned in the original post solved the issue.
Many thanks atomriot!

Interestingly, on my Dell Latitude D800 laptop running Windows 2000, the whiteboard app runs just fine unmodified.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: techie on February 08, 2008, 05:17:33 PM
This info seems to be repeated in other threads but I wanted to add my 2cents here. I bought a $39 USBBT dongle while waiting for the elcheapo I bought online from china. I fought day and night to get the expensive one to work. The elcheapo arrived and it works every time, right away. I paid about $2 for it. Now, I am working on a stylus that runs on 2 aa batteries and will have a red pointer on a second button as well as the IR on the first button.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: harry20larry on February 18, 2008, 08:21:38 AM
can someone upload the wiimote.cs file modified to work without blue soleil. I don't have visual + and am not very good at modifying things like this. I was wondering if someone could upload this file or all files need to rapidshare.
Thanks,
harry
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on February 18, 2008, 08:28:36 AM
if you dont have visual studio (express or full version) then just having the file will do you no good. you will need that code compiled into the application.

Visual Studio Express is a free download and really easy to use if you have all the source and step by step of what to change.

I know many great coders who didnt initially start out with any interest in coding or computers, all it took was that first little nudge.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: fab on March 03, 2008, 10:35:23 AM
Hey,
i had the same problem atomriot described. when i changed the code in the multipointgrid app it worked fine!
so after that i tried it on the desktopvr app (which is the one i actually want to test). But it cant compile it! there is some error with direct 3d i think :S  (the line is "Application.DoEvents();")
Maybe im doing something wrong or its because im using the 2008 C# edition who knows

anyways the fixed exe someone posted here doesnt work either... so first thing i wanna ask is does this fixed exe work for everyone else? because then i guess its just my **LOVE** laptop

...but maybe this exe is somehow broken :) and someone could compile a working desktopvr with atomriots fix in it
thatd be really cool!

so thanks for your help
fabian

*what the f u c k im being censored?? i guess im not used to writing in forums :/... what i wanted to say was s h i t laptop
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on March 03, 2008, 11:05:35 AM
Application.DoEvents() is built into the system.core i believe but if you have problems with that then your LOVE laptop has other issues.

it is basically a command that pumps the systems messages for that app so others can get processed in the correct order. I would venture to guess you dont have the direct x sdk installed?

I dont without actually seeing the error that you got.  ;)
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: fab on March 12, 2008, 08:44:00 AM
Well it seems like the error only springs up when the application actually manages to connect to my wiimote. otherwise it just displays the "cant find wiimote" message.

correct i dont have the sdk :)
but i just installed the newest DirectX Runtimes

the error is an invalidcallexception... :/
and in case this helps: if the remote isnt connected i get a different error and some message with fishtank. although actually the formulation in the messages seems pretty random to me.... i know 3 different ones up to now ;) anyways when the remote is connected it says "error reading data from wiimote"

couldnt you compile a working exe for me? or would i get the errors then as well?

thanks for the help
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: atomriot on March 12, 2008, 09:27:45 AM
i do believe they require the actual sdk not just the runtimes. if i were to compile the app and you ran it, you would see the same errors
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: thex on June 04, 2008, 04:19:54 AM
ok, i got all of johnnys apps working with the trick!

you need:
- Visual studio or C# express
- Sourcecode from johnny
- Directx SDK installed

what you do:
- open up the .sln with visual studio
- edit the code as shown in the first post

it should run then (press green play button)

if you want to run the exe you have to go to the bin/debug/ directory, there you can also edit the config file.

thex
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: TokyoShoe on June 19, 2008, 08:43:48 AM
I'm trying to get any Wiimote app working, but at present I seem to be stuck looking for drivers for Vista Device Manager.. for the Wiimote itself. It's currently listed as "Bluetooth HID Joystick" or something similar, and all the Wiimote apps say "Wii Remote not found in HID Device List".

Can anyone point me to Vista device drivers I can install.. for a Wiimote?
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: PRUSER on June 30, 2008, 12:50:16 AM
Hey everyone, first time poster. I am obsessing about making this white board work. I have Windows XP home, and HP dongle. I am not getting my wiimote to be recognized in anyway, I am not using any other program beside the software that it came with. When I try to search for devices it comes up with an error saying that the search could not begin. I downloaded C# and edited the codes like in the first post, except I cannot find anything called "mutex" or where id put the code with the main form constructor. Atomriot I need your expertise please, what else can I try to get this working?

Thank you.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: benpaddlejones on June 30, 2008, 02:05:22 AM
Pruser
Firstly save alot of coding time use Boongin's Whiteboard application has this fix, many more and some really awesome mods!
http://www.boonjin.com/wp/ (http://www.boonjin.com/wp/)

Secondly, need more detail on the Bluetooth issue:
a) Can it connect other Bluetooth devices (mobile phone etc)
b) Dongle Manufacturer
c) Software Manufacturer
d) Connection sequence (steps you are using)

Thirdly try connecting holding buttons 1 & 2 until application has been started.

Benpaddlejones :-)

Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: PRUSER on June 30, 2008, 08:52:35 AM
 Dongle is HP BT 500,  software is what came in the box with the dongle its a menu that has my device, add device, neighborhood, and find devices. None of those buttons or folders seem to work, each says the searching cannot begin. In the bluetooth places, It will recognize the HP when it is in a usb slot. But it does not want to do anything like search or connect. The wii cannot be found because my  dongle isnt working right. Could it be that my usb ports are too old or something? why would it be recognized but not work? When I try to use Bluesoliel it cannot find anything.

thanks  for your reply, and the link boonhjin will be amazing once I can  connect.
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: benpaddlejones on July 01, 2008, 01:33:46 AM
Dongle is HP BT 500,  software is what came in the box with the dongle its a menu that has my device, add device, neighborhood, and find devices. None of those buttons or folders seem to work, each says the searching cannot begin. In the bluetooth places, It will recognize the HP when it is in a usb slot. But it does not want to do anything like search or connect. The wii cannot be found because my  dongle isnt working right. Could it be that my usb ports are too old or something? why would it be recognized but not work? When I try to use Bluesoliel it cannot find anything.

thanks  for your reply, and the link boonhjin will be amazing once I can  connect.

I will respond in your own topic. (watch for multiple postings it upsets the forum gods)!

Benpaddlejones
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: thedidge on July 31, 2008, 08:33:51 AM
Hi guys,

Im hoping m problem is an easy one.

I can connect to my wii remote, and use it perfectly in GlovePie.

When i try to connect using wiidesktopvr.exe it says it cant connect. I have tried editing the wiimote.cs but it comes up with several errors. Im not a programmer so have no idea what to do.

Also i cant fine the wiimote test app which alot of people have made refrence to.

I am using a Belking BT adaptor with the Belkin Application.
Again, i can use it perfectly in GlovePie but DesktopVR just wont connect to it.

Can someone please post an idiots guide to getting this to work.

Many thanks
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: benpaddlejones on July 31, 2008, 06:25:59 PM
thedidge
If connects & Glovepie works, not a bluetooth problem.

I suggest you post a new topic requesting help in the most applicable support thread on the forum.

Include as much detail as possible so users can provide support.

Benpaddlejones
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: JTPaintball on September 03, 2008, 04:13:08 PM
I'm about to buy a USB Bluetooth dongle but I don't know which on would be the best for the Wiimote. I was looking on dealextreme.com a lot. Does anybody know which is the best for the wiimote?

Thanks!!
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: benpaddlejones on September 03, 2008, 05:37:19 PM
JTpaintball
http://www.wiili.org/index.php/Compatible_Bluetooth_Devices (http://www.wiili.org/index.php/Compatible_Bluetooth_Devices)

Goodluck

Benpaddlejones :)
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Rayq9 on October 26, 2008, 04:10:24 PM
I changed the code as suggested and it really was the problem so thanks a lot. :)
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: wiibrown on February 13, 2009, 03:32:45 PM
For those wanting this fix in compiled form for Wiimote DesktopVR, check out this post: http://www.wiimoteproject.com/wiimote-desktopvr/several-fixes-combined-into-one/ (http://www.wiimoteproject.com/wiimote-desktopvr/several-fixes-combined-into-one/)
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: danyruz on January 19, 2010, 06:20:32 PM
Hi,

I'm a newbee in this, with limited develompent knowlage.
for some reason i can't make the whitebord or any other Johnnylee app's to work.
i always get the message "error reading from wiimote...is it connected?"
i tried to use the solution by "atomriot" in changing the code of the Wiimote.cs but it's still showing me the same error.
for a while i manage to work the wiimoteTest.exe (from codeplex) and the white board was working as well, but then when i tried again both of them stopped working
i still manage to get the wiimoteConnect-0.6 to work with no problems, even the autoconnect works just fine.

i'm using windows XP, SP3, .net3.5
the BT is a dungle made in china (no details what so ever on that...) and i'm using the regular windows defoult BT stack.
btw it works just fine with wiiflash
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: danyruz on January 19, 2010, 07:19:53 PM
geee....i'm so silly sometimes
i restarted the wiimote again, take the batteries out and place them back again, and it all workd just fine
atomriot, your selution is simply working!!!
thanks and sorry
Title: Re: I cant get my *insert Johnnys app name here* to connect Help!
Post by: Cagey on August 26, 2010, 06:22:15 PM
Is there somebody with enough love in their hearts to post a completely compiled version of JCL's original file that doesn't require BlueSoleil and will run on a Vista machine (or at least in compatibility mods)?I can get the Wiimote to work in every one of the other programs (Whiteboard, Desktop VR2, Connect) but this one seems to be giving me trouble. I'm used to Java and Python coding where compiling isn't quite as complex, this sort of thing honestly confuses the hell out of me. If I had more time I would ask for more specific directions, but I'd really like to just see the real deal in a nice .zip.

Many thanks!