int dhd_conf_set_roam(dhd_pub_t *dhd) { int bcmerror = -1; char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ printf("%s: Set roam_off %d\n", __FUNCTION__, dhd->conf->roam_off); dhd_roam_disable = dhd->conf->roam_off; bcm_mkiovar("roam_off", (char *)&dhd->conf->roam_off, 4, iovbuf, sizeof(iovbuf)); dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0); if (!dhd->conf->roam_off || !dhd->conf->roam_off_suspend) { printf("%s: Set roam_trigger %d\n", __FUNCTION__, dhd->conf->roam_trigger[0]); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_TRIGGER, dhd->conf->roam_trigger, sizeof(dhd->conf->roam_trigger), TRUE, 0)) < 0) CONFIG_ERROR(("%s: roam trigger set failed %d\n", __FUNCTION__, bcmerror)); printf("%s: Set roam_scan_period %d\n", __FUNCTION__, dhd->conf->roam_scan_period[0]); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_SCAN_PERIOD, dhd->conf->roam_scan_period, sizeof(dhd->conf->roam_scan_period), TRUE, 0)) < 0) CONFIG_ERROR(("%s: roam scan period set failed %d\n", __FUNCTION__, bcmerror)); printf("%s: Set roam_delta %d\n", __FUNCTION__, dhd->conf->roam_delta[0]); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_DELTA, dhd->conf->roam_delta, sizeof(dhd->conf->roam_delta), TRUE, 0)) < 0) CONFIG_ERROR(("%s: roam delta set failed %d\n", __FUNCTION__, bcmerror)); printf("%s: Set fullroamperiod %d\n", __FUNCTION__, dhd->conf->fullroamperiod); bcm_mkiovar("fullroamperiod", (char *)&dhd->conf->fullroamperiod, 4, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR(("%s: roam fullscan period set failed %d\n", __FUNCTION__, bcmerror)); } return bcmerror; }
/* * Function: config_get_string() * * Description: Get any arbitrary config entry as a string * * Parameters: id - The id of the config string to get * buffer - Empty buffer where string will be copied * buffer_len - length of the buffer where string will be copied * * Returns: None */ void config_get_string (int id, char *buffer, int buffer_len) { const var_t *entry; char *buf_start; /* * Set the result to be empty in case we can't find anything */ buffer[0] = 0; if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) { entry = &prot_cfg_table[id]; if (entry->length > buffer_len) { CONFIG_ERROR(CFG_F_PREFIX"insufficient buffer: %d\n", "config_get_string", id); } else { buf_start = buffer; entry->print_func(entry, buffer, buffer_len); CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: get str: %s = %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "config_get_string"), id, entry->name, buf_start); } } else { CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_get_string", id); } }
/* * fcp_set_index - sets a given feture index number (from fcp xml file), maps it to the internal * call capability, and sets the appropriate state-based capability for the feature index * */ static void fcp_set_index (unsigned int fcpCapabilityId, cc_boolean state) { ccapi_call_capability_e capabilityId = CCAPI_CALL_CAP_MAX; // range check the capability index if ((fcpCapabilityId <= 0) || (fcpCapabilityId > FCP_FEATURE_MAX)) { CONFIG_ERROR(CFG_F_PREFIX "Unable to set capability of unknown feature [%d] in FCP", "fcp_set_index", fcpCapabilityId); return; } // convert the fcp index to an fcp capability id capabilityId = cc_fcp_id_to_capability_map[fcpCapabilityId]; // based on the capability id, invoke the appropate method specific to that capability switch (capabilityId) { case CCAPI_CALL_CAP_CALLFWD : capset_set_fcp_forwardall (state); break; case CCAPI_CALL_CAP_REDIAL : capset_set_fcp_redial (state); break; default : { CONFIG_ERROR(CFG_F_PREFIX "Unable to update settings for capability [%d]", "fcp_set_index", (int)capabilityId); break; } } }
int dhd_conf_attach(dhd_pub_t *dhd) { dhd_conf_t *conf; CONFIG_TRACE(("%s: Enter\n", __FUNCTION__)); if (dhd->conf != NULL) { printf("%s: config is attached before!\n", __FUNCTION__); return 0; } /* Allocate private bus interface state */ if (!(conf = MALLOC(dhd->osh, sizeof(dhd_conf_t)))) { CONFIG_ERROR(("%s: MALLOC failed\n", __FUNCTION__)); goto fail; } memset(conf, 0, sizeof(dhd_conf_t)); dhd->conf = conf; return 0; fail: if (conf != NULL) MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); return BCME_NOMEM; }
void dhd_conf_wifi_stop(struct net_device *dev) { if (!dev) { CONFIG_ERROR(("%s: dev is null\n", __FUNCTION__)); return; } printk("%s in 1\n", __FUNCTION__); dhd_net_if_lock(dev); printk("%s in 2: g_wifi_on=%d, name=%s\n", __FUNCTION__, g_wifi_on, dev->name); if (g_wifi_on) { #ifdef WL_CFG80211 wl_cfg80211_user_sync(true); wl_cfg80211_stop(); #endif dhd_bus_devreset(bcmsdh_get_drvdata(), true); sdioh_stop(NULL); dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF); g_wifi_on = FALSE; #ifdef WL_CFG80211 wl_cfg80211_user_sync(false); #endif } printk("%s out\n", __FUNCTION__); dhd_net_if_unlock(dev); }
void dhd_conf_set_wme(dhd_pub_t *dhd) { edcf_acparam_t acparam_cur[AC_COUNT]; if (dhd && dhd->conf) { if (!dhd->conf->force_wme_ac) { CONFIG_TRACE(("%s: force_wme_ac is not enabled %d\n", __FUNCTION__, dhd->conf->force_wme_ac)); return; } CONFIG_TRACE(("Before change:\n")); dhd_conf_get_wme(dhd, acparam_cur); dhd_conf_update_wme(dhd, &acparam_cur[AC_BK], AC_BK); dhd_conf_update_wme(dhd, &acparam_cur[AC_BE], AC_BE); dhd_conf_update_wme(dhd, &acparam_cur[AC_VI], AC_VI); dhd_conf_update_wme(dhd, &acparam_cur[AC_VO], AC_VO); CONFIG_TRACE(("After change:\n")); dhd_conf_get_wme(dhd, acparam_cur); } else { CONFIG_ERROR(("%s: dhd or conf is NULL\n", __FUNCTION__)); } return; }
/* * Function: config_set_string() * * Parameters: id - The id of the config string to set * buffer - The new value for the string * * Description: Set any arbitrary config entry as a string * * Returns: None */ void config_set_string (int id, char *buffer) { const var_t *entry; if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) { entry = &prot_cfg_table[id]; if (entry->parse_func(entry, buffer)) { /* Parse function returned an error */ CONFIG_ERROR(CFG_F_PREFIX"Parse function failed. ID: %d %s:%s\n", "config_set_string", id, entry->name, buffer); } else { CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s set str to %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "config_set_string"), id, entry->name, buffer); } } else { CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_set_string", id); } }
int dhd_conf_set_band(dhd_pub_t *dhd) { int bcmerror = -1; if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_BAND, &dhd->conf->band, sizeof(dhd->conf->band), TRUE, 0)) < 0) CONFIG_ERROR(("%s: band set failed %d\n", __FUNCTION__, bcmerror)); return bcmerror; }
void dhd_conf_set_bw(dhd_pub_t *dhd) { int bcmerror = -1; char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ uint32 mimo_bw_cap = 1; /* Turn HT40 on in 2.4 GHz */ if (dhd_bus_chip_id(dhd) == BCM43341_CHIP_ID || dhd_bus_chip_id(dhd) == BCM4324_CHIP_ID || dhd_bus_chip_id(dhd) == BCM4335_CHIP_ID || dhd_bus_chip_id(dhd) == BCM4339_CHIP_ID) { if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0) CONFIG_ERROR(("%s: WLC_DOWN setting failed %d\n", __FUNCTION__, bcmerror)); /* Enable HT40 in 2.4 GHz */ printf("%s: Enable HT40 in 2.4 GHz\n", __FUNCTION__); bcm_mkiovar("mimo_bw_cap", (char *)&mimo_bw_cap, 4, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR(("%s: mimo_bw_cap setting failed %d\n", __FUNCTION__, bcmerror)); } }
uint dhd_conf_get_band(dhd_pub_t *dhd) { uint band = WLC_BAND_AUTO; if (dhd && dhd->conf) band = dhd->conf->band; else CONFIG_ERROR(("%s: dhd or conf is NULL\n", __FUNCTION__)); return band; }
void dhd_conf_force_wme(dhd_pub_t *dhd) { int bcmerror = -1; char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ if (dhd_bus_chip_id(dhd) == BCM43362_CHIP_ID && dhd->conf->force_wme_ac) { bcm_mkiovar("force_wme_ac", (char *)&dhd->conf->force_wme_ac, 4, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR(("%s: force_wme_ac setting failed %d\n", __FUNCTION__, bcmerror)); } }
void dhd_conf_set_stbc(dhd_pub_t *dhd) { int bcmerror = -1; char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ uint stbc = 0; if (dhd_bus_chip_id(dhd) == BCM4324_CHIP_ID) { if (dhd->conf->stbc >= 0) { stbc = (uint)dhd->conf->stbc; printf("%s: set stbc_tx %d\n", __FUNCTION__, stbc); bcm_mkiovar("stbc_tx", (char *)&stbc, 4, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR(("%s: stbc_tx setting failed %d\n", __FUNCTION__, bcmerror)); printf("%s: set stbc_rx %d\n", __FUNCTION__, stbc); bcm_mkiovar("stbc_rx", (char *)&stbc, 4, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR(("%s: stbc_rx setting failed %d\n", __FUNCTION__, bcmerror)); } } }
/* * Function: config_set_value() * * Description: Set arbitrary config entry as a raw data value. * If the length doesn't match the actual length of the field, * nothing will be copied. * * Parameters: id - The id of the config value to set * buffer - The new value to be set * length - The number of bytes to set * * Returns: None */ void config_set_value (int id, void *buffer, int length) { const var_t *entry; /* * Retrieve entry from table..... */ if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) { entry = &prot_cfg_table[id]; if (entry->length != length) { CONFIG_ERROR(CFG_F_PREFIX" %s size error entry size=%d, len=%d\n", "config_set_value", entry->name, entry->length, length); return; } memcpy(entry->addr, buffer, entry->length); if (ConfigDebug) { print_config_value(id, "Set Val", entry->name, buffer, length); } } else { CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_set_value", id); } }
/* * Function: config_get_value() * * Description: Get any arbitrary config entry as a raw data value. * If the length doesn't match the actual length of the field, * nothing will be copied. * * Parameters: id - The id of the config value to get * buffer - Empty buffer where value will be copied * length - The number of bytes to get * * Returns: None */ void config_get_value (int id, void *buffer, int length) { const var_t *entry; /* * Retrieve raw entry from table..... */ if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) { entry = &prot_cfg_table[id]; if (length == entry->length) { memcpy(buffer, entry->addr, entry->length); if (ConfigDebug) { print_config_value(id, "Get Val", entry->name, buffer, length); } } else { CONFIG_ERROR(CFG_F_PREFIX"%s size error\n", "config_get_value", entry->name); } } else { CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_get_value", id); } }
static void fcp_set_capabilities() { int my_fcp_index = 0; if ( (fcp_index+1) >= FCP_FEATURE_MAX) { fcp_index = (FCP_FEATURE_MAX -1); CONFIG_ERROR(CFG_F_PREFIX "Received more than the maximum supported features [%d] in FCP", "fcp_set_capabilities", FCP_FEATURE_MAX); } // loop over all the FCP features parsed, and for each one, based on ID, and enabled settings, // update the corresponding call capability flags for (my_fcp_index = 0; my_fcp_index <= fcp_index; my_fcp_index++) { // set the capability if fcp file has it marked as 'enabled' fcp_set_index(cc_feat_control_policy[my_fcp_index].featureId, (cc_feat_control_policy[my_fcp_index].featureEnabled == TRUE)); } }
/* * Function: config_get_line_id() * * Description: Given the line and the line-specific ID, this function * will return the actual ID used to access the value in the * config table. * * Parameters: id - The id config value to get * line - The line that the ID is associated with * * Returns: TRUE if the entry is found * FALSE otherwise. */ static int config_get_line_id (int id, int line) { int line_id = 0; const var_t *entry; if ((line == 0) || (line > MAX_REG_LINES)) { entry = &prot_cfg_table[id]; // XXX set but not used (void) entry; CONFIG_ERROR(CFG_F_PREFIX"ID=%d- line %d out of range\n", "config_get_line_id", id, line); return (0); } line_id = id + line - 1; return (line_id); }
/* * Some logical upper limit to avoid long print out in case * of large length value */ void print_config_value (int id, char *get_set, const char *entry_name, void *buffer, int length) { long long_val = 0; int int_val = 0; short short_val = 0; char char_val = 0; char str[MAX_CONFIG_VAL_PRINT_LEN]; char *in_ptr; char *str_ptr; if (length == sizeof(char)) { char_val = *(char *) buffer; long_val = (long) char_val; CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, long_val); } else if (length == sizeof(short)) { short_val = *(short *) buffer; long_val = (long) short_val; CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, long_val); } else if (length == sizeof(int)) { int_val = *(int *) buffer; long_val = (long) int_val; CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, long_val); } else if (length == sizeof(long)) { long_val = *(long *) buffer; CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, long_val); } else if (length < MAX_CONFIG_VAL_PRINT_LEN / 2) { in_ptr = (char *) buffer; str_ptr = &str[0]; while (length--) { sprintf(str_ptr++, "%02x", *in_ptr++); str_ptr++; } *str_ptr = '\0'; CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, str); } else { CONFIG_ERROR(CFG_F_PREFIX"cfg_id = %d length too long -> %d\n", "print_config_value", id, length); } }
void dhd_conf_update_wme(dhd_pub_t *dhd, edcf_acparam_t *acparam_cur, int aci) { int bcmerror = -1; int aifsn, ecwmin, ecwmax; edcf_acparam_t *acp; char iovbuf[WLC_IOCTL_SMLEN]; /* Default value */ aifsn = acparam_cur->ACI&EDCF_AIFSN_MASK; ecwmin = acparam_cur->ECW&EDCF_ECWMIN_MASK; ecwmax = (acparam_cur->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT; /* Modified value */ if (dhd->conf->wme.aifsn[aci] > 0) aifsn = dhd->conf->wme.aifsn[aci]; if (dhd->conf->wme.cwmin[aci] > 0) ecwmin = dhd->conf->wme.cwmin[aci]; if (dhd->conf->wme.cwmax[aci] > 0) ecwmax = dhd->conf->wme.cwmax[aci]; /* Update */ acp = acparam_cur; acp->ACI = (acp->ACI & ~EDCF_AIFSN_MASK) | (aifsn & EDCF_AIFSN_MASK); acp->ECW = ((ecwmax << EDCF_ECWMAX_SHIFT) & EDCF_ECWMAX_MASK) | (acp->ECW & EDCF_ECWMIN_MASK); acp->ECW = ((acp->ECW & EDCF_ECWMAX_MASK) | (ecwmin & EDCF_ECWMIN_MASK)); CONFIG_TRACE(("mod aci %d aifsn %d ecwmin %d ecwmax %d size %d\n", acp->ACI, acp->ACI&EDCF_AIFSN_MASK, acp->ECW&EDCF_ECWMIN_MASK, (acp->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, sizeof(edcf_acparam_t))); /* * Now use buf as an output buffer. * Put WME acparams after "wme_ac\0" in buf. * NOTE: only one of the four ACs can be set at a time. */ bcm_mkiovar("wme_ac_sta", (char*)acp, sizeof(edcf_acparam_t), iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0)) < 0) { CONFIG_ERROR(("%s: wme_ac_sta setting failed %d\n", __FUNCTION__, bcmerror)); return; } }
void dhd_conf_get_wme(dhd_pub_t *dhd, edcf_acparam_t *acp) { int bcmerror = -1; char iovbuf[WLC_IOCTL_SMLEN]; edcf_acparam_t *acparam; bzero(iovbuf, sizeof(iovbuf)); /* * Get current acparams, using buf as an input buffer. * Return data is array of 4 ACs of wme params. */ bcm_mkiovar("wme_ac_sta", NULL, 0, iovbuf, sizeof(iovbuf)); if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0)) < 0) { CONFIG_ERROR(("%s: wme_ac_sta getting failed %d\n", __FUNCTION__, bcmerror)); return; } memcpy((char*)acp, iovbuf, sizeof(edcf_acparam_t)*AC_COUNT); acparam = &acp[AC_BK]; CONFIG_TRACE(("BK: aci %d aifsn %d ecwmin %d ecwmax %d size %d\n", acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, sizeof(acp))); acparam = &acp[AC_BE]; CONFIG_TRACE(("BE: aci %d aifsn %d ecwmin %d ecwmax %d size %d\n", acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, sizeof(acp))); acparam = &acp[AC_VI]; CONFIG_TRACE(("VI: aci %d aifsn %d ecwmin %d ecwmax %d size %d\n", acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, sizeof(acp))); acparam = &acp[AC_VO]; CONFIG_TRACE(("VO: aci %d aifsn %d ecwmin %d ecwmax %d size %d\n", acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, sizeof(acp))); return; }
bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel) { int i; bool match = false; if (dhd && dhd->conf) { if (dhd->conf->channels.count == 0) return true; for (i=0; i<dhd->conf->channels.count; i++) { if (channel == dhd->conf->channels.channel[i]) match = true; } } else { match = true; CONFIG_ERROR(("%s: dhd or conf is NULL\n", __FUNCTION__)); } return match; }
int dhd_conf_download_config(dhd_pub_t *dhd) { int bcmerror = -1, i; uint len, len_val; void * image = NULL; char * memblock = NULL; char *bufp, pick[MAXSZ_BUF], *pch, *pick_tmp; char *pconf_path; bool conf_file_exists; pconf_path = dhd->conf_path; conf_file_exists = ((pconf_path != NULL) && (pconf_path[0] != '\0')); if (!conf_file_exists) return (0); if (conf_file_exists) { image = dhd_os_open_image(pconf_path); if (image == NULL) { printk("%s: Ignore config file %s\n", __FUNCTION__, pconf_path); goto err; } } memblock = MALLOC(dhd->osh, MAXSZ_CONFIG); if (memblock == NULL) { CONFIG_ERROR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__, MAXSZ_CONFIG)); goto err; } /* Download variables */ if (conf_file_exists) { len = dhd_os_get_image_block(memblock, MAXSZ_CONFIG, image); } if (len > 0 && len < MAXSZ_CONFIG) { bufp = (char *)memblock; bufp[len] = 0; /* Process firmware path */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "fw_path="); if (len_val) { memcpy(dhd->conf->fw_path, pick, len_val); printf("%s: fw_path = %s\n", __FUNCTION__, dhd->conf->fw_path); } /* Process nvram path */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "nv_path="); if (len_val) { memcpy(dhd->conf->nv_path, pick, len_val); printf("%s: nv_path = %s\n", __FUNCTION__, dhd->conf->nv_path); } /* Process band */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "band="); if (len_val) { if (!strncmp(pick, "b", len_val)) dhd->conf->band = WLC_BAND_2G; printf("%s: band = %d\n", __FUNCTION__, dhd->conf->band); } /* Process country code */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "ccode="); if (len_val) { memset(&dhd->conf->cspec, 0, sizeof(wl_country_t)); memcpy(dhd->conf->cspec.country_abbrev, pick, len_val); memcpy(dhd->conf->cspec.ccode, pick, len_val); memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "regrev="); if (len_val) dhd->conf->cspec.rev = (int32)simple_strtol(pick, NULL, 10); } /* Process channels */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "channels="); pick_tmp = pick; if (len_val) { pch = bcmstrtok(&pick_tmp, " ,.-", 0); i=0; while (pch != NULL && i<WL_NUMCHANNELS) { dhd->conf->channels.channel[i] = (uint32)simple_strtol(pch, NULL, 10); pch = bcmstrtok(&pick_tmp, " ,.-", 0); i++; } dhd->conf->channels.count = i; printf("%s: channels = ", __FUNCTION__); for (i=0; i<dhd->conf->channels.count; i++) printf("%d ", dhd->conf->channels.channel[i]); printf("\n"); } /* Process roam */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "roam_off="); if (len_val) { if (!strncmp(pick, "0", len_val)) dhd->conf->roam_off = 0; else dhd->conf->roam_off = 1; printf("%s: roam_off = %d\n", __FUNCTION__, dhd->conf->roam_off); } memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "roam_off_suspend="); if (len_val) { if (!strncmp(pick, "0", len_val)) dhd->conf->roam_off_suspend = 0; else dhd->conf->roam_off_suspend = 1; printf("%s: roam_off_suspend = %d\n", __FUNCTION__, dhd->conf->roam_off_suspend); } if (!dhd->conf->roam_off || !dhd->conf->roam_off_suspend) { memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "roam_trigger="); if (len_val) dhd->conf->roam_trigger[0] = (int)simple_strtol(pick, NULL, 10); printf("%s: roam_trigger = %d\n", __FUNCTION__, dhd->conf->roam_trigger[0]); memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "roam_scan_period="); if (len_val) dhd->conf->roam_scan_period[0] = (int)simple_strtol(pick, NULL, 10); printf("%s: roam_scan_period = %d\n", __FUNCTION__, dhd->conf->roam_scan_period[0]); memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "roam_delta="); if (len_val) dhd->conf->roam_delta[0] = (int)simple_strtol(pick, NULL, 10); printf("%s: roam_delta = %d\n", __FUNCTION__, dhd->conf->roam_delta[0]); memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "fullroamperiod="); if (len_val) dhd->conf->fullroamperiod = (int)simple_strtol(pick, NULL, 10); printf("%s: fullroamperiod = %d\n", __FUNCTION__, dhd->conf->fullroamperiod); } /* Process filter out all packets */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "filter_out_all_packets="); if (len_val) { if (!strncmp(pick, "0", len_val)) dhd->conf->filter_out_all_packets = 0; else dhd->conf->filter_out_all_packets = 1; printf("%s: filter_out_all_packets = %d\n", __FUNCTION__, dhd->conf->filter_out_all_packets); } /* Process keep alive period */ memset(pick, 0, MAXSZ_BUF); len_val = process_config_vars(bufp, len, pick, "keep_alive_period="); if (len_val) { dhd->conf->keep_alive_period = (int)simple_strtol(pick, NULL, 10); printf("%s: keep_alive_period = %d\n", __FUNCTION__, dhd->conf->keep_alive_period); } bcmerror = 0; } else { CONFIG_ERROR(("%s: error reading config file: %d\n", __FUNCTION__, len)); bcmerror = BCME_SDIO_ERROR; } err: if (memblock) MFREE(dhd->osh, memblock, MAXSZ_CONFIG); if (image) dhd_os_close_image(image); return bcmerror; }