how to work on hotspot-wps in android6 to enable the wps?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to work on hotspot-wps in android6 to enable the wps?

Jump to solution
13,453 Views
vinothkumars
Senior Contributor IV

Hi all,

I want to enable  wps when i am entering into the hotspot on android6.

For this i enable wps configuration on that android configuration file.

Can anyone give support to work on wps on hotspot .

And how to connect my android6(wps server) with speaker(wps client) by using wps button.

Regards,
Vinothkumar Sekar
Labels (3)
0 Kudos
1 Solution
2,621 Views
vinothkumars
Senior Contributor IV

Dear Nxp,

Thank you for your support. Sorry for my late reply, actually I have done this configuration.

Needs to add the string (wps_state, eap_server) in the following files,

system/netd/server/SoftapController.cpp

int SoftapController::setSoftap(int argc, char *argv[]) {
int hidden = 0;
int channel = AP_CHANNEL_DEFAULT;

int wps_state = 2;

if (argc < 5) {
ALOGE("Softap set is missing arguments. Please use:");
ALOGE("softap <wlan iface> <SSID> <hidden/broadcast> <channel> <wpa2?-psk|open> <passphrase>");
return ResponseCode::CommandSyntaxError;
}

if (!strcasecmp(argv[4], "hidden"))
hidden = 1;

if (argc >= 5) {
channel = atoi(argv[5]);
if (channel <= 0)
channel = AP_CHANNEL_DEFAULT;
}

std::string wbuf(StringPrintf("interface=%s\n"
"driver=nl80211\n"
"ctrl_interface=/data/misc/wifi/hostapd\n"
"ssid=%s\n"
"channel=%d\n"
"ieee80211n=1\n"
"hw_mode=%c\n"
"ignore_broadcast_ssid=%d, eap_server = 1, wps_state = %d\n",
argv[2], argv[3], channel, (channel <= 14) ? 'g' : 'a', hidden,wps_state));

std::string fbuf;
if (argc > 7) {
char psk_str[2*SHA256_DIGEST_LENGTH+1];
if (!strcmp(argv[6], "wpa-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=3\nwpa_pairwise=TKIP CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "wpa2-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=2\nrsn_pairwise=CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "open")) {

fbuf = wbuf;
}
} else if (argc > 6) {
if (!strcmp(argv[6], "open")) {
fbuf = wbuf;
}
} else {
fbuf = wbuf;
}

if (!WriteStringToFile(fbuf, HOSTAPD_CONF_FILE, 0660, AID_SYSTEM, AID_WIFI)) {
ALOGE("Cannot write to \"%s\": %s", HOSTAPD_CONF_FILE, strerror(errno));
return ResponseCode::OperationFailed;
}
return ResponseCode::SoftapStatusResult;
}

Testing,

hostapd_cli  wps_pbc

VinothS

Regards,
Vinothkumar Sekar

View solution in original post

0 Kudos
4 Replies
2,622 Views
vinothkumars
Senior Contributor IV

Dear Nxp,

Thank you for your support. Sorry for my late reply, actually I have done this configuration.

Needs to add the string (wps_state, eap_server) in the following files,

system/netd/server/SoftapController.cpp

int SoftapController::setSoftap(int argc, char *argv[]) {
int hidden = 0;
int channel = AP_CHANNEL_DEFAULT;

int wps_state = 2;

if (argc < 5) {
ALOGE("Softap set is missing arguments. Please use:");
ALOGE("softap <wlan iface> <SSID> <hidden/broadcast> <channel> <wpa2?-psk|open> <passphrase>");
return ResponseCode::CommandSyntaxError;
}

if (!strcasecmp(argv[4], "hidden"))
hidden = 1;

if (argc >= 5) {
channel = atoi(argv[5]);
if (channel <= 0)
channel = AP_CHANNEL_DEFAULT;
}

std::string wbuf(StringPrintf("interface=%s\n"
"driver=nl80211\n"
"ctrl_interface=/data/misc/wifi/hostapd\n"
"ssid=%s\n"
"channel=%d\n"
"ieee80211n=1\n"
"hw_mode=%c\n"
"ignore_broadcast_ssid=%d, eap_server = 1, wps_state = %d\n",
argv[2], argv[3], channel, (channel <= 14) ? 'g' : 'a', hidden,wps_state));

std::string fbuf;
if (argc > 7) {
char psk_str[2*SHA256_DIGEST_LENGTH+1];
if (!strcmp(argv[6], "wpa-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=3\nwpa_pairwise=TKIP CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "wpa2-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=2\nrsn_pairwise=CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "open")) {

fbuf = wbuf;
}
} else if (argc > 6) {
if (!strcmp(argv[6], "open")) {
fbuf = wbuf;
}
} else {
fbuf = wbuf;
}

if (!WriteStringToFile(fbuf, HOSTAPD_CONF_FILE, 0660, AID_SYSTEM, AID_WIFI)) {
ALOGE("Cannot write to \"%s\": %s", HOSTAPD_CONF_FILE, strerror(errno));
return ResponseCode::OperationFailed;
}
return ResponseCode::SoftapStatusResult;
}

Testing,

hostapd_cli  wps_pbc

VinothS

Regards,
Vinothkumar Sekar
0 Kudos
2,621 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

In our BSP, you can find an application called Ethernet. In that application, you have all the google tools to set the hotspot on your device.

I hope this can solve your problem.

Best Regards,

Diego.

0 Kudos
2,621 Views
vinothkumars
Senior Contributor IV

Thanks Diego,

But, I get little confuse. Why because, In my board hotspot working fine. I want to add option for WPS button or i want to call that WPI internally.

IMG20170527144545.jpg

Thanks and Regards,

VinothS.

Regards,
Vinothkumar Sekar
0 Kudos
2,621 Views
vinothkumars
Senior Contributor IV

Thanks Diego,

I found that Ethernet Application.

And i don't know how to use that Ethernet Application for wps in  hotspot.

Is there any separate TV setting in that BSP.?

We are make it call the wps start in that tethering function but i don't get any response.

With Regards,

VinothS,

Regards,
Vinothkumar Sekar
0 Kudos