ublox-config: Use libgpiod for sim switch

BugzID: 57325
This commit is contained in:
Alexandre Bard 2019-06-13 13:45:17 +02:00
parent 83ca2f3e10
commit f53a859d80
1 changed files with 3 additions and 11 deletions

View File

@ -12,14 +12,6 @@ SERIAL_DEV = '/dev/ttyACM0'
WWAN_DEV = '/sys/class/net/wwan0'
SIM_CONFIG = '/etc/sim.conf'
APN_CONFIG = '/etc/apn.conf'
GPIO_PATH = '/sys/class/gpio/'
GPIO_SIM_SW = '44'
APN_CONFIG = '/etc/apn.conf'
def write_to_file(file, value):
f = open(file, 'w')
f.write(value)
f.close()
def execute_and_check(ser, cmd):
tries = 0
@ -40,9 +32,9 @@ def execute_and_check(ser, cmd):
tries = 0
def switch_sim():
write_to_file(GPIO_PATH + 'export', GPIO_SIM_SW)
write_to_file(GPIO_PATH + 'gpio' + GPIO_SIM_SW + '/direction', 'out')
write_to_file(GPIO_PATH + 'gpio' + GPIO_SIM_SW + '/value', '0')
line = gpiod.find_line('SIM_SW')
line.request(consumer='ublox-config', type=gpiod.LINE_REQ_DIR_OUT)
line.set_value(0)
def sim_present(ser):
cmd = b'AT+CCID?'