* [Bluez-devel] PIN requester
@ 2004-12-25 23:21 Balazs Fulop
0 siblings, 0 replies; only message in thread
From: Balazs Fulop @ 2004-12-25 23:21 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]
Dear BlueZ Developers!
My name is Fulop Balazs. I study at the Budapest University of
Technology and Economics.
As a Christmas present, I got a Bluetooth USB adapter yesterday. I
wanted to see it in action immediately so I booted up my Linux box
(running 2.4.28) and started to look for the necessary tools.
After some workaround I had a feeling that I was close to the solution
but something was wrong. I loaded the necessary modules, and I started
the required daemons. When I started gnokii, it connected to my mobile
phone, and I was asked to enter a PIN code on the phone. It did not
matter what I gave it, it did not work. The computer did not ask me to
give a code.
I knew I needed to specify the PIN, but I did not know how, because I
did not get any error messages about this. After a while I realised that
/usr/bin/bluepin is invoked in the situation. It is a Python script and
it imports the pygtk module which was not available on my machine. After
installing the python-gtk package on my Debian Woody, nothing changed.
I am not familiar with Python but I think it needs a Gtk 2.0 module
which is not available as a package for Debian Woody 3.0 r1. Because of
this I wrote a Perl-tk script to do the job and now it just works fine.
If you are interested in my solution, take a look at the attachment. It
is not a big deal, but I am quite proud of it. Moreover, if you would
like to include it in bluez-utils go right ahead. It is released under
GPL ;-)
I am not on the list, so please reply to admin@guardware.com. Sorry for
the long letter, and Merry Christmas to Everyone.
Hail,
Fulop Balazs
[-- Attachment #2: pincode --]
[-- Type: text/x-perl, Size: 1089 bytes --]
#!/usr/bin/perl -w
# PIN code requester
# Satisfies BlueZ requirements
# Written by Fulop Balazs <fb554@hszk.bme.hu>, 2004
use strict;
use Tk;
my $mainwin = new MainWindow ( -title => "Enter PIN", -borderwidth => 20 );
my $frame = $mainwin -> Frame ( -borderwidth => 5 );
$frame -> Label ( -text => "PIN:" ) -> pack ( -side => "left" );
my $pin = $frame -> Entry (
-justify => "center",
-validate => "key",
-validatecommand => \&check
) -> pack ( -side => "right" );
$pin -> bind ( "<Return>" => \&ok );
$pin -> bind ( "<Escape>" => \&cancel );
$pin -> focus;
$frame -> pack ( -side => "top" );
$mainwin -> Button ( -text => "Ok", -command => \&ok ) ->
pack ( -side => "left" );
$mainwin -> Button ( -text => "Cancel", -command => \&cancel ) ->
pack ( -side => "right" );
MainLoop;
sub check {
return 1 if ($_[1] =~ /[0-9]/);
return 0;
}
sub ok {
my $code = $pin -> get;
cancel () if ("" eq $code);
print "PIN:" . $code . "\n";
exit;
}
sub cancel {
print "ERR\n";
exit;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-12-25 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-25 23:21 [Bluez-devel] PIN requester Balazs Fulop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox