Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2009 16:25:35 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        maksim.yevmenkin@gmail.com
Cc:        freebsd-bluetooth@FreeBSD.org
Subject:   Re: Keyboard - how?
Message-ID:  <20091229.162535.190753344529111277.imp@bsdimp.com>
In-Reply-To: <bb4a86c70912291429j26da18aflc04d255b74da0954@mail.gmail.com>
References:  <20091227.111711.287595822663154592.imp@bsdimp.com> <1261940371.044739.879.nullmailer@galant.ukfsn.org> <bb4a86c70912291429j26da18aflc04d255b74da0954@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <bb4a86c70912291429j26da18aflc04d255b74da0954@mail.gmail.com>
            Maksim Yevmenkin <maksim.yevmenkin@gmail.com> writes:
: On Sun, Dec 27, 2009 at 10:59 AM, Iain Hibbert <plunky@rya-online.net> wrote:
: > On Sun, 27 Dec 2009, M. Warner Losh wrote:
: >
: >> In message: <1261935364.501662.751.nullmailer@galant.ukfsn.org>
: >>             Iain Hibbert <plunky@rya-online.net> writes:
: >> : - IMO the PIN should be ephemeral and use-once so when you are paired you
: >> :   should remove it from the config file or at least comment it out
: >>
: >> The whole pairing thing is kind of ugly atm in FreeBSD.  I used big
: >> hammers, I think, to make it work.  In other OSes, I just see what is
: >> discoverable, click a couple of times, maybe enter a PIN and I then
: >> promptly forget about it until I have to 'unpair'.
: >
: > I have had complaints about it in NetBSD too and while I think I improved
: > on Max's start it still needs further work and should be graphical. I'm
: > not sure about the whole dbus thing that BlueZ is moving to now though it
: > does work well as you say with the GNOME application. I thought about
: > working something lightweight up with (eg) tcl/tk but haven't got around
: > to it yet..
: 
: yep, the whole thing is "ugly" because pairing basically requires some
: form of (graphical) user interface. its an interactive process. i have
: a patch somewhere that teaches hcsecd(8) how to execute external
: program and pass requester and pin info back and forth. with this, one
: can use something like xdialog and get prompted when pairing is
: happening.

Exactly...  That would be cool.  Wanna pass them over to me?

: apple keyboard is not giving you any indication that  it wants
: pairing. basically, user supposed to follow instructions on screen --
: and it makes perfect sense. we don't have the luxury of uniform
: graphical user interface, so, you had to use "big hammers". i guess,
: it would be possible to write text based guided 'pair bluetooth
: device' tool, that would work together with hcsecd(8) and basically
: instruct it to do the pairing and then, on successful completion,
: update config/keys file.

Yes.  That's annoying, but enough googling showed me that others have
to do this on OS X even...

I wonder how hard that would be to write?

Is there any way to get the details of what devices hcsecd is
tracking?  In the IP world, things like ifconfig, arp, netstat -r, etc
show you the different aspects of the state of the device.  I don't
see anything equivalent in bluetooth land.  Did I miss them?

: >> : > Now, I guess the next step would be to find the bt mouse I have and
: >> : > try to get it going as well...
: >> :
: >> : that is probably fixed pin 0000 if not in the documentation
: >>
: >> Yes, it is :)  The default is to no pin, so it wasn't authenticating.
: >
: > Some devices that I noticed will only enforce the auth on making or
: > accepting the connection. Even the Linux stack used to do this (on the
: > accept path only) but I think they fixed it now.
: 
: i know for a fact that both apple mouse (older version) and apple
: keyboard (older version) work just fine with freebsd. be warned that
: bthidd(8) is not really tracking mouse buttons' state and relies on os
: to do so. bthidd(8) simply translates hid events into
: ioctl(CONS_MOUSECTL), i.e. things like double-click, etc. will not
: work in console, but will work in X.

Makes sense...

: [...]
: 
: >> btw, is there some way I can easily list the paired devices?
: >
: > 'easily' not really, but /var/db/hcsecd.keys should contain keys for all
: > paired devices. Actually, there can be more keys stored in the device
: > itself (if you paired with another OS that might happen or you can do it
: > manually). I think you can check/change/remove those with hccontrol but
: > must edit the hcsecd.keys file manually.
: 
: yes, edit /var/db/hcsecd.keys and hup/restart hcsecd(8)

How do I know what the key is for a given device?

BTW, after the big hammers, the newer apple keyboard and mouse (2008)
are working just fine[*] with my FreeBSD box and it they seem to wake
up better than OS X does (or maybe they just never go to sleep).  Is
there some way to find out what the battery level in these devices is?

Thanks a bunch...  If I had a phone that would do internet over ip,
that would be my next set of questions...

Warner

[*] the keyboard doesn't always register pressing the caps lock key
quite right.  I have it mapped to control and 10% of the time I get
the character instead of the control character (eg, a gets inserted in
emacs, rather than going to the start of the line).  But I had similar
issues under OS X on an old MacBook Pro I used to have...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091229.162535.190753344529111277.imp>