diff options
Diffstat (limited to 'bcmdhd/wifi_hal/wifi_hal.cpp')
-rw-r--r-- | bcmdhd/wifi_hal/wifi_hal.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp index 5049ac2..a898697 100644 --- a/bcmdhd/wifi_hal/wifi_hal.cpp +++ b/bcmdhd/wifi_hal/wifi_hal.cpp @@ -1,4 +1,3 @@ - #include <stdint.h> #include <fcntl.h> #include <sys/socket.h> @@ -45,6 +44,7 @@ #define FEATURE_SET 0 #define FEATURE_SET_MATRIX 1 #define ATTR_NODFS_VALUE 3 +#define ATTR_COUNTRY_CODE 4 static void internal_event_handler(wifi_handle handle, int events); static int internal_no_seq_check(nl_msg *msg, void *arg); @@ -512,6 +512,35 @@ public: } }; +class SetCountryCodeCommand : public WifiCommand { +private: + const char *mCountryCode; +public: + SetCountryCodeCommand(wifi_interface_handle handle, const char *country_code) + : WifiCommand(handle, 0) { + mCountryCode = country_code; + } + virtual int create() { + int ret; + + ret = mMsg.create(GOOGLE_OUI, WIFI_SUBCMD_SET_COUNTRY_CODE); + if (ret < 0) { + ALOGE("Can't create message to send to driver - %d", ret); + return ret; + } + + nlattr *data = mMsg.attr_start(NL80211_ATTR_VENDOR_DATA); + ret = mMsg.put_string(ATTR_COUNTRY_CODE, mCountryCode); + if (ret < 0) { + return ret; + } + + mMsg.attr_end(data); + return WIFI_SUCCESS; + + } +}; + class GetFeatureSetCommand : public WifiCommand { private: @@ -739,4 +768,10 @@ wifi_error wifi_start_logging(wifi_interface_handle iface, u32 verbose_level, u3 return WIFI_ERROR_NOT_SUPPORTED; } +wifi_error wifi_set_country_code(wifi_interface_handle handle, const char *country_code) +{ + SetCountryCodeCommand command(handle, country_code); + return (wifi_error) command.requestResponse(); +} + ///////////////////////////////////////////////////////////////////////////// |