sms_functions: improved PIN input handling
This commit is contained in:
parent
333eb0578c
commit
6cdfa96267
1 changed files with 5 additions and 4 deletions
|
@ -62,11 +62,12 @@ def unlock_sim(modem):
|
||||||
logger.info("Trying to unlock %s", sim_path)
|
logger.info("Trying to unlock %s", sim_path)
|
||||||
with SystemBus() as bus:
|
with SystemBus() as bus:
|
||||||
sim = bus.get('.ModemManager1', sim_path)
|
sim = bus.get('.ModemManager1', sim_path)
|
||||||
sim.SendPin(mypin, timeout=10000)
|
try:
|
||||||
props = modem.GetStatus()
|
sim.SendPin(mypin, timeout=10000)
|
||||||
if props and props['state'] == 2:
|
except GLib.Error as exc:
|
||||||
remaining_attempts = modem.UnlockRetries
|
remaining_attempts = modem.UnlockRetries
|
||||||
raise SIMError('Wrong PIN! Remaining attempts: {}'.format(remaining_attempts))
|
raise SIMError('Failed to unlock PIN, remaining attempts: {}'.format(remaining_attempts)) from exc
|
||||||
|
|
||||||
|
|
||||||
def send_sms(recipients, smsstring):
|
def send_sms(recipients, smsstring):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue