linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Entering the PIN of a device?
@ 2012-02-14 16:45 Fabrice DELENTE
  2012-02-14 17:54 ` David Herrmann
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice DELENTE @ 2012-02-14 16:45 UTC (permalink / raw)
  To: linux-bluetooth

Hello.

I can't find a way to pair my wiimote with my computer.

I started simple-agent, and tried an rfcomm connection with

# rfcomm connect 1 $WIIMOTE

but I didn't get the prompt for the PIN key to establish the connection.

Is there a file or database somewhere where I can enter this number
manually, saving me some trouble?

I am on Slackware Linux, so I have no access to Gnome or KDE tools to
set up my Bluetooth connections. I succeded with pairing and sharing
files with my cell phone, but not with the wiimote; I have trouble
with a wireless headzset too...

Thanks.

-- 
F. Delente

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-14 16:45 Entering the PIN of a device? Fabrice DELENTE
@ 2012-02-14 17:54 ` David Herrmann
       [not found]   ` <20120214175813.GA16393@smtp.free.fr>
  0 siblings, 1 reply; 8+ messages in thread
From: David Herrmann @ 2012-02-14 17:54 UTC (permalink / raw)
  To: Fabrice DELENTE; +Cc: linux-bluetooth

Hi Fabrice

On Tue, Feb 14, 2012 at 5:45 PM, Fabrice DELENTE <delentef@gmail.com> wrote:
> Hello.
>
> I can't find a way to pair my wiimote with my computer.
>
> I started simple-agent, and tried an rfcomm connection with
>
> # rfcomm connect 1 $WIIMOTE
>
> but I didn't get the prompt for the PIN key to establish the connection.

The Wii Remote does not support RFCOMM connections. What are you
trying to do here? Furthermore, the Wii Remote expects a fixed PIN
which is generated by BlueZ automatically for you.

> Is there a file or database somewhere where I can enter this number
> manually, saving me some trouble?
>
> I am on Slackware Linux, so I have no access to Gnome or KDE tools to
> set up my Bluetooth connections. I succeded with pairing and sharing
> files with my cell phone, but not with the wiimote; I have trouble
> with a wireless headzset too...

You cannot share files with the Wii Remote. It simply does not support
this. The Wii Remote can only be used as input device. There is a
kernel driver which supports that.

> Thanks.
>
> --
> F. Delente

Regards
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
       [not found]     ` <CANq1E4Q7UQjQNKPy0c-w4DX8dimuRNYB_mOsetMBNPaY44Ae5A@mail.gmail.com>
@ 2012-02-14 18:09       ` Fabrice DELENTE
  2012-02-14 18:15         ` David Herrmann
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice DELENTE @ 2012-02-14 18:09 UTC (permalink / raw)
  To: linux-bluetooth

> Please answer directly to the mailing-list instead of directly to me
> ("Reply to All") if you want others to read your messages, too.

Sorry, I thought the CC to linux-bluetooth was enough!

> Then you need to use the kernel driver. The Wii Remote uses 2 L2CAP
> channels so don't try rfcomm.

Ok, I'll look into docs about L2CAP.

> The driver is located in ./drivers/hid/hid-wiimote* in the kernel
> sources. The user-space utilities are currently under
> development. See http://github.com/dvdhrm/xwiimote for more
> information.  To use the Wii Remote you need to connect to the Wii
> Remote with a tool like simple-agent, gnome-bluetooth, blueman or
> similar. The kernel driver and BlueZ stack will directly detect the
> Wii Remote. See "dmesg" for information whether the device was
> detected. It should also show up as new directory in
> /sys/bus/hid/devices/<did>

Thanks for the info.

My trouble is that when I start simple-agent and then push 1+2 to pair
the wiimote with my laptop, simple-agent doesn't ask for the
PIN... should it happens automagically?

I have grepped the files in /var/lib/bluetooth, I have found my mote
BT address in the files but nothing clearly linked to the PIN key. I
read on wiimote-brew that it was the mote BT address in binary form?

Thanks again! :^)

-- 
F. Delente

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-14 18:09       ` Fabrice DELENTE
@ 2012-02-14 18:15         ` David Herrmann
  2012-02-14 18:23           ` Fabrice DELENTE
  2012-02-14 22:47           ` Fabrice DELENTE
  0 siblings, 2 replies; 8+ messages in thread
From: David Herrmann @ 2012-02-14 18:15 UTC (permalink / raw)
  To: Fabrice DELENTE; +Cc: linux-bluetooth

Hi Fabrice

On Tue, Feb 14, 2012 at 7:09 PM, Fabrice DELENTE <delentef@gmail.com> wrote:
>> Please answer directly to the mailing-list instead of directly to me
>> ("Reply to All") if you want others to read your messages, too.
>
> Sorry, I thought the CC to linux-bluetooth was enough!

There was no CC ;) CC is enough of course.

>> Then you need to use the kernel driver. The Wii Remote uses 2 L2CAP
>> channels so don't try rfcomm.
>
> Ok, I'll look into docs about L2CAP.

No, don't! The user shouldn't care what protocols are used. I just wanted to
notify you that using rfcomm won't work here.

>> The driver is located in ./drivers/hid/hid-wiimote* in the kernel
>> sources. The user-space utilities are currently under
>> development. See http://github.com/dvdhrm/xwiimote for more
>> information.  To use the Wii Remote you need to connect to the Wii
>> Remote with a tool like simple-agent, gnome-bluetooth, blueman or
>> similar. The kernel driver and BlueZ stack will directly detect the
>> Wii Remote. See "dmesg" for information whether the device was
>> detected. It should also show up as new directory in
>> /sys/bus/hid/devices/<did>
>
> Thanks for the info.
>
> My trouble is that when I start simple-agent and then push 1+2 to pair
> the wiimote with my laptop, simple-agent doesn't ask for the
> PIN... should it happens automagically?

This is exactly what should happen, yes. No PIN as BlueZ generates it for you.

> I have grepped the files in /var/lib/bluetooth, I have found my mote
> BT address in the files but nothing clearly linked to the PIN key. I
> read on wiimote-brew that it was the mote BT address in binary form?

Did the device show up in /sys/bus/hid/devices ? Did you check dmesg? I think
you got the device connected successfully, it just doesn't do anything useful
without configuration ;)

> Thanks again! :^)

You may also want to have a look at
https://wiki.archlinux.org/index.php/XWiimote
This is a short summary of the current state of the xwiimote drivers.
The user-space
part is still under development so you might want to look at cwiid instead.

Cheers
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-14 18:15         ` David Herrmann
@ 2012-02-14 18:23           ` Fabrice DELENTE
  2012-02-14 22:47           ` Fabrice DELENTE
  1 sibling, 0 replies; 8+ messages in thread
From: Fabrice DELENTE @ 2012-02-14 18:23 UTC (permalink / raw)
  To: David Herrmann, linux-bluetooth

> There was no CC ;) CC is enough of course.

Strange, mutt showed me a CC though...

> No, don't! The user shouldn't care what protocols are used. I just
> wanted to notify you that using rfcomm won't work here.

Ok, ok, won't do :^)

> This is exactly what should happen, yes. No PIN as BlueZ generates
> it for you.

I guess it hasn't, because when I try simple-agent hci0 $WIIMOTE, it
asks for a PIN?

> Did the device show up in /sys/bus/hid/devices ? Did you check
> dmesg? I think you got the device connected successfully, it just
> doesn't do anything useful without configuration ;)

Well nothing showed in /sys/bus/hid/devices, nor in dmesg. The only
thing I had was in /var/log/messages, after trying the simple-agent
hci0 $WIIMOTE thing:

Feb 14 19:11:11 slick dbus-daemon: [system] Rejected send message, 0 matched rules; type="method_return", sender=":1.65" (uid=0 pid=17775 comm="/usr/bin/python) interface="(unset)" member="(unset)" error name="(unset)" requested_reply=0 destination=":1.9" (uid=0 pid=1930 comm="/usr/sbin/bluetoothd))

> You may also want to have a look at
> https://wiki.archlinux.org/index.php/XWiimote This is a short
> summary of the current state of the xwiimote drivers.  The
> user-space part is still under development so you might want to look
> at cwiid instead.

Will do. I thought cwiid was abandonned, and replaced by the kernel
driver?

Thanks again!

-- 
F. Delente

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-14 18:15         ` David Herrmann
  2012-02-14 18:23           ` Fabrice DELENTE
@ 2012-02-14 22:47           ` Fabrice DELENTE
  2012-02-15 11:16             ` David Herrmann
  1 sibling, 1 reply; 8+ messages in thread
From: Fabrice DELENTE @ 2012-02-14 22:47 UTC (permalink / raw)
  To: linux-bluetooth

> Did the device show up in /sys/bus/hid/devices ? Did you check
> dmesg? I think you got the device connected successfully, it just
> doesn't do anything useful without configuration ;)

My tests have been disappointing, I have the wiimote plugin in
bluetoothd (the grep for wiimote in bluetoothd shows a match), but
there is no auto-pairing...

If I have bluetoothd running, and I press 1+2 (or the red button),
nothing shows in dmesg, nor in /sys/bus/hid/devices...

If I press 1+2 and start simple-agent hci0 $WIIMOTE, I get a message
asking for the PIN, but I can't type it (I must type in the wiimote BT
addr in string form, right?)

I modified simple-agent with a bit of python to return the address in
UTF-8 form:

def RequestPinCode(self, device):
    print "RequestPinCode (%s)" % (device)
    wiimote_address_bytes = os.environ["WIIMOTE"].split(":")
    n = ""
    for i in range(len(wiimote_address_bytes)-1, -1, -1):
    	if int(wiimote_address_bytes[i], 16) == 0:
           break
	n += chr(int(wiimote_address_bytes[i], 16))
    return unicode(n, "utf-8")

but I still have an error:

# ./wiimote-agent hci0 $WIIMOTE
RequestPinCode (/org/bluez/5122/hci0/dev_00_1F_C5_1B_3A_B1)
Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected

Well... I'll try again after a good night sleep :^)

-- 
F. Delente

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-14 22:47           ` Fabrice DELENTE
@ 2012-02-15 11:16             ` David Herrmann
  2012-02-15 11:25               ` Fabrice DELENTE
  0 siblings, 1 reply; 8+ messages in thread
From: David Herrmann @ 2012-02-15 11:16 UTC (permalink / raw)
  To: Fabrice DELENTE; +Cc: linux-bluetooth

Hi Fabrice

On Tue, Feb 14, 2012 at 11:47 PM, Fabrice DELENTE <delentef@gmail.com> wrote:
>> Did the device show up in /sys/bus/hid/devices ? Did you check
>> dmesg? I think you got the device connected successfully, it just
>> doesn't do anything useful without configuration ;)
>
> My tests have been disappointing, I have the wiimote plugin in
> bluetoothd (the grep for wiimote in bluetoothd shows a match), but
> there is no auto-pairing...
>
> If I have bluetoothd running, and I press 1+2 (or the red button),
> nothing shows in dmesg, nor in /sys/bus/hid/devices...
>
> If I press 1+2 and start simple-agent hci0 $WIIMOTE, I get a message
> asking for the PIN, but I can't type it (I must type in the wiimote BT
> addr in string form, right?)

What? One mail earlier you said you are *not* asked for the PIN? If it
asks for the PIN then your Wii Remote isn't detected as a Wii Remote.
You cannot type the PIN as the PIN contains binary-0 characters which
cannot be entered here.

Earlier:
> My trouble is that when I start simple-agent and then push 1+2 to pair
> the wiimote with my laptop, simple-agent doesn't ask for the
> PIN... should it happens automagically?
>
> I have grepped the files in /var/lib/bluetooth, I have found my mote
> BT address in the files but nothing clearly linked to the PIN key. I
> read on wiimote-brew that it was the mote BT address in binary form?
> I modified simple-agent with a bit of python to return the address in
> UTF-8 form:

What do you find in these files? Especially the
/var/lib/bluetooth/<bt>/did files are interesting.

Also see: https://github.com/dvdhrm/xwiimote/issues/3

> def RequestPinCode(self, device):
>    print "RequestPinCode (%s)" % (device)
>    wiimote_address_bytes = os.environ["WIIMOTE"].split(":")
>    n = ""
>    for i in range(len(wiimote_address_bytes)-1, -1, -1):
>        if int(wiimote_address_bytes[i], 16) == 0:
>           break
>        n += chr(int(wiimote_address_bytes[i], 16))
>    return unicode(n, "utf-8")
>
> but I still have an error:
>
> # ./wiimote-agent hci0 $WIIMOTE
> RequestPinCode (/org/bluez/5122/hci0/dev_00_1F_C5_1B_3A_B1)
> Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected

Gnah, that doesn't work. You cannot send the binary PIN via dbus to
BlueZ, this is why we provide the wiimote-plugin.

Did you try this patch:
https://github.com/dvdhrm/xwiimote/issues/4#issuecomment-3302615
The Patch 1/2 isn't needed but 2/2 should fix the pairing issues with
any Wii Remote.

> Well... I'll try again after a good night sleep :^)
>
> --
> F. Delente

Cheers
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Entering the PIN of a device?
  2012-02-15 11:16             ` David Herrmann
@ 2012-02-15 11:25               ` Fabrice DELENTE
  0 siblings, 0 replies; 8+ messages in thread
From: Fabrice DELENTE @ 2012-02-15 11:25 UTC (permalink / raw)
  To: linux-bluetooth

> What? One mail earlier you said you are *not* asked for the PIN? If
> it asks for the PIN then your Wii Remote isn't detected as a Wii
> Remote.  You cannot type the PIN as the PIN contains binary-0
> characters which cannot be entered here.

Yeah, my bad, I tried simple-agent first without argument, but with
'simple-agent hci0 $WIIMOTE' I get asked for the PIN.

> What do you find in these files? Especially the
> /var/lib/bluetooth/<bt>/did files are interesting.

Here is /var/lib/bluetooth/<bt>/did:

# cat did
00:1F:C5:1B:3A:B1 FFFF 0000 0000 0000
00:18:91:D0:7A:24 FFFF 0000 0000 0000
6C:E9:07:43:A7:71 0001 0001 0119 0000

> Also see: https://github.com/dvdhrm/xwiimote/issues/3
> 
> Gnah, that doesn't work. You cannot send the binary PIN via dbus to
> BlueZ, this is why we provide the wiimote-plugin.

Ok :^) Didn't know that... too bad it doesn't work :^)

> Did you try this patch:
> https://github.com/dvdhrm/xwiimote/issues/4#issuecomment-3302615 The
> Patch 1/2 isn't needed but 2/2 should fix the pairing issues with
> any Wii Remote.

Ok, I'll try that this afternoon.

Thanks again!

-- 
F. Delente

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-15 11:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-14 16:45 Entering the PIN of a device? Fabrice DELENTE
2012-02-14 17:54 ` David Herrmann
     [not found]   ` <20120214175813.GA16393@smtp.free.fr>
     [not found]     ` <CANq1E4Q7UQjQNKPy0c-w4DX8dimuRNYB_mOsetMBNPaY44Ae5A@mail.gmail.com>
2012-02-14 18:09       ` Fabrice DELENTE
2012-02-14 18:15         ` David Herrmann
2012-02-14 18:23           ` Fabrice DELENTE
2012-02-14 22:47           ` Fabrice DELENTE
2012-02-15 11:16             ` David Herrmann
2012-02-15 11:25               ` Fabrice DELENTE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).