Blame SOURCES/0001-Add-new-function-to-get-the-underlying-file-descript.patch

612eec
From 692f7c9de72ca7fcaba51659972270d445751438 Mon Sep 17 00:00:00 2001
612eec
From: BALATON Zoltan <balaton@eik.bme.hu>
612eec
Date: Wed, 23 Sep 2015 02:19:27 +0200
612eec
Subject: [PATCH] Add new function to get the underlying file descriptor of an
612eec
 idevice connection
612eec
612eec
---
612eec
 include/libimobiledevice/libimobiledevice.h | 10 ++++++++++
612eec
 src/idevice.c                               | 16 ++++++++++++++++
612eec
 2 files changed, 26 insertions(+)
612eec
612eec
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
612eec
index 016cadb..b125adf 100644
612eec
--- a/include/libimobiledevice/libimobiledevice.h
612eec
+++ b/include/libimobiledevice/libimobiledevice.h
612eec
@@ -239,6 +239,16 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection);
612eec
  */
612eec
 idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection);
612eec
 
612eec
+/**
612eec
+ * Get the underlying file descriptor for a connection
612eec
+ *
612eec
+ * @param connection The connection to get fd of
612eec
+ * @param fd Pointer to an int where the fd is stored
612eec
+ *
612eec
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
612eec
+ */
612eec
+idevice_error_t idevice_connection_get_fd(idevice_connection_t connection, int *fd);
612eec
+
612eec
 /* misc */
612eec
 
612eec
 /**
612eec
diff --git a/src/idevice.c b/src/idevice.c
612eec
index b776e84..5912aeb 100644
612eec
--- a/src/idevice.c
612eec
+++ b/src/idevice.c
612eec
@@ -463,6 +463,22 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive(idevice_connecti
612eec
 	return internal_connection_receive(connection, data, len, recv_bytes);
612eec
 }
612eec
 
612eec
+LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_get_fd(idevice_connection_t connection, int *fd)
612eec
+{
612eec
+	if (!connection || !fd) {
612eec
+		return IDEVICE_E_INVALID_ARG;
612eec
+	}
612eec
+
612eec
+	idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR;
612eec
+	if (connection->type == CONNECTION_USBMUXD) {
612eec
+		*fd = (int)(long)connection->data;
612eec
+		result = IDEVICE_E_SUCCESS;
612eec
+	} else {
612eec
+		debug_info("Unknown connection type %d", connection->type);
612eec
+	}
612eec
+	return result;
612eec
+}
612eec
+
612eec
 LIBIMOBILEDEVICE_API idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
612eec
 {
612eec
 	if (!device)
612eec
-- 
612eec
2.9.3
612eec