[CWiid] Topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/topic/2 <p> wiimote discovering problem </p> en-us CWiid http://abstrakraft.org/cwiid/chrome/site/cwiid_banner.png http://abstrakraft.org/cwiid/discussion/topic/2 Trac 0.11.7 - DiscussionPlugin valdar Fri, 16 Mar 2007 01:39:23 GMT Topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/topic/2#topic http://abstrakraft.org/cwiid/discussion/topic/2#topic <p> Both wmgui and wmimput can't discover my wiimote automatically; in order to make they work i have to provide wiimote bluetooth adres as argument to both commands. </p> <p> Is it a know issue? Or do you need more information to figure out the problem? </p> <p> Thank you in advance. Valdar. </p> Topic dsmith Sun, 29 Apr 2007 15:32:19 GMT Reply #106 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/106#message106 http://abstrakraft.org/cwiid/discussion/message/106#message106 <p> Did you try the strerror() part? That'll tell us why the connect call is failing. </p> Message danomatika Tue, 24 Apr 2007 13:27:39 GMT Reply #99 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/99#message99 http://abstrakraft.org/cwiid/discussion/message/99#message99 <p> I do indeed have L2cap: </p> <pre class="wiki">$ lsmod | grep l2cap l2cap 26112 5 rfcomm bluetooth 57444 7 rfcomm,l2cap,hci_usb </pre><p> I'm using a stock Ubuntu kernel. </p> Message dsmith Tue, 24 Apr 2007 03:24:31 GMT Reply #98 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/98#message98 http://abstrakraft.org/cwiid/discussion/message/98#message98 <p> Add </p> <pre class="wiki">printf("%s\n", strerror()); </pre><p> right after the error in cwiid/libcwiid/connect.c, post the output. </p> <p> Do you have L2Cap protocol enabled in your kernel? </p> Message danomatika Mon, 23 Apr 2007 23:34:28 GMT Reply #97 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/97#message97 http://abstrakraft.org/cwiid/discussion/message/97#message97 <p> I've tried the latest svn and still the same error .. it must be something in my bluez. </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;cwiid.h&gt; using namespace std; void callback(int id, int mesg_count, union cwiid_mesg* mesg[]) { if(mesg_count &gt; 0) printf("recieved mesg\n"); } int main() { wiimote *wi_mote; bdaddr_t *wi_addr; char str_addr[18]; str2ba("00:19:1D:6F:7D:1E", wi_addr); ba2str(wi_addr, str_addr); printf("Wiimote addr : %s\n", str_addr); if((wi_mote = cwiid_connect(wi_addr, &amp;callback, NULL)) == NULL) printf("Connection Error\n"); return 0; } </pre><p> once again: $ lswm -al Put Bluetooth devices in discoverable mode now... 00:19:1D:C2:E6:C4 0x002504 Nintendo RVL-CNT-01 </p> Message dsmith Thu, 12 Apr 2007 14:19:28 GMT Reply #94 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/94#message94 http://abstrakraft.org/cwiid/discussion/message/94#message94 <p> discussion moved to <a class="assigned ticket" href="/cwiid/ticket/31" title="defect: BlueZ connection timing issues (assigned)">#31</a> </p> Message dsmith Sat, 07 Apr 2007 13:25:56 GMT Reply #77 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/77#message77 http://abstrakraft.org/cwiid/discussion/message/77#message77 <p> I'm at a loss, and I can't reproduce the error. Is anyone who can reproduce the error willing to dig into the wiimote library to figure out what's going on? I can provide guidance over email, phone, IM (IM preferred). </p> <p> Concerning the compile error, are you using a C++ compiler? class is a reserved word in C++, I changed it to btclass, it's checked into svn. </p> Message danomatika Sat, 07 Apr 2007 03:32:23 GMT Reply #76 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/76#message76 http://abstrakraft.org/cwiid/discussion/message/76#message76 <p> ok, using the latest svn ... </p> <p> $ lswm -al Put Bluetooth devices in discoverable mode now... 00:19:1D:C2:E6:C4 0x002504 Nintendo RVL-CNT-01 </p> <p> I also now get some compile errors when I try my example code from before: </p> <p> Line 224 in wimote.h : "uint8_t class<a class="missing changeset" title="No changeset 3 in the repository">[3]</a>;" </p> <p> More Info: </p> <p> /usr/include/wiimote.h:224: error: expected identifier before ‘[’ token /usr/include/wiimote.h:224: error: expected unqualified-id before ‘[’ token :: === Build finished: 2 errors, 0 warnings === </p> Message dsmith Mon, 02 Apr 2007 10:42:55 GMT Reply #48 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/48#message48 http://abstrakraft.org/cwiid/discussion/message/48#message48 <p> Can you post the output of 'lswm -al' (as noted above, download the svn sources for lswm)? </p> Message Heavybell Mon, 02 Apr 2007 09:51:17 GMT Reply #47 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/47#message47 http://abstrakraft.org/cwiid/discussion/message/47#message47 <p> I'd just like to say that neither wminput nor wmgui automatically find my Wiimotes either. My PC only has the one bluetooth interface, also; a USB dongle which happens to include an unused IR module. </p> Message dsmith Sun, 01 Apr 2007 22:10:03 GMT Reply #40 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/40#message40 http://abstrakraft.org/cwiid/discussion/message/40#message40 <p> Ok - after going through the BlueZ code, it looks like the batostr and strtoba functions leave out a baswap call, so use ba2str and str2ba instead. (according to the BlueZ dev list, this is the desired behavior, although no explanation is given). </p> <p> I've also changed the wiimote_connect prototype slightly so that it takes a pointer to bdaddr_t, this is more in-line with all of the BlueZ functions, and more efficient anyway. And I've corrected the comment in wmdemo that may have led you to use batostr in the first place. </p> <p> The following revision of your code works for me (that is, it exits without printing an error): </p> <pre class="wiki">#include &lt;stdio.h&gt; #include "wiimote.h" void callback(int id, int mesg_count, union wiimote_mesg* mesg[]) { if(mesg_count &gt; 0) printf("recieved mesg\n"); } int main() { wiimote_t *wi_mote; bdaddr_t wi_addr; char str_addr[18]; str2ba("00:19:1D:6F:7D:1E", &amp;wi_addr); ba2str(&amp;wi_addr, str_addr); printf("Wiimote addr : %s\n", str_addr); if((wi_mote = wiimote_connect(&amp;wi_addr, &amp;callback, NULL)) == NULL) printf("Connection Error\n"); return 0; } </pre><p> If you're still having problems, post the output of 'lswm -al' (you'll need to download the svn source for the lswm utility). </p> Message valdar Wed, 28 Mar 2007 06:28:24 GMT Reply #38 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/38#message38 http://abstrakraft.org/cwiid/discussion/message/38#message38 <p> I have try your example code: </p> <pre class="wiki">[valdar@nathan cwiid]$ gcc -I/usr/include/ -c example.c [valdar@nathan cwiid]$ gcc -lwiimote -oexample example.o [valdar@nathan cwiid]$ ./example Wiimote addr : 00:19:1D:93:AC:5B Error opening control channel Connection Error </pre><p> and wmdemo (in 2 quick execution follow one another with wiimote in discover mode since the first command): </p> <pre class="wiki">[valdar@nathan wmdemo]$ ./wmdemo 00:19:1D:93:AC:5B Put Wiimote in discoverable mode now (press 1+2)... 0:Unable to find wiimote Unable to connect to wiimote [valdar@nathan wmdemo]$ ./wmdemo 00:19:1D:93:AC:5B Put Wiimote in discoverable mode now (press 1+2)... 0:Error opening control channel Unable to connect to wiimote </pre><p> while wminput: </p> <pre class="wiki">[valdar@nathan wmdemo]$ wminput 00:19:1D:93:AC:5B Put Wiimote in discoverable mode now (press 1+2)... Ready. </pre><p> <strong>Why with wminput it works and with those 2 simple programs doesn't? I think that this is the main point of the problem.</strong> </p> <p> This is my lsusb: </p> <pre class="wiki">[valdar@nathan cwiid]$ lsusb Bus 002 Device 005: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter . . . </pre><p> and this my bluez-lib version: </p> <pre class="wiki">[valdar@nathan ~]$ pacman -Q bluez-libs bluez-libs 3.7 </pre><p> I hope this is useful. </p> Message dsmith Tue, 27 Mar 2007 04:06:49 GMT Reply #34 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/34#message34 http://abstrakraft.org/cwiid/discussion/message/34#message34 <p> hmmmm...do you have more than one bluetooth interface, by chance? Your code looks good, I'm leaning towards a hardware or bluez problem (which would include a bad bluez invocation on my part). </p> Message danomatika Fri, 23 Mar 2007 12:04:27 GMT Reply #29 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/29#message29 http://abstrakraft.org/cwiid/discussion/message/29#message29 <p> (some of the linebreaks didn't make it into the post above :P) </p> <p> Ok, another note: </p> <p> $ ./wmdemo 00:19:1D:C2:E6:C4 </p> <p> Put Wiimote in discoverable mode now (press 1+2)... 0:Error opening control channel Unable to connect to wiimote </p> <p> and </p> <p> $ ./wmdemo </p> <p> Put Wiimote in discoverable mode now (press 1+2)... -1:Error reading device name 0:Unable to find wiimote Unable to connect to wiimote </p> Message danomatika Fri, 23 Mar 2007 11:57:06 GMT Reply #28 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/28#message28 http://abstrakraft.org/cwiid/discussion/message/28#message28 <p> No Wii's here. </p> <p> Well, what dosen't work is specifying the address in my test C code: </p> <p> /**** BEGIN ****/ </p> <p> #include &lt;stdio.h&gt; </p> <p> #include "wiimote.h" </p> <p> void callback(int id, int mesg_count, union wiimote_mesg* mesg[]) { </p> <blockquote> <p> if(mesg_count &gt; 0) </p> <blockquote> <p> printf("recieved mesg\n"); </p> </blockquote> </blockquote> <p> } </p> <p> int main() { </p> <blockquote> <p> wiimote_t *wi_mote; bdaddr_t *wi_addr; </p> </blockquote> <blockquote> <p> wi_addr = strtoba("00:19:1D:C2:E6:C4"); printf("Wiimote addr : %s\n", batostr(wi_addr)); </p> </blockquote> <blockquote> <p> if((wi_mote = wiimote_connect(*wi_addr, &amp;callback, NULL)) == NULL) </p> <blockquote> <p> printf("Connection Error\n"); </p> </blockquote> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> /**** End ****/ </p> <p> I always get the "Error opening control channel" error when wiimote_connect fails. It's just a very simple test to get started and mabey I'm missing something in the api? </p> Message danomatika Fri, 23 Mar 2007 11:51:37 GMT Reply #27 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/27#message27 http://abstrakraft.org/cwiid/discussion/message/27#message27 <p> yeah, I just tried that and it works. </p> Message dsmith Thu, 22 Mar 2007 12:50:51 GMT Reply #26 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/26#message26 http://abstrakraft.org/cwiid/discussion/message/26#message26 <p> I misunderstood - from your previous message, I thought you had to specify the address, but it was otherwise working fine. </p> <p> First step: make sure the wiimote isn't connected to something else, like a Wii. </p> Message valdar Thu, 22 Mar 2007 12:47:25 GMT Reply #25 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/25#message25 http://abstrakraft.org/cwiid/discussion/message/25#message25 <p> but if you use wminput 00:19:1D:C2:E6:C4 doesn't it work? </p> Message danomatika Thu, 22 Mar 2007 11:25:08 GMT Reply #24 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/24#message24 http://abstrakraft.org/cwiid/discussion/message/24#message24 <p> ... but before I do anything, I have to be able to connect to the wiimote through libwiimote :P </p> <p> As of right now it always fails with "Error opening control channel." And I print out the bluetooth address I'm using just to make sure it's the right one :( </p> Message valdar Thu, 22 Mar 2007 10:30:25 GMT Reply #23 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/23#message23 http://abstrakraft.org/cwiid/discussion/message/23#message23 <p> Great! I'm interesting in wiimote+MIDI because i plan (with one friend) to write an application that convert wiimote gestures an command in MIDI command with jack support. If your thesis' will be open-source I would like to try your code. </p> Message danomatika Thu, 22 Mar 2007 00:10:52 GMT Reply #22 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/22#message22 http://abstrakraft.org/cwiid/discussion/message/22#message22 <p> I wouldn't say my thesis is based on cwiid ... but I do want to utilize a useful, hackable package like the wiimote on a free, useful, hackable OS aka Linux. </p> <p> Well, my thesis is basically a wearable computer running an algorithmic realtime agent that interacts/accompanies my midi guitar input. I'm hacking my wiimote into the midi guitar so I can shake it, use gestures, etc as well as hack another wiimote into a glove so, for example, I can scratch wavetable waveforms in realtime. </p> <p> Of course, I could do all this using a microcontroller + bluetooth module + accelerometer .... but a wiimote has all of these in one package that is cheaper then buying all of the above. </p> <p> If anyone comes up with a good gesture recognition system, I'd be interested as I'm more focused on building my music/performance algorithms right now. </p> Message valdar Wed, 21 Mar 2007 09:37:21 GMT Reply #19 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/19#message19 http://abstrakraft.org/cwiid/discussion/message/19#message19 <p> oh... Interesting: a thesis project based on cwiid! Can i ask you what type of thesis? Because i'would like to implement a gesture recognition plug-in for one of my exams (machine learning). </p> <p> Best regards. </p> Message danomatika Tue, 20 Mar 2007 16:14:01 GMT Reply #12 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/12#message12 http://abstrakraft.org/cwiid/discussion/message/12#message12 <p> I have the same problem ... wmgui works as long as I set the address </p> <p> I made a small connection program in C as I was looking through the api spec and whenever I try the connect function, it always fails with "Error opening control channel". </p> <p> The wmdemo app fails in the same manner and, after seeing this post, I am at least able to determine that wmgui can talk to my wiimote. </p> <p> "hcitool scan" yeilds : 00:19:1D:C2:E6:C4 Nintendo RVL-CNT-01 </p> <p> and "hcitool inq 00:19:1D:C2:E6:C4" yeilds: Inquiring ... </p> <blockquote> <p> 00:19:1D:C2:E6:C4 clock offset: 0x0564 class: 0x002504 </p> </blockquote> <p> I'm running Ubuntu 6.10 Edgy on my Thinkpad T-43, using the built in bluetooth adapter. </p> <p> Any help would be appreciated as I plan to use the libwiimote c api in my thesis project. </p> Message dsmith Tue, 20 Mar 2007 02:04:39 GMT Reply #8 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/8#message8 http://abstrakraft.org/cwiid/discussion/message/8#message8 <p> Yup - blaming it on BlueZ. </p> <p> The only other thing I can think of is if you have two bluetooth interfaces, and libwiimote is checking the wrong one. </p> <p> I'm working on a lswm utility - I can put a debug mode in it that lists all bluetooth devices rather than just wiimotes, which may shed some light on the issue. </p> Message valdar Tue, 20 Mar 2007 00:54:15 GMT Reply #7 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/7#message7 http://abstrakraft.org/cwiid/discussion/message/7#message7 <p> [root@nathan valdar]# hcitool inq 00:19:1D:93:AC:5B Inquiring ... </p> <blockquote> <p> 00:19:1D:93:AC:5B clock offset: 0x140a class: 0x002504 </p> </blockquote> Message dsmith Tue, 20 Mar 2007 00:23:18 GMT Reply #6 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/6#message6 http://abstrakraft.org/cwiid/discussion/message/6#message6 <p> No problem there. </p> <p> Post the result of 'hcitool inq 00:19:1D:93:AC:5B' </p> <p> If your class matches mine (0x002504), I'm blaming it on BlueZ. </p> Message valdar Mon, 19 Mar 2007 19:04:41 GMT Reply #5 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/5#message5 http://abstrakraft.org/cwiid/discussion/message/5#message5 <p> [root@nathan valdar]# hcitool scan Scanning ... </p> <blockquote> <p> 00:19:1D:93:AC:5B Nintendo RVL-CNT-01 </p> </blockquote> Message anonymous Fri, 16 Mar 2007 20:15:44 GMT Reply #3 to topic #2 - wiimote discovering problem http://abstrakraft.org/cwiid/discussion/message/3#message3 http://abstrakraft.org/cwiid/discussion/message/3#message3 <p> I know that several people have had to do exactly as you describe, but I don't know the cause. It just occurred to me that it may be a different device name - run 'hcitool scan' with your wiimote in discoverable mode, and post the output here. </p> Message