summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerry Lee <jerrylee@broadcom.com>2015-07-16 04:13:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-16 04:13:33 +0000
commit36a87a16bcdf694a8ec38e9c35e933bd7d55e51d (patch)
treee9137b4be4fcb14ba75bf69488ef09e340aefe7f
parentf5e0a7dd912b5e242165c0c89d873e9e202a1472 (diff)
parent56deba26a624507fc2e0e6b134f8bd88d091a141 (diff)
downloadhardware_broadcom_wlan-36a87a16bcdf694a8ec38e9c35e933bd7d55e51d.zip
hardware_broadcom_wlan-36a87a16bcdf694a8ec38e9c35e933bd7d55e51d.tar.gz
hardware_broadcom_wlan-36a87a16bcdf694a8ec38e9c35e933bd7d55e51d.tar.bz2
am 56deba26: Clean up bad command implementation
* commit '56deba26a624507fc2e0e6b134f8bd88d091a141': Clean up bad command implementation
-rw-r--r--bcmdhd/wifi_hal/wifi_hal.cpp3
-rw-r--r--bcmdhd/wifi_hal/wifi_logger.cpp74
2 files changed, 59 insertions, 18 deletions
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp
index 8caa1d6..0a6384f 100644
--- a/bcmdhd/wifi_hal/wifi_hal.cpp
+++ b/bcmdhd/wifi_hal/wifi_hal.cpp
@@ -145,6 +145,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
fn->wifi_set_log_handler = wifi_set_log_handler;
fn->wifi_reset_log_handler = wifi_reset_log_handler;
fn->wifi_set_alert_handler = wifi_set_alert_handler;
+ fn->wifi_reset_alert_handler = wifi_reset_alert_handler;
fn->wifi_get_firmware_version = wifi_get_firmware_version;
fn->wifi_get_ring_buffers_status = wifi_get_ring_buffers_status;
fn->wifi_get_logger_supported_feature_set = wifi_get_logger_supported_feature_set;
@@ -299,7 +300,7 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler)
cmd_info *cmdi = &(info->cmd[bad_commands]);
WifiCommand *cmd = cmdi->cmd;
if (cmd != NULL) {
- ALOGE("Cancelling command %p:%s", cmd, cmd->getType());
+ ALOGD("Cancelling command %p:%s", cmd, cmd->getType());
pthread_mutex_unlock(&info->cb_lock);
cmd->cancel();
pthread_mutex_lock(&info->cb_lock);
diff --git a/bcmdhd/wifi_hal/wifi_logger.cpp b/bcmdhd/wifi_hal/wifi_logger.cpp
index 5d4894b..7f23df5 100644
--- a/bcmdhd/wifi_hal/wifi_logger.cpp
+++ b/bcmdhd/wifi_hal/wifi_logger.cpp
@@ -447,19 +447,16 @@ public:
SetLogHandler(wifi_interface_handle iface, int id, wifi_ring_buffer_data_handler handler)
: WifiCommand("SetLogHandler", iface, id), mHandler(handler)
{ }
- SetLogHandler(wifi_interface_handle iface, int id)
- : WifiCommand("SetLogHandler", iface, id)
- { }
int start() {
- ALOGD("Register log handler");
+ ALOGV("Register loghandler");
registerVendorHandler(GOOGLE_OUI, GOOGLE_DEBUG_RING_EVENT);
return WIFI_SUCCESS;
}
virtual int cancel() {
/* Send a command to driver to stop generating logging events */
- ALOGD("Reset event handler");
+ ALOGV("Clear loghandler");
WifiRequest request(familyId(), ifaceId());
int result = request.create(GOOGLE_OUI, LOGGER_RESET_LOGGING);
@@ -477,7 +474,7 @@ public:
/* unregister event handler */
unregisterVendorHandler(GOOGLE_OUI, GOOGLE_DEBUG_RING_EVENT);
- ALOGD("Success to reset event handler");
+ ALOGD("Success to clear loghandler");
return WIFI_SUCCESS;
}
@@ -529,12 +526,15 @@ wifi_error wifi_set_log_handler(wifi_request_id id, wifi_interface_handle iface,
wifi_ring_buffer_data_handler handler)
{
wifi_handle handle = getWifiHandle(iface);
- SetLogHandler *cmd = new SetLogHandler(iface, id, handler);
+ ALOGV("Loghandler start, handle = %p", handle);
- ALOGI("Logger start, handle = %p", handle);
+ SetLogHandler *cmd = new SetLogHandler(iface, id, handler);
if (cmd) {
wifi_register_cmd(handle, id, cmd);
- return (wifi_error)cmd->start();
+ wifi_error result = (wifi_error)cmd->start();
+ if (result != WIFI_SUCCESS)
+ wifi_unregister_cmd(handle, id);
+ return result;
} else {
ALOGD("Out of memory");
return WIFI_ERROR_OUT_OF_MEMORY;
@@ -544,15 +544,19 @@ wifi_error wifi_set_log_handler(wifi_request_id id, wifi_interface_handle iface,
wifi_error wifi_reset_log_handler(wifi_request_id id, wifi_interface_handle iface)
{
wifi_handle handle = getWifiHandle(iface);
- SetLogHandler *cmd = new SetLogHandler(iface, id);
+ ALOGV("Loghandler reset, wifi_request_id = %d, handle = %p", id, handle);
- ALOGI("Logger reset, handle = %p", handle);
- if (cmd) {
+ if (id == -1) {
+ wifi_ring_buffer_data_handler handler;
+ memset(&handler, 0, sizeof(handler));
+
+ SetLogHandler *cmd = new SetLogHandler(iface, id, handler);
cmd->cancel();
cmd->releaseRef();
return WIFI_SUCCESS;
}
- return WIFI_ERROR_INVALID_ARGS;
+
+ return wifi_cancel_cmd(id, iface);
}
///////////////////////////////////////////////////////////////////////////////
@@ -570,11 +574,21 @@ public:
{ }
int start() {
- ALOGD("Start Alerting");
+ ALOGV("Start Alerting");
registerVendorHandler(GOOGLE_OUI, GOOGLE_DEBUG_MEM_DUMP_EVENT);
return WIFI_SUCCESS;
}
+ virtual int cancel() {
+ ALOGV("Clear alerthandler");
+
+ /* unregister alert handler */
+ unregisterVendorHandler(GOOGLE_OUI, GOOGLE_DEBUG_MEM_DUMP_EVENT);
+ wifi_unregister_cmd(wifiHandle(), id());
+ ALOGD("Success to clear alerthandler");
+ return WIFI_SUCCESS;
+ }
+
virtual int handleResponse(WifiEvent& reply) {
ALOGD("In SetAlertHandler::handleResponse");
@@ -691,13 +705,39 @@ wifi_error wifi_set_alert_handler(wifi_request_id id, wifi_interface_handle ifac
wifi_alert_handler handler)
{
wifi_handle handle = getWifiHandle(iface);
+ ALOGV("Alerthandler start, handle = %p", handle);
+
SetAlertHandler *cmd = new SetAlertHandler(iface, id, handler);
- ALOGI("Alert start, handle = %p", handle);
- wifi_register_cmd(handle, id, cmd);
- return (wifi_error)cmd->start();
+ if (cmd) {
+ wifi_register_cmd(handle, id, cmd);
+ wifi_error result = (wifi_error)cmd->start();
+ if (result != WIFI_SUCCESS)
+ wifi_unregister_cmd(handle, id);
+ return result;
+ } else {
+ ALOGE("Out of memory");
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
}
+wifi_error wifi_reset_alert_handler(wifi_request_id id, wifi_interface_handle iface)
+{
+ wifi_handle handle = getWifiHandle(iface);
+ ALOGV("Alerthandler reset, wifi_request_id = %d, handle = %p", id, handle);
+
+ if (id == -1) {
+ wifi_alert_handler handler;
+ memset(&handler, 0, sizeof(handler));
+
+ SetAlertHandler *cmd = new SetAlertHandler(iface, id, handler);
+ cmd->cancel();
+ cmd->releaseRef();
+ return WIFI_SUCCESS;
+ }
+
+ return wifi_cancel_cmd(id, iface);
+}
///////////////////////////////////////////////////////////////////////////////
class MemoryDumpCommand: public WifiCommand