Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add makecsiparams build script for Nexus5 #309

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions utils/makecsiparams/Android.mk
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions utils/makecsiparams/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_FLOATFORM := anroid-20
APP_BUILD_SCRIPT := Android.mk
APP_ABI := armeabi
16 changes: 16 additions & 0 deletions utils/makecsiparams/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

66 changes: 60 additions & 6 deletions utils/makecsiparams/makecsiparams.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,69 @@
#include <stdint.h>
#include <string.h>
#include <netinet/ether.h>

#include <net/ethernet.h>
/*
#include <sys/types.h>
#include <sys/socket.h>
#include <net/ethernet.h>
*/
#include "bcmwifi_channels.h"

//start ether_aton.c
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

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;
Expand Down Expand Up @@ -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");
Expand Down