diff options
| author | 2012-07-11 14:13:22 +0200 | |
|---|---|---|
| committer | 2012-07-11 14:13:22 +0200 | |
| commit | 6f6484fb4565cb7378f610d736ea8263652f67c5 (patch) | |
| tree | f4b9eb44f4cc189eaabb6f6fd6dd2b7eefaf3be8 /libusbmuxd | |
| parent | 13bcf78ee53851d88d561e170cdfcc3ae08e0b1c (diff) | |
| download | usbmuxd-6f6484fb4565cb7378f610d736ea8263652f67c5.tar.gz usbmuxd-6f6484fb4565cb7378f610d736ea8263652f67c5.tar.bz2 | |
libusbmuxd: Add function to allow dis-/enabling inotify support (Linux only)
Diffstat (limited to 'libusbmuxd')
| -rw-r--r-- | libusbmuxd/libusbmuxd.c | 14 | ||||
| -rw-r--r-- | libusbmuxd/usbmuxd.h | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c index 6417543..956dd90 100644 --- a/libusbmuxd/libusbmuxd.c +++ b/libusbmuxd/libusbmuxd.c | |||
| @@ -417,12 +417,18 @@ static int usbmuxd_listen_poll() | |||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | #ifdef HAVE_INOTIFY | 419 | #ifdef HAVE_INOTIFY |
| 420 | static int use_inotify = 1; | ||
| 421 | |||
| 420 | static int usbmuxd_listen_inotify() | 422 | static int usbmuxd_listen_inotify() |
| 421 | { | 423 | { |
| 422 | int inot_fd; | 424 | int inot_fd; |
| 423 | int watch_d; | 425 | int watch_d; |
| 424 | int sfd; | 426 | int sfd; |
| 425 | 427 | ||
| 428 | if (!use_inotify) { | ||
| 429 | return -2; | ||
| 430 | } | ||
| 431 | |||
| 426 | sfd = connect_usbmuxd_socket(); | 432 | sfd = connect_usbmuxd_socket(); |
| 427 | if (sfd >= 0) | 433 | if (sfd >= 0) |
| 428 | return sfd; | 434 | return sfd; |
| @@ -943,6 +949,14 @@ int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes) | |||
| 943 | return usbmuxd_recv_timeout(sfd, data, len, recv_bytes, 5000); | 949 | return usbmuxd_recv_timeout(sfd, data, len, recv_bytes, 5000); |
| 944 | } | 950 | } |
| 945 | 951 | ||
| 952 | void libusbmuxd_set_use_inotify(int set) | ||
| 953 | { | ||
| 954 | #ifdef HAVE_INOTIFY | ||
| 955 | use_inotify = set; | ||
| 956 | #endif | ||
| 957 | return; | ||
| 958 | } | ||
| 959 | |||
| 946 | void libusbmuxd_set_debug_level(int level) | 960 | void libusbmuxd_set_debug_level(int level) |
| 947 | { | 961 | { |
| 948 | libusbmuxd_debug = level; | 962 | libusbmuxd_debug = level; |
diff --git a/libusbmuxd/usbmuxd.h b/libusbmuxd/usbmuxd.h index d0dccef..0f7b862 100644 --- a/libusbmuxd/usbmuxd.h +++ b/libusbmuxd/usbmuxd.h | |||
| @@ -174,6 +174,14 @@ int usbmuxd_recv_timeout(int sfd, char *data, uint32_t len, uint32_t *recv_bytes | |||
| 174 | */ | 174 | */ |
| 175 | int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes); | 175 | int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes); |
| 176 | 176 | ||
| 177 | /** | ||
| 178 | * Enable or disable the use of inotify extension. Enabled by default. | ||
| 179 | * Use 0 to disable and 1 to enable inotify support. | ||
| 180 | * This only has an effect on linux systems if inotify support has been built | ||
| 181 | * in. Otherwise and on all other platforms this function has no effect. | ||
| 182 | */ | ||
| 183 | void libusbmuxd_set_use_inotify(int set); | ||
| 184 | |||
| 177 | void libusbmuxd_set_debug_level(int level); | 185 | void libusbmuxd_set_debug_level(int level); |
| 178 | 186 | ||
| 179 | #ifdef __cplusplus | 187 | #ifdef __cplusplus |
