diff options
| author | 2009-03-29 19:04:38 +0200 | |
|---|---|---|
| committer | 2009-03-29 19:04:38 +0200 | |
| commit | 15ea7e8a03ab519115b19b4b84c2ead96bf6c88c (patch) | |
| tree | de0fb8f9ec61411d53bd82c9bdbed74a133f1bdc /iproxy.c | |
| parent | 50fc7586b2abf8a5ce999235c82d9de1bab98bfd (diff) | |
| download | usbmuxd-15ea7e8a03ab519115b19b4b84c2ead96bf6c88c.tar.gz usbmuxd-15ea7e8a03ab519115b19b4b84c2ead96bf6c88c.tar.bz2 | |
[PATCH] usbmuxd/libusbmuxd.h: separate logic from implementation
tweak public parameter and struct names for clarity
fix usbmuxd_scan() to return number of devices per documentation
expand public documentation in libusbmux.h
Signed-off-by: Nikias Bassen <nikias@gmx.li>
Diffstat (limited to 'iproxy.c')
| -rw-r--r-- | iproxy.c | 13 |
1 files changed, 6 insertions, 7 deletions
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <errno.h> | 31 | #include <errno.h> |
| 32 | #include <arpa/inet.h> | 32 | #include <arpa/inet.h> |
| 33 | #include <pthread.h> | 33 | #include <pthread.h> |
| 34 | #include <usbmuxd.h> | ||
| 35 | #include "sock_stuff.h" | 34 | #include "sock_stuff.h" |
| 36 | #include "libusbmuxd.h" | 35 | #include "libusbmuxd.h" |
| 37 | 36 | ||
| @@ -142,7 +141,7 @@ void *run_ctos_loop(void *arg) | |||
| 142 | void *acceptor_thread(void *arg) | 141 | void *acceptor_thread(void *arg) |
| 143 | { | 142 | { |
| 144 | struct client_data *cdata; | 143 | struct client_data *cdata; |
| 145 | usbmuxd_device_t *dev_list = NULL; | 144 | usbmuxd_scan_result *dev_list = NULL; |
| 146 | pthread_t ctos; | 145 | pthread_t ctos; |
| 147 | 146 | ||
| 148 | if (!arg) { | 147 | if (!arg) { |
| @@ -152,21 +151,21 @@ void *acceptor_thread(void *arg) | |||
| 152 | 151 | ||
| 153 | cdata = (struct client_data*)arg; | 152 | cdata = (struct client_data*)arg; |
| 154 | 153 | ||
| 155 | if (usbmuxd_scan(&dev_list) != 0) { | 154 | if (usbmuxd_scan(&dev_list) < 0) { |
| 156 | printf("Connecting to usbmuxd failed, terminating.\n"); | 155 | printf("Connecting to usbmuxd failed, terminating.\n"); |
| 157 | free(dev_list); | 156 | free(dev_list); |
| 158 | return NULL; | 157 | return NULL; |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | if (!dev_list || dev_list[0].device_id == 0) { | 160 | if (dev_list == NULL || dev_list[0].handle == 0) { |
| 162 | printf("No connected device found, terminating.\n"); | 161 | printf("No connected device found, terminating.\n"); |
| 163 | free(dev_list); | 162 | free(dev_list); |
| 164 | return NULL; | 163 | return NULL; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 167 | fprintf(stdout, "Requesting connecion to device %d port %d\n", dev_list[0].device_id, device_port); | 166 | fprintf(stdout, "Requesting connecion to device handle == %d, port %d\n", dev_list[0].handle, device_port); |
| 168 | 167 | ||
| 169 | cdata->sfd = usbmuxd_connect(dev_list[0].device_id, device_port); | 168 | cdata->sfd = usbmuxd_connect(dev_list[0].handle, device_port); |
| 170 | free(dev_list); | 169 | free(dev_list); |
| 171 | if (cdata->sfd < 0) { | 170 | if (cdata->sfd < 0) { |
| 172 | fprintf(stderr, "Error connecting to device!\n"); | 171 | fprintf(stderr, "Error connecting to device!\n"); |
| @@ -191,7 +190,7 @@ int main(int argc, char **argv) | |||
| 191 | int mysock = -1; | 190 | int mysock = -1; |
| 192 | 191 | ||
| 193 | if (argc != 3) { | 192 | if (argc != 3) { |
| 194 | printf("usage: %s LOCAL_PORT DEVICE_PORT\n", argv[0]); | 193 | printf("usage: %s LOCAL_TCP_PORT DEVICE_TCP_PORT\n", argv[0]); |
| 195 | return 0; | 194 | return 0; |
| 196 | } | 195 | } |
| 197 | 196 | ||
