summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-10-03 19:58:26 +0200
committerGravatar Nikias Bassen2019-10-03 19:58:26 +0200
commit50f5b05ac2ce98e9d834fd9cce5453a1cf985ab7 (patch)
tree8665720b6b2b5a7dfb7ab5920b695c759a3ee442
parent93111c07a877a47ded6e05b567aa393bec4cbd7d (diff)
downloadlibirecovery-50f5b05ac2ce98e9d834fd9cce5453a1cf985ab7.tar.gz
libirecovery-50f5b05ac2ce98e9d834fd9cce5453a1cf985ab7.tar.bz2
Expose entire usb serial number string in struct irecv_device_info
-rw-r--r--include/libirecovery.h1
-rw-r--r--src/libirecovery.c7
2 files changed, 8 insertions, 0 deletions
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);