summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-14 19:25:13 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-14 19:25:13 +0000
commit80a65a9f52450a504d52836b23976afe9d230b25 (patch)
treeed68c80986f55070f7c202d7213f49b5d3c30721 /lib
parenta2b6f8584ac687ab2f3ca2cd5404f4fd0c5cdfe4 (diff)
downloaddrakx-net-80a65a9f52450a504d52836b23976afe9d230b25.tar
drakx-net-80a65a9f52450a504d52836b23976afe9d230b25.tar.gz
drakx-net-80a65a9f52450a504d52836b23976afe9d230b25.tar.bz2
drakx-net-80a65a9f52450a504d52836b23976afe9d230b25.tar.xz
drakx-net-80a65a9f52450a504d52836b23976afe9d230b25.zip
do not enter PIN multiple times in gcom (to prevent wrong PIN from being entered and SIM card to be locked)
Diffstat (limited to 'lib')
-rw-r--r--lib/network/connection/cellular_card.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm
index 084e22c..31429d1 100644
--- a/lib/network/connection/cellular_card.pm
+++ b/lib/network/connection/cellular_card.pm
@@ -159,6 +159,8 @@ sub check_hardware {
my $pid = IPC::Open2::open2(my $cmd_out, my $cmd_in, "gcom", "-d", $self->get_tty_device);
common::nonblock($cmd_out);
my $selector = IO::Select->new($cmd_out);
+ my $already_entered_pin;
+
while ($selector->can_read) {
local $_;
my $rv = sysread($cmd_out, $_, 512);
@@ -168,6 +170,11 @@ sub check_hardware {
last;
} elsif (/^Enter PIN number:/m) {
$self->{hardware}{pin} or last;
+ if ($already_entered_pin) {
+ $self->{hardware}{error} = translate($wrong_pin_error);
+ last;
+ }
+ $already_entered_pin = 1;
print $cmd_in $self->{hardware}{pin} . "\n";
} elsif (/^ERROR entering PIN/m) {
$self->{hardware}{error} = N("You entered a wrong PIN code.