diff --git a/utils/makecsiparams/Android.mk b/utils/makecsiparams/Android.mk new file mode 100644 index 0000000..b812a20 --- /dev/null +++ b/utils/makecsiparams/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VAR) + +LOCAL_SRC_FILES := \ + makecsiparams.c \ + bcmwifi_channels.c +LOCAL_MODULE := makecsiparams +LOCAL_MODULE_FILENAME := makecsiparams + +LOCAL_CFLAGS += -std=c99 +LOCAL_CFLAGS += -fPIE +LOCAL_LDFLAGS += -fPIE -pie +LOCAL_C_INCLUDES += ./include + +AL_MODEL_PATH := $(TARGET_OUT_OPTIONAL_EXCUABLES) + +include $(BUILD_EXECUTABLE) diff --git a/utils/makecsiparams/Application.mk b/utils/makecsiparams/Application.mk new file mode 100644 index 0000000..150788a --- /dev/null +++ b/utils/makecsiparams/Application.mk @@ -0,0 +1,3 @@ +APP_FLOATFORM := anroid-20 +APP_BUILD_SCRIPT := Android.mk +APP_ABI := armeabi diff --git a/utils/makecsiparams/README.md b/utils/makecsiparams/README.md index 7d4596a..bc035e6 100644 --- a/utils/makecsiparams/README.md +++ b/utils/makecsiparams/README.md @@ -17,3 +17,19 @@ Usage: makecsiparams [OPTION...] without it is enforced automatically) -r generate raw output (no base64) ``` + +### Buid And Install makecsiparams for Nexus5 +1. Set ndk-build path +``` +export PATH=$PATH:{android-ndk-r11c path} +``` +2. Build command +``` +cd utils/makecsiparams +ndk-build NDK_APPLICATION_MK=`pwd`/Application.mk NDK_PROJECT_PATH=`pwd` +``` +3. Install +``` +make install +``` + diff --git a/utils/makecsiparams/makecsiparams.c b/utils/makecsiparams/makecsiparams.c index 15809c8..0539fd0 100644 --- a/utils/makecsiparams/makecsiparams.c +++ b/utils/makecsiparams/makecsiparams.c @@ -4,14 +4,69 @@ #include #include #include + #include -/* -#include -#include -#include -*/ #include "bcmwifi_channels.h" +//start ether_aton.c +#include +#include +#include + +static inline int +xdigit (char c) { + unsigned d; + d = (unsigned)(c-'0'); + if (d < 10) return (int)d; + d = (unsigned)(c-'a'); + if (d < 6) return (int)(10+d); + d = (unsigned)(c-'A'); + if (d < 6) return (int)(10+d); + return -1; +} +/* + * Convert Ethernet address in the standard hex-digits-and-colons to binary + * representation. + * Re-entrant version (GNU extensions) + */ +struct ether_addr * +ether_aton_r (const char *asc, struct ether_addr * addr) +{ + int i, val0, val1; + for (i = 0; i < ETHER_ADDR_LEN; ++i) { + val0 = xdigit(*asc); + asc++; + if (val0 < 0) + return NULL; + val1 = xdigit(*asc); + asc++; + if (val1 < 0) + return NULL; + addr->ether_addr_octet[i] = (u_int8_t)((val0 << 4) + val1); + if (i < ETHER_ADDR_LEN - 1) { + if (*asc != ':') + return NULL; + asc++; + } + } + if (*asc != '\0') + return NULL; + return addr; +} +/* + * Convert Ethernet address in the standard hex-digits-and-colons to binary + * representation. + */ +struct ether_addr * +ether_aton (const char *asc) +{ + static struct ether_addr addr; + return ether_aton_r(asc, &addr); +} + +//end ether_aton.c + + void st16le (uint16_t value, uint16_t *addr) { uint8_t *_addr = (uint8_t *) addr; @@ -150,7 +205,6 @@ int main (int argc, char *argv[]) { fprintf (stderr, "Only %d mac addresses can be given\n", MAX_MAC_ADDRESS); goto finish_error; } - ea = ether_aton (split); if (ea == NULL) { fprintf (stderr, "Invalid mac address\n");