@ -112,18 +112,22 @@ def gps_enabled() -> bool:
def download_and_inject_assistance ( ) :
assist_data_file = ' /tmp/xtra3grc.bin '
assistance_url = ' http://xtrapath3.izatcloud.net/xtra3grc.bin '
try :
# download assistance
try :
c = pycurl . Curl ( )
c . setopt ( c . URL , assistance_url )
c . setopt ( c . NOBODY , 1 )
c . setopt ( pycurl . CONNECTTIMEOUT , 2 )
c . perform ( )
c . close ( )
bytes_n = c . getinfo ( c . CONTENT_LENGTH_DOWNLOAD )
c . close ( )
if bytes_n > 1e5 :
cloudlog . exception ( " Qcom assistance data larger than expected " )
cloudlog . error ( " Qcom assistance data larger than expected " )
return
with open ( assist_data_file , " wb " ) as fp :
with open ( assist_data_file , ' wb ' ) as fp :
c = pycurl . Curl ( )
c . setopt ( pycurl . URL , assistance_url )
c . setopt ( pycurl . CONNECTTIMEOUT , 5 )
@ -131,16 +135,28 @@ def download_and_inject_assistance():
c . setopt ( pycurl . WRITEDATA , fp )
c . perform ( )
c . close ( )
except pycurl . error as e :
cloudlog . exception ( f ' Failed to download assistance file with error: { e } ' )
if os . path . isfile ( assist_data_file ) :
except pycurl . error :
cloudlog . exception ( " Failed to download assistance file " )
return
# inject into module
try :
subprocess . check_call ( f " mmcli -m any --timeout 30 --location-inject-assistance-data= { assist_data_file } " , shell = True )
except subprocess . CalledProcessError :
cloudlog . exception ( " rawgps.mmcli_command_failed " )
if os . path . isfile ( assist_data_file ) :
cmd = f " mmcli -m any --timeout 30 --location-inject-assistance-data= { assist_data_file } "
subprocess . check_output ( cmd , stderr = subprocess . PIPE , shell = True )
cloudlog . info ( " successfully loaded assistance data " )
except subprocess . CalledProcessError as e :
cloudlog . event (
" rawgps.assistance_loading_failed " ,
error = True ,
cmd = e . cmd ,
output = e . output ,
returncode = e . returncode
)
finally :
if os . path . exists ( assist_data_file ) :
os . remove ( assist_data_file )
def setup_quectel ( diag : ModemDiag ) :
# enable OEMDRE in the NV
# TODO: it has to reboot for this to take effect