summaryrefslogtreecommitdiffstats
path: root/libusbmuxd.h
diff options
context:
space:
mode:
Diffstat (limited to 'libusbmuxd.h')
-rw-r--r--libusbmuxd.h42
1 files changed, 30 insertions, 12 deletions
diff --git a/libusbmuxd.h b/libusbmuxd.h
index 82f9a47..da99f1f 100644
--- a/libusbmuxd.h
+++ b/libusbmuxd.h
@@ -1,27 +1,45 @@
1#ifndef __LIBUSBMUXD_H 1#ifndef __LIBUSBMUXD_H
2#define __LIBUSBMUXD_H 2#define __LIBUSBMUXD_H
3 3
4#include <usbmuxd.h> 4/**
5 * Array entry returned by 'usbmuxd_scan()' scanning.
6 *
7 * If more than one device is available, 'product_id' and
8 * 'serial_number' and be analysed to help make a selection.
9 * The relevant 'handle' should be passed to 'usbmuxd_connect()', to
10 * start a proxy connection. The value 'handle' should be considered
11 * opaque and no presumption made about the meaning of its value.
12 */
13typedef struct {
14 int handle;
15 int product_id;
16 char serial_number[41];
17} usbmuxd_scan_result;
5 18
6/** 19/**
7 * Contacts usbmuxd via it's unix domain socket and performs a scan for 20 * Contacts usbmuxd and performs a scan for connected devices.
8 * connected devices.
9 * 21 *
10 * @param devices Pointer to an array of usbmuxd_device_t. 22 * @param available_devices pointer to array of usbmuxd_scan_result.
11 * Assumed initially NULL, will be allocated by this function. 23 * Array of available devices. The required 'handle'
24 * should be passed to 'usbmuxd_connect()'. The returned array
25 * is zero-terminated for convenience; the final (unused)
26 * entry containing handle == 0. The returned array pointer
27 * should be freed by passing to 'free()' after use.
12 * 28 *
13 * @return number of devices found, negative on error 29 * @return number of available devices, zero on no devices, or negative on error
14 */ 30 */
15int usbmuxd_scan(usbmuxd_device_t **devices); 31int usbmuxd_scan(usbmuxd_scan_result **available_devices);
16 32
17/** 33/**
18 * Performs the connect procedure via usbmuxd. 34 * Request proxy connect to
35 *
36 * @param handle returned by 'usbmuxd_scan()'
19 * 37 *
20 * @param device_id USB device number of the device to connect to 38 * @param tcp_port TCP port number on device, in range 0-65535.
21 * @param port Port number to connect to 39 * common values are 62078 for lockdown, and 22 for SSH.
22 * 40 *
23 * @return socket of the connection, negative on error 41 * @return file descriptor socket of the connection, or -1 on error
24 */ 42 */
25int usbmuxd_connect(uint32_t device_id, uint16_t port); 43int usbmuxd_connect(const int handle, const unsigned short tcp_port);
26 44
27#endif /* __LIBUSBMUXD_H */ 45#endif /* __LIBUSBMUXD_H */