summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar BALATON Zoltan2015-09-23 02:19:27 +0200
committerGravatar BALATON Zoltan2016-04-01 22:53:13 +0200
commit692f7c9de72ca7fcaba51659972270d445751438 (patch)
treecc03556a0e4b39638885c2f8a602a9258494dfaa /src
parent15173c59a00a8e9c154bd6787e35c243c383160e (diff)
downloadlibimobiledevice-692f7c9de72ca7fcaba51659972270d445751438.tar.gz
libimobiledevice-692f7c9de72ca7fcaba51659972270d445751438.tar.bz2
Add new function to get the underlying file descriptor of an idevice connection
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/idevice.c b/src/idevice.c
index b776e84..5912aeb 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -463,6 +463,22 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive(idevice_connecti
return internal_connection_receive(connection, data, len, recv_bytes);
}
+LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_get_fd(idevice_connection_t connection, int *fd)
+{
+ if (!connection || !fd) {
+ return IDEVICE_E_INVALID_ARG;
+ }
+
+ idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR;
+ if (connection->type == CONNECTION_USBMUXD) {
+ *fd = (int)(long)connection->data;
+ result = IDEVICE_E_SUCCESS;
+ } else {
+ debug_info("Unknown connection type %d", connection->type);
+ }
+ return result;
+}
+
LIBIMOBILEDEVICE_API idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
{
if (!device)