From 50f5b05ac2ce98e9d834fd9cce5453a1cf985ab7 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 3 Oct 2019 19:58:26 +0200 Subject: Expose entire usb serial number string in struct irecv_device_info --- include/libirecovery.h | 1 + src/libirecovery.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/libirecovery.h b/include/libirecovery.h index e7be89b..63b659d 100644 --- a/include/libirecovery.h +++ b/include/libirecovery.h @@ -88,6 +88,7 @@ struct irecv_device_info { unsigned int ibfl; char* srnm; char* imei; + char* serial_string; unsigned char* ap_nonce; unsigned int ap_nonce_size; unsigned char* sep_nonce; diff --git a/src/libirecovery.c b/src/libirecovery.c index 66d76c3..eec0f9a 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -467,6 +467,8 @@ static void irecv_load_device_info_from_iboot_string(irecv_client_t client, cons memset(&client->device_info, '\0', sizeof(struct irecv_device_info)); + client->device_info.serial_string = strdup(iboot_string); + char* ptr; ptr = strstr(iboot_string, "CPID:"); @@ -1919,8 +1921,10 @@ static void _irecv_handle_device_remove(struct irecv_usb_device_info *devinfo) 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; devinfo->device_info.imei = NULL; + devinfo->device_info.serial_string = NULL; devinfo->alive = 0; collection_remove(&devices, devinfo); free(devinfo); @@ -2286,8 +2290,10 @@ IRECV_API irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_contex 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; devinfo->device_info.imei = NULL; + devinfo->device_info.serial_string = NULL; free(devinfo); } ENDFOREACH collection_free(&devices); @@ -2350,6 +2356,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.serial_string); free(client->device_info.ap_nonce); free(client->device_info.sep_nonce); -- cgit v1.1-32-gdbae