wifi_error wifi_disable_full_scan_results(wifi_request_id id, wifi_interface_handle iface) { ALOGD("[WIFI HAL]Disabling full scan results"); wifi_handle handle = getWifiHandle(iface); if(id == -1) { wifi_scan_result_handler handler; wifi_handle handle = getWifiHandle(iface); int params_dummy; memset(&handler, 0, sizeof(handler)); FullScanResultsCommand *cmd = new FullScanResultsCommand(iface, 0, ¶ms_dummy, handler); cmd->cancel(); cmd->releaseRef(); return WIFI_SUCCESS; } WifiCommand *cmd = wifi_unregister_cmd(handle, id); if (cmd) { cmd->cancel(); cmd->releaseRef(); return WIFI_SUCCESS; } return WIFI_ERROR_INVALID_ARGS; }
wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface) { char prop_buf[PROPERTY_VALUE_MAX]; property_get("wlan.mtk.gscan", prop_buf, "0"); if(!strcmp(prop_buf, "1")) { ALOGD("[WIFI HAL]Stopping GScan"); wifi_handle handle = getWifiHandle(iface); if(id == -1) { wifi_scan_result_handler handler; wifi_scan_cmd_params dummy_params; memset(&handler, 0, sizeof(handler)); ScanCommand *cmd = new ScanCommand(iface, id, &dummy_params, handler); cmd->cancel(); cmd->releaseRef(); return WIFI_SUCCESS; } WifiCommand *cmd = wifi_unregister_cmd(handle, id); if (cmd) { cmd->cancel(); cmd->releaseRef(); return WIFI_SUCCESS; } } return WIFI_ERROR_INVALID_ARGS; }
wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interface_handle iface) { char prop_buf[PROPERTY_VALUE_MAX]; property_get("wlan.mtk.gscan", prop_buf, "0"); if(!strcmp(prop_buf, "1")) { wifi_handle handle = getWifiHandle(iface); WifiCommand *cmd = wifi_unregister_cmd(handle, id); if (cmd) { cmd->cancel(); cmd->releaseRef(); return WIFI_SUCCESS; } } return WIFI_ERROR_INVALID_ARGS; }
static int internal_valid_message_handler(nl_msg *msg, void *arg) { wifi_handle handle = (wifi_handle)arg; hal_info *info = getHalInfo(handle); WifiEvent event(msg); int res = event.parse(); if (res < 0) { ALOGE("Failed to parse event: %d", res); return NL_SKIP; } int cmd = event.get_cmd(); uint32_t vendor_id = 0; int subcmd = 0; if (cmd == NL80211_CMD_VENDOR) { vendor_id = event.get_u32(NL80211_ATTR_VENDOR_ID); subcmd = event.get_u32(NL80211_ATTR_VENDOR_SUBCMD); ALOGI("event received %s, vendor_id = 0x%0x, subcmd = 0x%0x", event.get_cmdString(), vendor_id, subcmd); } else { // ALOGI("event received %s", event.get_cmdString()); } // ALOGI("event received %s, vendor_id = 0x%0x", event.get_cmdString(), vendor_id); // event.log(); bool dispatched = false; pthread_mutex_lock(&info->cb_lock); for (int i = 0; i < info->num_event_cb; i++) { if (cmd == info->event_cb[i].nl_cmd) { if (cmd == NL80211_CMD_VENDOR && ((vendor_id != info->event_cb[i].vendor_id) || (subcmd != info->event_cb[i].vendor_subcmd))) { /* event for a different vendor, ignore it */ continue; } cb_info *cbi = &(info->event_cb[i]); nl_recvmsg_msg_cb_t cb_func = cbi->cb_func; void *cb_arg = cbi->cb_arg; WifiCommand *cmd = (WifiCommand *)cbi->cb_arg; if (cmd != NULL) { cmd->addRef(); } pthread_mutex_unlock(&info->cb_lock); (*cb_func)(msg, cb_arg); if (cmd != NULL) { cmd->releaseRef(); } return NL_OK; } } pthread_mutex_unlock(&info->cb_lock); return NL_OK; }