diff options
author | Nikias Bassen | 2019-10-03 20:04:06 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-03 20:04:43 +0200 |
commit | eae71e0647635fc00769764ec998e3136c5f0baa (patch) | |
tree | 37e56686d9e1066cf829258c0b7041d3b5627956 /src | |
parent | 50f5b05ac2ce98e9d834fd9cce5453a1cf985ab7 (diff) | |
download | libirecovery-eae71e0647635fc00769764ec998e3136c5f0baa.tar.gz libirecovery-eae71e0647635fc00769764ec998e3136c5f0baa.tar.bz2 |
Parse SRTG (build tag string) from usb serial number if available
Diffstat (limited to 'src')
-rw-r--r-- | src/libirecovery.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index eec0f9a..377f571 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -528,6 +528,17 @@ static void irecv_load_device_info_from_iboot_string(irecv_client_t client, cons } client->device_info.imei = strdup(tmp); } + + tmp[0] = '\0'; + ptr = strstr(iboot_string, "SRTG:["); + if(ptr != NULL) { + sscanf(ptr, "SRTG:[%s]", tmp); + ptr = strrchr(tmp, ']'); + if(ptr != NULL) { + *ptr = '\0'; + } + client->device_info.srtg = strdup(tmp); + } } static void irecv_copy_nonce_with_tag(irecv_client_t client, const char* tag, unsigned char** nonce, unsigned int* nonce_size) @@ -1920,10 +1931,12 @@ static void _irecv_handle_device_remove(struct irecv_usb_device_info *devinfo) } ENDFOREACH mutex_unlock(&listener_mutex); free(devinfo->device_info.srnm); - free(devinfo->device_info.imei); - free(devinfo->device_info.serial_string); devinfo->device_info.srnm = NULL; + free(devinfo->device_info.imei); devinfo->device_info.imei = NULL; + free(devinfo->device_info.srtg); + devinfo->device_info.srtg = NULL; + free(devinfo->device_info.serial_string); devinfo->device_info.serial_string = NULL; devinfo->alive = 0; collection_remove(&devices, devinfo); @@ -2289,10 +2302,12 @@ IRECV_API irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_contex mutex_lock(&device_mutex); FOREACH(struct irecv_usb_device_info *devinfo, &devices) { free(devinfo->device_info.srnm); - free(devinfo->device_info.imei); - free(devinfo->device_info.serial_string); devinfo->device_info.srnm = NULL; + free(devinfo->device_info.imei); devinfo->device_info.imei = NULL; + free(devinfo->device_info.srtg); + devinfo->device_info.srtg = NULL; + free(devinfo->device_info.serial_string); devinfo->device_info.serial_string = NULL; free(devinfo); } ENDFOREACH @@ -2356,6 +2371,7 @@ IRECV_API irecv_error_t irecv_close(irecv_client_t client) { #endif free(client->device_info.srnm); free(client->device_info.imei); + free(client->device_info.srtg); free(client->device_info.serial_string); free(client->device_info.ap_nonce); free(client->device_info.sep_nonce); |