Convert variable int mac_as_int to char.
Do not plan to send upstream.
@@ -28,47 +28,52 @@ static val_strength_t strength_vals[] =
{ "good", -68 },
{ "very good", -40 },
{ "excellent", -16 }
};
static nsWifiAccessPoint *
do_parse_str(char *bssid_str, char *essid_str, char *strength)
{
- unsigned char mac_as_int[6] = { 0 };
+ unsigned int mac_as_int[6] = { 0 };
+ unsigned char mac_as_byte[6] = { 0 };
sscanf(bssid_str, "%x:%x:%x:%x:%x:%x", &mac_as_int[0], &mac_as_int[1],
&mac_as_int[2], &mac_as_int[3], &mac_as_int[4], &mac_as_int[5]);
+ for (uint32_t i = 0; i < 6; i++) {
+ mac_as_byte[i] = mac_as_int[i];
+ }
+
int signal = 0;
uint32_t strength_vals_count = sizeof(strength_vals) / sizeof (val_strength_t);
for (uint32_t i = 0; i < strength_vals_count; i++) {
if (!strncasecmp(strength, strength_vals[i].strength_name, DLADM_STRSIZE)) {
signal = strength_vals[i].signal_value;
break;
}
}
nsWifiAccessPoint *ap = new nsWifiAccessPoint();
if (ap) {
- ap->setMac(mac_as_int);
+ ap->setMac(mac_as_byte);
ap->setSignal(signal);
ap->setSSID(essid_str, PL_strnlen(essid_str, DLADM_STRSIZE));
}
return ap;
}
static void
do_dladm(nsCOMArray<nsWifiAccessPoint> &accessPoints)
{
GError *err = nullptr;
char *sout = nullptr;
char *serr = nullptr;
int exit_status = 0;
char * dladm_args[] = { "/usr/bin/pfexec", "/usr/sbin/dladm",
- "scan-wifi", "-p", "-o", "BSSID,ESSID,STRENGTH" };
+ "scan-wifi", "-p", "-o", "BSSID,ESSID,STRENGTH", 0 };
gboolean rv = g_spawn_sync("/", dladm_args, nullptr, (GSpawnFlags)0, nullptr,
nullptr, &sout, &serr, &exit_status, &err);
if (rv && !exit_status) {
char wlan[DLADM_SECTIONS][DLADM_STRSIZE+1];
uint32_t section = 0;
uint32_t sout_scan = 0;
uint32_t wlan_put = 0;
--- a/dom/system/NetworkGeolocationProvider.js 2015-09-13 14:24:44.290458254 +0800
+++ b/dom/system/NetworkGeolocationProvider.js 2015-09-13 14:24:52.938673937 +0800
@@ -29,7 +29,7 @@
data and xhr it to the location server.
*/
-var gLocationRequestTimeout = 5000;
+var gLocationRequestTimeout = 30000;
var gWifiScanningEnabled = true;
var gCellScanningEnabled = false;