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

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