Skip to content

Commit

Permalink
Set wifi mac address by getting it from the radio and passing it to t…
Browse files Browse the repository at this point in the history
…he libra driver when it's loaded.

Change-Id: I71d6878c7daa65654ac5cf95e67be5001cb0706b
  • Loading branch information
dzo committed Aug 5, 2011
1 parent 68dd033 commit 2fed5cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Expand Up @@ -6,7 +6,7 @@ SAVE_MAKEFILES := $(call all-subdir-makefiles)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SHARED_LIBRARIES := libutils libbinder libcutils libwpa_client
LOCAL_SHARED_LIBRARIES := libutils libbinder libcutils libwpa_client libhwrpc

LOCAL_INCLUDES += $(LOCAL_PATH)

Expand Down
19 changes: 17 additions & 2 deletions wifi/wifi.c
Expand Up @@ -48,6 +48,8 @@ extern void get_dhcp_info();
extern int init_module(void *, unsigned long, const char *);
extern int delete_module(const char *, unsigned int);

extern void huawei_oem_rapi_streaming_function(int n, int p1, int p2, int p3, char *v1, int *v2, int *v3);

static char iface[PROPERTY_VALUE_MAX];
// TODO: use new ANDROID_SOCKET mechanism, once support for multiple
// sockets is in
Expand Down Expand Up @@ -93,17 +95,30 @@ static const char MODULE_FILE[] = "/proc/modules";
static const char SDIO_POLLING_ON[] = "/etc/init.qcom.sdio.sh 1";
static const char SDIO_POLLING_OFF[] = "/etc/init.qcom.sdio.sh 0";

static int insmod(const char *filename, const char *args)
static int insmod(const char *filename,const char *args)
{
void *module;
unsigned int size;
int ret;
char x[8];
int y;
char mac_param[64];

module = load_file(filename, &size);
if (!module)
return -1;

ret = init_module(module, size, args);
if(strstr(filename,"libra.ko")) {
memset(x,0,8);
y=0;
huawei_oem_rapi_streaming_function(3,0,0,0,0,&y,x);
LOGI("huawei_oem_rapi_streaming_function %p %x %x",x,x[0],y);
sprintf(mac_param,"mac_param=%02X:%02X:%02X:%02X:%02X:%02X ",x[5],x[4],x[3],x[2],x[1],x[0]);
LOGI("Got MAC Address: %s ",mac_param);
ret = init_module(module, size, mac_param);
} else {
ret = init_module(module, size, args);
}

free(module);

Expand Down

2 comments on commit 2fed5cb

@stockwell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incredible work, great job on figuring this out.

@dzo
Copy link
Owner Author

@dzo dzo commented on 2fed5cb Aug 6, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, thanks for pointing out that it was getting set by HEIdi.

Please sign in to comment.