[CWiid] Topic #2 - wiimote discovering problem
http://abstrakraft.org/cwiid/discussion/topic/2
<p>
wiimote discovering problem
</p>
en-usCWiidhttp://abstrakraft.org/cwiid/chrome/site/cwiid_banner.png
http://abstrakraft.org/cwiid/discussion/topic/2
Trac 0.11.7 - DiscussionPluginvaldarFri, 16 Mar 2007 01:39:23 GMTTopic #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>
TopicdsmithSun, 29 Apr 2007 15:32:19 GMTReply #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>
MessagedanomatikaTue, 24 Apr 2007 13:27:39 GMTReply #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>
MessagedsmithTue, 24 Apr 2007 03:24:31 GMTReply #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>
MessagedanomatikaMon, 23 Apr 2007 23:34:28 GMTReply #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 <iostream>
#include <stdio.h>
#include <cwiid.h>
using namespace std;
void callback(int id, int mesg_count, union cwiid_mesg* mesg[])
{
if(mesg_count > 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, &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>
MessagedsmithThu, 12 Apr 2007 14:19:28 GMTReply #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>
MessagedsmithSat, 07 Apr 2007 13:25:56 GMTReply #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>
MessagedanomatikaSat, 07 Apr 2007 03:32:23 GMTReply #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>
MessagedsmithMon, 02 Apr 2007 10:42:55 GMTReply #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>
MessageHeavybellMon, 02 Apr 2007 09:51:17 GMTReply #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>
MessagedsmithSun, 01 Apr 2007 22:10:03 GMTReply #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 <stdio.h>
#include "wiimote.h"
void callback(int id, int mesg_count, union wiimote_mesg* mesg[]) {
if(mesg_count > 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", &wi_addr);
ba2str(&wi_addr, str_addr);
printf("Wiimote addr : %s\n", str_addr);
if((wi_mote = wiimote_connect(&wi_addr, &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>
MessagevaldarWed, 28 Mar 2007 06:28:24 GMTReply #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>
MessagedsmithTue, 27 Mar 2007 04:06:49 GMTReply #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>
MessagedanomatikaFri, 23 Mar 2007 12:04:27 GMTReply #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>
MessagedanomatikaFri, 23 Mar 2007 11:57:06 GMTReply #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 <stdio.h>
</p>
<p>
#include "wiimote.h"
</p>
<p>
void callback(int id, int mesg_count, union wiimote_mesg* mesg[])
{
</p>
<blockquote>
<p>
if(mesg_count > 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, &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>
MessagedanomatikaFri, 23 Mar 2007 11:51:37 GMTReply #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>
MessagedsmithThu, 22 Mar 2007 12:50:51 GMTReply #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>
MessagevaldarThu, 22 Mar 2007 12:47:25 GMTReply #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>
MessagedanomatikaThu, 22 Mar 2007 11:25:08 GMTReply #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>
MessagevaldarThu, 22 Mar 2007 10:30:25 GMTReply #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>
MessagedanomatikaThu, 22 Mar 2007 00:10:52 GMTReply #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>
MessagevaldarWed, 21 Mar 2007 09:37:21 GMTReply #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>
MessagedanomatikaTue, 20 Mar 2007 16:14:01 GMTReply #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>
MessagedsmithTue, 20 Mar 2007 02:04:39 GMTReply #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>
MessagevaldarTue, 20 Mar 2007 00:54:15 GMTReply #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>
MessagedsmithTue, 20 Mar 2007 00:23:18 GMTReply #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>
MessagevaldarMon, 19 Mar 2007 19:04:41 GMTReply #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>
MessageanonymousFri, 16 Mar 2007 20:15:44 GMTReply #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