Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-14 Thread Donnie Smith

I don't think it'll make any difference, but try the latest SVN version.
Got a reply from the BlueZ folks, I think we may have found the problem,
although fixing it may be another matter.


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-12 Thread Petter Reinholdtsen
[Donnie Smith]
> Aha - progress!
> I actually commented 2 parts, now lets uncomment one of them and see what
> happens.

Still work with the hci_open_dev() in place and the call to get the
name commented out. :)

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-12 Thread Donnie Smith

Aha - progress!
I actually commented 2 parts, now lets uncomment one of them and see what
happens.
Donnie
Index: libcwiid/bluetooth.c
===
--- libcwiid/bluetooth.c(revision 83)
+++ libcwiid/bluetooth.c(working copy)
@@ -111,19 +112,21 @@
for (bdinfo_count=i=0; (i < dev_count) && (bdinfo_count < max_bdinfo);
 i++) {
/* timeout (5000) in milliseconds */
+   /*
if (hci_remote_name(sock, &dev_list[i].bdaddr, BT_NAME_LEN,
(*bdinfo)[bdinfo_count].name, 5000)) {
cwiid_err(NULL, "Error reading Bluetooth device name");
err = 1;
goto CODA;
}
+   */
/* Filter? */
if (!(flags & BT_NO_WIIMOTE_FILTER) &&
  ((dev_list[i].dev_class[0] != WIIMOTE_CLASS_0) ||
   (dev_list[i].dev_class[1] != WIIMOTE_CLASS_1) ||
-  (dev_list[i].dev_class[2] != WIIMOTE_CLASS_2) ||
+  (dev_list[i].dev_class[2] != WIIMOTE_CLASS_2))) { /*||
   (strncmp((*bdinfo)[bdinfo_count].name, WIIMOTE_NAME,
-   BT_NAME_LEN {
+   BT_NAME_LEN { */
continue;
}
bacpy(&(*bdinfo)[bdinfo_count].bdaddr, &dev_list[i].bdaddr);


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-11 Thread Petter Reinholdtsen
[Donnie Smith]
> Hthis is a tricky one.
> One other idea to try (attached).  Make sure you have no other bluetooth
> devices around.

With this patch in place, it seem to connect ever time.  I've tried 5
times so far.

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-11 Thread Donnie Smith

Hthis is a tricky one.
One other idea to try (attached).  Make sure you have no other bluetooth
devices around.
I've posted the question to the BlueZ-devel mailing list, hopefully someone
has come across something similar.

Donnie
Index: libcwiid/bluetooth.c
===
--- libcwiid/bluetooth.c(revision 83)
+++ libcwiid/bluetooth.c(working copy)
@@ -91,11 +91,12 @@
}
 
/* Open connection to Bluetooth Interface */
+   /*
if ((sock = hci_open_dev(dev_id)) == -1) {
cwiid_err(NULL, "Error opening Bluetooth interface");
err = 1;
goto CODA;
-   }
+   } */
 
/* Allocate info list */
if (max_bdinfo == -1) {
@@ -111,19 +112,21 @@
for (bdinfo_count=i=0; (i < dev_count) && (bdinfo_count < max_bdinfo);
 i++) {
/* timeout (5000) in milliseconds */
+   /*
if (hci_remote_name(sock, &dev_list[i].bdaddr, BT_NAME_LEN,
(*bdinfo)[bdinfo_count].name, 5000)) {
cwiid_err(NULL, "Error reading Bluetooth device name");
err = 1;
goto CODA;
}
+   */
/* Filter? */
if (!(flags & BT_NO_WIIMOTE_FILTER) &&
  ((dev_list[i].dev_class[0] != WIIMOTE_CLASS_0) ||
   (dev_list[i].dev_class[1] != WIIMOTE_CLASS_1) ||
-  (dev_list[i].dev_class[2] != WIIMOTE_CLASS_2) ||
+  (dev_list[i].dev_class[2] != WIIMOTE_CLASS_2))) { /*||
   (strncmp((*bdinfo)[bdinfo_count].name, WIIMOTE_NAME,
-   BT_NAME_LEN {
+   BT_NAME_LEN { */
continue;
}
bacpy(&(*bdinfo)[bdinfo_count].bdaddr, &dev_list[i].bdaddr);


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Petter Reinholdtsen
[Donnie Smith]
> Try this one.  I added an error message if the device socket doesn't close,
> and added a pause before the connect.  I'm thinking perhaps the device
> hasn't closed and cleaned up by the time wiimote_connect tries to connect to
> it.
> The addresses print out the same, so I'm thinking it might be the bluetooth
> device state.

No change.  I applied the change to the latest svn version, and this
was the output:

  [EMAIL PROTECTED]:~/src/wii-handset/cwiidsvn$ LD_LIBRARY_PATH=`pwd`/libcwiid/ 
./wmgui/wmgui
  found wiimote at 00:19:1D:C4:72:F8
  Error opening control channel
  [EMAIL PROTECTED]:~/src/wii-handset/cwiidsvn$

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Donnie Smith

Try this one.  I added an error message if the device socket doesn't close,
and added a pause before the connect.  I'm thinking perhaps the device
hasn't closed and cleaned up by the time wiimote_connect tries to connect to
it.
The addresses print out the same, so I'm thinking it might be the bluetooth
device state.

Donnie
Index: wiimote/bluetooth.c
===
--- wiimote/bluetooth.c (revision 81)
+++ wiimote/bluetooth.c (working copy)
@@ -108,7 +108,7 @@
for (wm_count=i=0; (i < dev_count) && (wm_count < max_wm); i++) {
/* timeout (5000) in milliseconds */
if (hci_remote_name(sock, &dev_list[i].bdaddr, BT_WM_NAME_LEN,
-   (*wm)[wm_count].name, 5000)) {
+   (*wm)[wm_count].name, 2000)) {
wiimote_err(NULL, "Error reading Bluetooth device 
name");
err = 1;
goto CODA;
@@ -141,7 +141,11 @@
 
 CODA:
if (dev_list) free(dev_list);
-   if (sock != -1) hci_close_dev(sock);
+   if (sock != -1) {
+   if (hci_close_dev(sock)) {
+   wiimote_err(NULL, "Error closing Bluetooth dev socket");
+   }
+   }
if (err) {
if (*wm) free(*wm);
ret = -1;
Index: wiimote/connect.c
===
--- wiimote/connect.c   (revision 81)
+++ wiimote/connect.c   (working copy)
@@ -53,6 +53,7 @@
 {
struct wiimote *wiimote = NULL;
struct sockaddr_l2 ctl_remote_addr, int_remote_addr;
+   char bd_str[18];
 
/* Allocate wiimote */
if ((wiimote = malloc(sizeof *wiimote)) == NULL) {
@@ -85,9 +86,12 @@
 
/* If BDADDR_ANY is given, find available wiimote */
if (bacmp(bdaddr, BDADDR_ANY) == 0) {
+   sleep(5);
if (wiimote_find_wiimote(bdaddr, 2)) {
goto ERR_HND;
}
+   ba2str(bdaddr, bd_str);
+   printf("found wiimote at %s\n", bd_str);
}
 
/* Clear address structs, fill address family, address, and ports */


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Petter Reinholdtsen
[Donnie Smith]
> The output should match the address you get from hci_tool and lswm.  I
> suspect it won't.

I applied this patch to the svn version:

Index: wiimote/connect.c
===
--- wiimote/connect.c   (revisjon 81)
+++ wiimote/connect.c   (arbeidskopi)
@@ -53,6 +53,7 @@
 {
struct wiimote *wiimote = NULL;
struct sockaddr_l2 ctl_remote_addr, int_remote_addr;
+   char bd_str[18];

/* Allocate wiimote */
if ((wiimote = malloc(sizeof *wiimote)) == NULL) {
@@ -86,8 +87,12 @@
/* If BDADDR_ANY is given, find available wiimote */
if (bacmp(bdaddr, BDADDR_ANY) == 0) {
if (wiimote_find_wiimote(bdaddr, 2)) {
+   ba2str(bdaddr, bd_str);
+   printf("failed to find wiimote at %s\n", bd_str);
goto ERR_HND;
}
+   ba2str(bdaddr, bd_str);
+   printf("found wiimote at %s\n", bd_str);
}

/* Clear address structs, fill address family, address, and ports */


Running the wmgui program, I got this output:

[EMAIL PROTECTED]:~/src/wii-handset/cwiidsvn$ 
LD_LIBRARY_PATH=/media/nuugdisk/perebackup/home/pere/src/wii-handset/cwiidsvn/wiimote
 ./wmgui/wmgui
found wiimote at 00:19:1D:C4:72:F8
Error opening control channel
[EMAIL PROTECTED]:~/src/wii-handset/cwiidsvn$ hcitool scan
pScanning ...
00:19:1D:C4:72:F8   Nintendo RVL-CNT-01
[EMAIL PROTECTED]:~/src/wii-handset/cwiidsvn$  


> Do you want to continue discussion on this forum, or move to
> http://abstrakraft.org/cwiid?  Whatever is more convenient for you.
> If we stay here, should I reply to you guys explicitly, or just the
> list?

I'm fine with staying here.  I need an explicit CC in addition to the
[EMAIL PROTECTED] address, as it is not forwared to me.

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Donnie Smith

First thing I want to see is the bluetooth address that it finds: in
cwiid/wiimote/connect.c (assuming 0.5.02), declare a char bd_str[18] in
wiimote_connect, then after line 85, add:
ba2str(&bdaddr, bd_str);
printf("found wiimote at %s\n", bd_str);

The output should match the address you get from hci_tool and lswm.  I
suspect it won't.
Apologies for any errors, I can verify code and create actual patches when I
get home tonight (I'm on US EDT).
Do you want to continue discussion on this forum, or move to
http://abstrakraft.org/cwiid?  Whatever is more convenient for you.  If we
stay here, should I reply to you guys explicitly, or just the list?

Donnie


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Romain Beauxis
Le mardi 10 avril 2007 17:39, Petter Reinholdtsen a écrit :
> [Donnie Smith]
>
> > Hello again, Petter.
> > This is a currently unsolved mystery experienced by a lot of people,
> > and unfortunately, I'm unable to duplicate it.  I'd be much obliged
> > if you could help me debug it.
>
> I'm happy to help debug it, but have no idea where to start.  I've
> done some initial testing, and found nothing obvious in the code.  The
> really strange part is that the same handset work with two other
> machines in my household, and arm machine and an IBM Thinkpad X40.
> But not on my X41. :/

Perhaps we have firstly to check wether this is a bug at cwiid level or at 
bluetooth level...


Romain



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Petter Reinholdtsen
[Donnie Smith]
> Hello again, Petter.
> This is a currently unsolved mystery experienced by a lot of people,
> and unfortunately, I'm unable to duplicate it.  I'd be much obliged
> if you could help me debug it.

I'm happy to help debug it, but have no idea where to start.  I've
done some initial testing, and found nothing obvious in the code.  The
really strange part is that the same handset work with two other
machines in my household, and arm machine and an IBM Thinkpad X40.
But not on my X41. :/

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Donnie Smith

Hello again, Petter.
This is a currently unsolved mystery experienced by a lot of people, and
unfortunately, I'm unable to duplicate it.  I'd be much obliged if you could
help me debug it.
Thanks,
Donnie


Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-10 Thread Romain Beauxis
Hi !

For this kind of bug report, you better submit to cwiid's main trac system..

However, cwiid's author is CCed in this mail..

Romain


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-08 Thread Petter Reinholdtsen
I just tried to connect to the wiimote using an arm machine I have
available (Linksys NSLU2).  This one was able to connect to the remote
without any problems.  Here is the output from this machine:

  slug:~# hcitool scan; hcitool inq 00:19:1D:C4:72:F8
  Scanning ...
  00:19:1D:C4:72:F8   Nintendo RVL-CNT-01
  Inquiring ...
  00:19:1D:C4:72:F8   clock offset: 0x6a2cclass: 0x002504
  slug:~#

This make me believe there is an endian issue.  Notice how the clock
offset value is different.  The Debian/arm port is as far as I know
little endian with big endian floating point numbers, while my laptop
is i386 with little endian floats as well.

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-08 Thread Petter Reinholdtsen
I tried the debugging steps described on the trac page, after fetching
the svn version of the source to get lswm.  Here is the output:

  % hcitool scan; hcitool inq 00:19:1D:C4:72:F8 ; LD_LIBRARY_PATH=../wiimote 
./lswm
  Scanning ...
  00:19:1D:C4:72:F8   Nintendo RVL-CNT-01
  Inquiring ...
  00:19:1D:C4:72:F8   clock offset: 0x286aclass: 0x002504
  Put Wiimotes in discoverable mode now (press 1+2)...
  00:19:1D:C4:72:F8
  %

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418221: wmgui: fail to autodetect my wii handset, "Error opening control channel"

2007-04-08 Thread Petter Reinholdtsen

Package: wmgui
Version: 0.5.02-1
Severity: important

I ran into a problem with wmgui and wminput with the package I rebuilt
for Debian/etch.  It fail to detect the Wii handset.  I have to give
the handset ID on the command line to get it to detect it.

With wmgui, I select File->Connect, press <1> and <2> on the handset
and  on the dialog, and then after a while, a popup dialog reports
[ "Error opening control channel" -  ].  I select , and a
nother dialog pop up with [ "Unable to connect" -  ].  If I start
the handset from the command line like 'wmgui ', it work.

With wminput, I get the same messages:

  [EMAIL PROTECTED]:~/src/cerebrum$ wminput
  Put Wiimote in discoverable mode now (press 1+2)...
  Error opening control channel
  unable to connect
  [EMAIL PROTECTED]:~/src/cerebrum$

I found the suggestion to add the handset ID on the command line in
http://abstrakraft.org/cwiid/discussion/1/2/34>, discussing this
exact problem.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=nb_NO.UTF-8, LC_CTYPE=nb_NO.UTF-8 (charmap=UTF-8)

Versions of packages wmgui depends on:
ii  libatk1.0-0 1.12.4-3 The ATK accessibility toolkit
ii  libbluetooth2   3.7-1Library to use the BlueZ Linux Blu
ii  libc6   2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libcairo2   1.2.4-4  The Cairo 2D vector graphics libra
ii  libfontconfig1  2.4.2-1.2generic font configuration library
ii  libglib2.0-02.12.4-2 The GLib library of C routines
ii  libgtk2.0-0 2.8.20-7 The GTK+ graphical user interface
ii  libpango1.0-0   1.14.8-5 Layout and rendering of internatio
ii  libwiimote0 0.5.02-2 library to interface with the wiim
ii  libx11-62:1.0.3-7X11 client-side library
ii  libxcursor1 1.1.7-4  X cursor management library
ii  libxext61:1.0.1-2X11 miscellaneous extension librar
ii  libxfixes3  1:4.0.1-5X11 miscellaneous 'fixes' extensio
ii  libxi6  1:1.0.1-4X11 Input extension library
ii  libxinerama11:1.0.1-4.1  X11 Xinerama extension library
ii  libxrandr2  2:1.1.0.2-5  X11 RandR extension library
ii  libxrender1 1:0.9.1-3X Rendering Extension client libra

wmgui recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]