diff options
| author | 2009-08-02 07:35:00 +0200 | |
|---|---|---|
| committer | 2009-08-02 07:35:00 +0200 | |
| commit | 6fbd2a72122d6bcd70edbf599baa7465e3e9acb6 (patch) | |
| tree | feb60a5383dffef6e095a59168547f6a13791c7d | |
| parent | a4ef4325ec1b6cddd4212a6fec954cba270cebb4 (diff) | |
| download | usbmuxd-6fbd2a72122d6bcd70edbf599baa7465e3e9acb6.tar.gz usbmuxd-6fbd2a72122d6bcd70edbf599baa7465e3e9acb6.tar.bz2 | |
include config.h and defined ENABLE_HACKS
Use --disable-hacks to NOT enable hacks like the N*128/N*512 hack when
running configure. Hacks are enabled by default.
| -rw-r--r-- | configure.ac | 14 | ||||
| -rw-r--r-- | src/usbmux.c | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 55ce7af..d8c10f8 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -18,6 +18,20 @@ AC_PROG_INSTALL | |||
| 18 | 18 | ||
| 19 | PKG_CHECK_MODULES(libusb, libusb >= 0.1.12) | 19 | PKG_CHECK_MODULES(libusb, libusb >= 0.1.12) |
| 20 | 20 | ||
| 21 | # check for options | ||
| 22 | AC_ARG_ENABLE([hacks], | ||
| 23 | [AS_HELP_STRING([--disable-hacks], | ||
| 24 | [disable hacks that provide workarounds for certain problems])], | ||
| 25 | [enable_hacks=no], | ||
| 26 | [enable_hacks=yes]) | ||
| 27 | if test "x$enable_hacks" = xyes; then | ||
| 28 | AC_DEFINE(ENABLE_HACKS, 1, [Define if you want hacks enabled]) | ||
| 29 | echo "Note: hacks are enabled." | ||
| 30 | else | ||
| 31 | echo "Note: hacks are DISABLED." | ||
| 32 | fi | ||
| 33 | AM_CONDITIONAL(ENABLE_HACKS, test "x$enable_hacks" = xyes) | ||
| 34 | |||
| 21 | # Output files | 35 | # Output files |
| 22 | 36 | ||
| 23 | AC_OUTPUT([ | 37 | AC_OUTPUT([ |
diff --git a/src/usbmux.c b/src/usbmux.c index 2157e05..37538da 100644 --- a/src/usbmux.c +++ b/src/usbmux.c | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | * License along with this library; if not, write to the Free Software | 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ | 17 | */ |
| 18 | #ifdef HAVE_CONFIG_H | ||
| 19 | #include <config.h> | ||
| 20 | #endif | ||
| 18 | #include <stdint.h> | 21 | #include <stdint.h> |
| 19 | #include <stdarg.h> | 22 | #include <stdarg.h> |
| 20 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| @@ -845,6 +848,7 @@ int usbmux_send(usbmux_client_t client, const char *data, uint32_t datalen, | |||
| 845 | uint32_t curlen = datalen; | 848 | uint32_t curlen = datalen; |
| 846 | uint32_t packetsize = blocksize; | 849 | uint32_t packetsize = blocksize; |
| 847 | 850 | ||
| 851 | #ifdef ENABLE_HACKS | ||
| 848 | // BEGIN HACK | 852 | // BEGIN HACK |
| 849 | if ((blocksize % 128) == 0) { | 853 | if ((blocksize % 128) == 0) { |
| 850 | int cutoff = 28; | 854 | int cutoff = 28; |
| @@ -886,6 +890,7 @@ int usbmux_send(usbmux_client_t client, const char *data, uint32_t datalen, | |||
| 886 | fullsendresult -= sizeof(usbmux_tcp_header); | 890 | fullsendresult -= sizeof(usbmux_tcp_header); |
| 887 | } | 891 | } |
| 888 | // END HACK | 892 | // END HACK |
| 893 | #endif | ||
| 889 | 894 | ||
| 890 | // Set the length | 895 | // Set the length |
| 891 | client->header->length = packetsize; | 896 | client->header->length = packetsize; |
