FreeCalypso > hg > freecalypso-tools
view rvinterf/etmsync/pirimei.c @ 497:74610c4f10f7
target-utils: added 10 ms delay at the end of abb_power_off()
The deosmification of the ABB access code (replacement of osmo_delay_ms()
bogus delays with correctly-timed ones, which are significantly shorter)
had one annoying side effect: when executing the poweroff command from
any of the programs, one last '=' prompt character was being sent (and
received by the x86 host) as the Calypso board powers off. With delays
being shorter now, the abb_power_off() function was returning and the
standalone program's main loop was printing its prompt before the Iota chip
fully executed the switch-off sequence!
I thought about inserting an endless tight loop at the end of the
abb_power_off() function, but the implemented solution of a 10 ms delay
is a little nicer IMO because if the DEVOFF operation doesn't happen for
some reason in a manual hacking scenario, there won't be an artificial
blocker in the form of a tight loop keeping us from further poking around.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 25 May 2019 20:44:05 +0000 |
parents | 3d148edb87c2 |
children | 6d9b10633f10 |
line wrap: on
line source
/* * Reading and decryption of Pirelli's factory IMEI record */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "cl_des.h" #include "exitcodes.h" u_char pirelli_imeisv[8]; get_pirelli_imei() { u_char ciphertext[2][8], dieid_key[8], decrypted[2][8]; int rc; static char failmsg[] = "decryption failed: no valid IMEI record or incompatible firmware\n"; printf("Requesting Calypso die ID\n"); rc = do_dieid_read(dieid_key); if (rc) return(rc); printf("Reading IMEI record in Pirelli's factory data block\n"); rc = do_memory_read(0x027F0504, ciphertext, 16); if (rc) return(rc); cl_des(ciphertext[0], dieid_key, decrypted[0], CL_DES_DECRYPTION); cl_des(ciphertext[1], dieid_key, decrypted[1], CL_DES_DECRYPTION); if (bcmp(decrypted[1], dieid_key, 8)) { printf(failmsg); return(ERROR_TARGET); } bcopy(decrypted[0], pirelli_imeisv, 8); printf("Factory IMEISV is %02X%02X%02X%02X-%02X%02X%02X-%02X\n", pirelli_imeisv[0], pirelli_imeisv[1], pirelli_imeisv[2], pirelli_imeisv[3], pirelli_imeisv[4], pirelli_imeisv[5], pirelli_imeisv[6], pirelli_imeisv[7]); return(0); }