diff options
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 18 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 1 | ||||
-rw-r--r-- | include/hardware_legacy/gscan.h | 187 | ||||
-rw-r--r-- | include/hardware_legacy/rtt.h | 95 | ||||
-rw-r--r-- | include/hardware_legacy/wifi_hal.h | 12 | ||||
-rw-r--r-- | include/hardware_legacy/wifi_logger.h | 30 | ||||
-rw-r--r-- | uevent/uevent.c | 1 | ||||
-rw-r--r-- | wifi/wifi.c | 14 |
8 files changed, 290 insertions, 68 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 74070fd..85b0084 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -2854,7 +2854,22 @@ uint32_t AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, if (device != AUDIO_DEVICE_NONE) { outputDesc->mDevice = device; + + // Force routing if previously asked for this output + if (outputDesc->mForceRouting) { + ALOGV("Force routing to current device as previous device was null for this output"); + force = true; + + // Request consumed. Reset mForceRouting to false + outputDesc->mForceRouting = false; + } } + else { + // Device is null and does not reflect the routing. Save the necessity to force + // re-routing upon next attempt to select a non-null device for this output + outputDesc->mForceRouting = true; + } + muteWaitMs = checkDeviceMuteStrategies(outputDesc, prevDevice, delayMs); // Do not change the routing if: @@ -3475,7 +3490,8 @@ AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( : mId(0), mSamplingRate(0), mFormat(AUDIO_FORMAT_DEFAULT), mChannelMask(0), mLatency(0), mFlags((audio_output_flags_t)0), mDevice(AUDIO_DEVICE_NONE), - mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0) + mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0), + mForceRouting(false) { // clear usage count for all stream types for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 531a737..cf03f78 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -287,6 +287,7 @@ protected: bool mStrategyMutedByDevice[NUM_STRATEGIES]; // strategies muted because of incompatible // device selection. See checkDeviceMuteStrategies() uint32_t mDirectOpenCount; // number of clients using this output (direct outputs only) + bool mForceRouting; // Next routing for this output will be forced as current device routed is null }; // descriptor for audio inputs. Used to maintain current configuration of each opened audio input diff --git a/include/hardware_legacy/gscan.h b/include/hardware_legacy/gscan.h index 5d62dd9..85f79c6 100644 --- a/include/hardware_legacy/gscan.h +++ b/include/hardware_legacy/gscan.h @@ -16,11 +16,12 @@ typedef enum { WIFI_BAND_ABG_WITH_DFS = 7, // 2.4 GHz + 5 GHz with DFS } wifi_band; -const unsigned MAX_CHANNELS = 16; -const unsigned MAX_BUCKETS = 16; -const unsigned MAX_HOTLIST_APS = 128; -const unsigned MAX_SIGNIFICANT_CHANGE_APS = 64; -const unsigned MAX_PNO_SSID = 128; +#define MAX_CHANNELS 16 +#define MAX_BUCKETS 16 +#define MAX_HOTLIST_APS 128 +#define MAX_SIGNIFICANT_CHANGE_APS 64 +#define MAX_PNO_SSID 128; +#define MAX_HOTLIST_SSID 8; wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, wifi_channel *channels, int *num_channels); @@ -182,6 +183,38 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, wifi_interface_handle ifac /* Clear the BSSID Hotlist */ wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface); + +/* SSID Hotlist */ +typedef struct { + void (*on_hotlist_ssid_found)(wifi_request_id id, + unsigned num_results, wifi_scan_result *results); + void (*on_hotlist_ssid_lost)(wifi_request_id id, + unsigned num_results, wifi_scan_result *results); +} wifi_hotlist_ssid_found_handler; + +typedef struct { + char ssid[32+1]; // SSID + wifi_band band; // band for this set of threshold params + wifi_rssi low; // low threshold + wifi_rssi high; // high threshold +} ssid_threshold_param; + +typedef struct { + int lost_ssid_sample_size; + int num_ap; // number of hotlist APs + ssid_threshold_param ssid[MAX_HOTLIST_APS]; // hotlist APs +} wifi_ssid_hotlist_params; + + +/* Set the SSID Hotlist */ +wifi_error wifi_set_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface, + wifi_ssid_hotlist_params params, wifi_hotlist_ssid_found_handler handler); + +/* Clear the SSID Hotlist */ +wifi_error wifi_reset_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface); + + + /* Significant wifi change */ typedef struct { mac_addr bssid; // BSSID @@ -218,9 +251,14 @@ wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interf /* Random MAC OUI for PNO */ wifi_error wifi_set_scanning_mac_oui(wifi_interface_handle handle, oui scan_oui); - -#define WIFI_PNO_FLAG_DIRECTED_SCAN = 1 // whether directed scan needs to be performed (for hidden SSIDs) -#define WIFI_PNO_FLAG_HASH_PROVIDED = 2 // whether a crc32 hash of the ssid is provided instead of the ssid +// Whether directed scan needs to be performed (for hidden SSIDs) +#define WIFI_PNO_FLAG_DIRECTED_SCAN = 1 +// Whether PNO event shall be triggered if the network is found on A band +#define WIFI_PNO_FLAG_A_BAND = 2 +// Whether PNO event shall be triggered if the network is found on G band +#define WIFI_PNO_FLAG_G_BAND = 4 +// Whether strict matching is required (i.e. firmware shall not match on the entire SSID) +#define WIFI_PNO_FLAG_STRICT_MATCH = 8 // Code for matching the beacon AUTH IE - additional codes TBD #define WIFI_PNO_AUTH_CODE_OPEN 1 // open @@ -228,39 +266,35 @@ wifi_error wifi_set_scanning_mac_oui(wifi_interface_handle handle, oui scan_oui) #define WIFI_PNO_AUTH_CODE_EAPOL 4 // any EAPOL // Enhanced PNO: -// for each network framework will either specify a ssid or a crc32 -// if ssid is specified (i.e. ssid[0] != 0) then crc32 field shall be ignored. +// Enhanced PNO feature is expected to be enabled all of the time (e.g. screen lit) and may thus +// requires firmware to store a large number of networks, covering the whole list of known network. +// Therefore, it is acceptable for firmware to store a crc24, crc32 or other short hash of the SSID, +// such that a low but non-zero probability of collision exist. With that scheme it should be +// possible for firmware to keep an entry as small as 4 bytes for each pno network. +// For instance, a firmware pn0 entry can be implemented in the form of: +// PNO ENTRY = crc24(3 bytes) | RSSI_THRESHOLD>>3 (5 bits) | auth flags(3 bits) +// // A PNO network shall be reported once, that is, once a network is reported by firmware -// its entry shall be marked as "done" until framework call wifi_set_epno_list. - // Calling wifi_set_epno_list shall reset the "done" status of pno networks in firmware. +// its entry shall be marked as "done" until framework calls wifi_set_epno_list again. +// Calling wifi_set_epno_list shall reset the "done" status of pno networks in firmware. typedef struct { - char ssid[32]; - char rssi_threshold; // threshold for considering this SSID as found - char flags; - int crc32; // crc32 of the SSID, this allows for memory size optimization - // i.e. not passing the whole SSID - // in firmware and instead storing a shorter string - char auth_bit_field; // auth bitfield for matching WPA IE + char ssid[32+1]; + char rssi_threshold; // threshold for considering this SSID as found, required granularity for + // this threshold is 4dBm to 8dBm + char flags; // WIFI_PNO_FLAG_XXX + char auth_bit_field; // auth bit field for matching WPA IE } wifi_epno_network; /* PNO list */ typedef struct { - int num_networks; // number of SSIDs + int num_networks; // number of SSIDs wifi_epno_network networks[]; // PNO networks } wifi_epno_params; typedef struct { - int network_index; // index of the network found in the pno list - char ssid[32+1]; // null terminated - wifi_channel channel; - int rssi; -} wifi_epno_result; - - -typedef struct { // on results void (*on_network_found)(wifi_request_id id, - unsigned num_results, wifi_epno_result *results); + unsigned num_results, wifi_scan_result *results); } wifi_epno_handler; @@ -272,7 +306,8 @@ wifi_error wifi_set_epno_list(wifi_request_id id, wifi_interface_handle iface, /* SSID white list */ /* Note that this feature requires firmware to be able to indicate to kernel sme and wpa_supplicant * that the SSID of the network has changed - * and thus requires further changed in cfg80211 stack, for instance, the below function would change: + * and thus requires further changed in cfg80211 stack, for instance, + * the below function would change: void __cfg80211_roamed(struct wireless_dev *wdev, struct cfg80211_bss *bss, @@ -288,10 +323,96 @@ typedef struct { wifi_error wifi_set_ssid_white_list(wifi_request_id id, wifi_interface_handle iface, int num_networks, wifi_ssid *ssids); + + +/* Set G-SCAN roam parameters */ +/** + * Firmware roaming is implemented with two modes: + * 1- "Alert" mode roaming, (Note: alert roaming is the pre-L roaming, whereas firmware is + * "urgently" hunting for another BSSID because the RSSI is low, or because many successive + * beacons have been lost or other bad link conditions). + * 2- "Lazy" mode, where firmware is hunting for a better BSSID or white listed SSID even though + * the RSSI of the link is good. + * Lazy mode is configured thru G-scan, that is, the results of G-scans are compared to the + * current RSSI and fed thru the roaming engine. + * Lazy scan will be enabled (and or throttled down by reducing the number of G-scans) by + * framework only in certain conditions, such as: + * - no real time (VO/VI) traffic at the interface + * - low packet rate for BE/BK packets a the interface + * - system conditions (screen lit/dark) etc... + * + * For consistency, the roam parameters will always be configured by framework such that: + * + * condition 1- A_band_boost_threshold >= (alert_roam_rssi_trigger + 10) + * This condition ensures that Lazy roam doesn't cause the device to roam to a 5GHz BSSID whose RSSI + * is lower than the alert threshold, which would consequently trigger a roam to a low RSSI BSSID, + * hence triggering alert mode roaming. + * In other words, in alert mode, the A_band parameters may safely be ignored by WiFi chipset. + * + * condition 2- A_band_boost_threshold > A_band_penalty_factor + * + */ + +/** + * Example: + * A_band_boost_threshold = -65 + * A_band_penalty_threshold = -75 + * A_band_boost_factor = 4 + * A_band_penalty_factor = 2 + * A_band_max_boost = 50 + * + * a 5GHz RSSI value is transformed as below: + * -20 -> -20+ 50 = 30 + * -60 -> -60 + 4 * (-60 - A_band_boost_threshold) = -60 + 16 = -44 + * -70 -> -70 + * -80 -> -80 - 2 * (A_band_penalty_threshold - (-80)) = -80 - 10 = -90 + */ + +typedef struct { + // Lazy roam parameters + // A_band_XX parameters are applied to 5GHz BSSIDs when comparing with a 2.4GHz BSSID + // they may not be applied when comparing two 5GHz BSSIDs + int A_band_boost_threshold; // RSSI threshold above which 5GHz RSSI is favored + int A_band_penalty_threshold; // RSSI threshold below which 5GHz RSSI is penalized + int A_band_boost_factor; // factor by which 5GHz RSSI is boosted + // boost=RSSI_measured-5GHz_boost_threshold)*5GHz_boost_factor + int A_band_penalty_factor; // factor by which 5GHz RSSI is penalized + // penalty=(5GHz_penalty_factor-RSSI_measured)*5GHz_penalty_factor + int A_band_max_boost; // maximum boost that can be applied to a 5GHz RSSI + + // Hysteresis: ensuring the currently associated BSSID is favored + // so as to prevent ping-pong situations + int lazy_roam_histeresys; // boost applied to current BSSID + + // Alert mode enable, i.e. configuring when firmware enters alert mode + int alert_roam_rssi_trigger; // RSSI below which "Alert" roam is enabled +} wifi_roam_params; + +wifi_error wifi_set_gscan_roam_params(wifi_request_id id, wifi_interface_handle iface, + wifi_roam_params * params); + +/** + * Enable/Disable "Lazy" roam + */ +wifi_error wifi_set_lazy_roam(wifi_request_id id, wifi_interface_handle iface, int enable); + +/** + * Per BSSID preference + */ +typedef struct { + char bssid[6]; + int rssi_modifier; // modifier applied to the RSSI of the BSSIDfor the purpose of comparing + // it with other roam candidate +} wifi_bssid_preference; + +wifi_error wifi_set_lazy_roam(wifi_request_id id, wifi_interface_handle iface, + int num_bssid, wifi_bssid_preference *prefs); + + typedef struct { - int max_number_epno_networks_by_crc32; //max number of epno entries if crc32 is specified - int max_number_epno_networks_by_ssid; //max number of epno entries if ssid is specified - int max_number_of_white_losted_ssid; //max number of white listed SSIDs, M target is 2 to 4 */ + int max_number_epno_networks; // max number of epno entries, M target is 64 + int max_number_of_white_listed_ssid; // max number of white listed SSIDs, M target is 2 to 4 + int max_number_of_hotlist_ssid; // max number of hotlist SSIDs, M target is 4 } wifi_roam_autojoin_offload_capabilities; wifi_error wifi_get_roam_autojoin_offload_capabilities(wifi_interface_handle handle, diff --git a/include/hardware_legacy/rtt.h b/include/hardware_legacy/rtt.h index 343f554..d2c548c 100644 --- a/include/hardware_legacy/rtt.h +++ b/include/hardware_legacy/rtt.h @@ -1,5 +1,6 @@ #include "wifi_hal.h" +#include "gscan.h" #ifndef __WIFI_HAL_RTT_H__ #define __WIFI_HAL_RTT_H__ @@ -11,11 +12,15 @@ typedef enum { RTT_STATUS_SUCCESS, RTT_STATUS_FAILURE, RTT_STATUS_FAIL_NO_RSP, + RTT_STATUS_FAIL_INVALID_TS, // Invalid T1-T4 timestamp + RTT_STATUS_FAIL_PROTOCOL, // 11mc protocol failed RTT_STATUS_FAIL_REJECTED, RTT_STATUS_FAIL_NOT_SCHEDULED_YET, + RTT_STATUS_FAIL_SCHEDULE, // schedule failed RTT_STATUS_FAIL_TM_TIMEOUT, RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL, RTT_STATUS_FAIL_NO_CAPABILITY, + RTT_STATUS_FAIL_BUSY_TRY_LATER, //2 side RTT if other side temporarily busy RTT_STATUS_ABORTED } wifi_rtt_status; @@ -31,34 +36,52 @@ typedef enum { /* RTT configuration */ typedef struct { mac_addr addr; // peer device mac address - wifi_rtt_type type; // optional - rtt type hint. RTT_TYPE_INVALID implies best effort + wifi_rtt_type type; // optional - rtt type hint. + // RTT_TYPE_AUTO implies best effort wifi_peer_type peer; // optional - peer device hint (STA, P2P, AP) wifi_channel_info channel; // Required for STA-AP mode, optional for P2P, NBD etc. - byte continuous; // 0 = single shot or 1 = continuous ranging - unsigned interval; // interval of RTT measurement (unit ms) when continuous = true - unsigned num_measurements; // total number of RTT measurements when continuous = true - unsigned num_samples_per_measurement; // num of packets in each RTT measurement - unsigned num_retries_per_measurement; // num of retries if sampling fails + unsigned interval; // interval between RTT burst (unit ms). + // Only valid when multi_burst = 1 + unsigned num_burst; // total number of RTT bursts, 1 means single shot + unsigned num_frames_per_burst; // num of frames in each RTT burst + // for single side, measurement result num = frame number + // for 2 side RTT, measurement result num = frame number - 1 + unsigned num_retries_per_measurement_frame; // retry time for RTT MEASUREMENT frame + + //following fields are only valid for 2 side RTT + unsigned num_retries_per_ftmr; + byte LCI_request; // request LCI or not + byte LCR_request; // request LCR or not + unsigned burst_timeout; // unit of 250 us + byte preamble; // 0- Legacy,1- HT, 2-VHT + byte bw; //5, 10, 20, 40, 80,160 } wifi_rtt_config; -/* RTT results */ +/* RTT results*/ typedef struct { mac_addr addr; // device mac address - unsigned measurement_num; // measurement number in case of continuous ranging + unsigned burst_num; // # of burst inside a multi-burst request + unsigned measurement_number; // total RTT measurement Frames + unsigned success_number; // total successful RTT measurement Frames + byte number_per_burst_peer; //Max number of FTM numbers per burst the other side support, + //11mc only wifi_rtt_status status; // ranging status + byte retry_after_duration; // in s , 11mc only, only for RTT_STATUS_FAIL_BUSY_TRY_LATER, 1-31s wifi_rtt_type type; // RTT type - wifi_peer_type peer; // peer device type (P2P, AP) - wifi_channel_info channel; // channel information - wifi_rssi rssi; // rssi in 0.5 dB steps e.g. 143 implies -71.5 dB + wifi_rssi rssi; // average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB wifi_rssi rssi_spread; // rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional) wifi_rate tx_rate; // TX rate - wifi_timespan rtt; // round trip time in nanoseconds - wifi_timespan rtt_sd; // rtt standard deviation in nanoseconds + wifi_rate rx_rate; // Rx rate + wifi_timespan rtt; // round trip time in 0.1 nanoseconds + wifi_timespan rtt_sd; // rtt standard deviation in 0.1 nanoseconds wifi_timespan rtt_spread; // difference between max and min rtt times recorded int distance; // distance in cm (optional) int distance_sd; // standard deviation in cm (optional) int distance_spread; // difference between max and min distance recorded (optional) wifi_timestamp ts; // time of the measurement (in microseconds since boot) + int burst_duration; // in ms, How long the FW time is to finish one burst measurement + wifi_information_element LCI; // for 11mc only, optional + wifi_information_element LCR; // for 11mc only, optional } wifi_rtt_result; /* RTT result callback */ @@ -94,15 +117,59 @@ wifi_error wifi_rtt_channel_map_set(wifi_request_id id, DW interval and will also stop broadcasting NBD ranging attribute in SDF */ wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle iface); +#define PREAMBLE_LEGACY 0x1 +#define PREAMBLE_HT 0x2 +#define PREAMBLE_VHT 0x4 + +#define BW_5_SUPPORT 0x1 +#define BW_10_SUPPORT 0x2 +#define BW_20_SUPPORT 0x4 +#define BW_40_SUPPORT 0x8 +#define BW_80_SUPPORT 0x10 +#define BW_160_SUPPORT 0x20 + /* RTT Capabilities */ typedef struct { byte rtt_one_sided_supported; // if 1-sided rtt data collection is supported - byte rtt_11v_supported; // if 11v rtt data collection is supported byte rtt_ftm_supported; // if ftm rtt data collection is supported + byte lci_support; + byte lcr_support; + byte preamble_support; //bit mask indicate what preamble is supported + byte bw_support; //bit mask indicate what BW is supported } wifi_rtt_capabilities; /* RTT capabilities of the device */ wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, wifi_rtt_capabilities *capabilities); +/* debugging definitions */ +enum { + RTT_DEBUG_DISABLE, + RTT_DEBUG_LOG, + RTT_DEBUG_PROTO, + RTT_DEBUG_BURST, + RTT_DEBUG_ACCURACY, + RTT_DEBUG_LOGDETAIL +}; //rtt debug type + +enum { + RTT_DEBUG_FORMAT_TXT, + RTT_DEBUG_FORMAT_BINARY +}; //rtt debug format + +typedef struct rtt_debug { + unsigned version; + unsigned len; // total length of after len field + unsigned type; // rtt debug type + unsigned format; //rtt debug format + char dbuf[0]; // debug content +} rtt_debug_t; + +/* set configuration for debug */ +wifi_error wifi_rtt_debug_cfg(wifi_interface_handle h, unsigned rtt_dbg_type, char *cfgbuf, u32 cfg_buf_size); +/* get the debug information */ +wifi_error wifi_rtt_debug_get(wifi_interface_handle h, rtt_debug_t **debugbuf); +/* free the debug buffer */ +wifi_error wifi_rtt_debug_free(wifi_interface_handle h, rtt_debug_t *debugbuf); + #endif diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index be4e985..f4afb99 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -17,6 +17,10 @@ #ifndef __WIFI_HAL_H__ #define __WIFI_HAL_H__ +#ifdef __cplusplus +extern "C" +{ +#endif #include <stdint.h> typedef enum { @@ -47,10 +51,8 @@ typedef byte oui[3]; typedef int64_t wifi_timestamp; // In microseconds (us) typedef int64_t wifi_timespan; // In nanoseconds (ns) -struct wifi_info; -typedef wifi_info *wifi_handle; -struct wifi_interface_info; -typedef wifi_interface_info *wifi_interface_handle; +typedef struct wifi_info *wifi_handle; +typedef struct wifi_interface_info *wifi_interface_handle; /* Initialize/Cleanup */ @@ -131,5 +133,7 @@ wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); #include "wifi_config.h" #include "wifi_nan.h" +#ifdef __cplusplus +} #endif diff --git a/include/hardware_legacy/wifi_logger.h b/include/hardware_legacy/wifi_logger.h index d7b7cfb..f24545c 100644 --- a/include/hardware_legacy/wifi_logger.h +++ b/include/hardware_legacy/wifi_logger.h @@ -41,6 +41,7 @@ typedef struct { // packet, or packet headers only (up to TCP or RTP/UDP headers) will be copied into the ring
} wifi_ring_per_packet_status_entry;
+static char per_packet_status_ring_name[] = "wifi_per_packet_status"; // Ring buffer name for per-packet status ring
// Below events refer to the wifi_connectivity_event ring and shall be supported
@@ -121,7 +122,8 @@ typedef struct { u64 timestamp; //present if has_timestamp bit is set.
union {
u8 data[0];
- wifi_ring_buffer_driver_connectivity_event connectivity_event;
+ wifi_ring_buffer_driver_connectivity_event connectivity_event[0];
+ wifi_ring_per_packet_status_entry packet_status[0];
};
} wifi_ring_buffer_entry;
@@ -139,14 +141,31 @@ typedef struct { typedef struct {
u8 name[32];
u32 flags;
- u64 fd; // linux file descriptor for that buffer
+ wifi_ring_buffer_id ring_id; // unique integer representing the ring
u32 ring_buffer_byte_size; // total memory size allocated for the buffer
u32 verbose_level; //
u32 written_bytes; // number of bytes that was written to the buffer by driver, monotonously increasing integer
u32 read_bytes; // number of bytes that was read from the buffer by user land, monotonously increasing integer
+ u32 written_records; // number of records that was written to the buffer by driver, monotonously increasing integer
+
} wifi_ring_buffer_status;
/**
+ * Callback for reporting ring data
+ *
+ * The ring buffer data collection supports 2 modes:
+ * - polling : framework periodically calls wifi_get_ringdata()
+ * - event based: driver calls on_ring_buffer_data when new records are available
+ *
+ * The callback is called by driver whenever new data is
+ */
+typedef struct {
+ void (*on_ring_buffer_data) (wifi_request_id id, wifi_ring_buffer_id ring_id, char * buffer, int buffer_size, wifi_ring_buffer_status *status);
+} wifi_ring_buffer_data_handler;
+
+
+
+/**
* API to trigger the debug collection.
* Unless his API is invoked - logging is not triggered.
* - verbose_level 0 corresponds to no collection
@@ -154,7 +173,7 @@ typedef struct { *
* buffer_name represent the name of the ring for which data collection shall start.
*/
-wifi_error wifi_set_logging_level(wifi_interface_handle iface, u32 verbose_level, u8 * buffer_name);
+wifi_error wifi_set_logging_level(wifi_interface_handle iface, u32 verbose_level, u8 * buffer_name, wifi_ring_buffer_data_handler handler);
/* callback for reporting ring buffer status */
typedef struct {
@@ -178,6 +197,11 @@ wifi_error wifi_get_driver_version(wifi_request_id id, wifi_interface_handle iface, char * buffer, int buffer_size);
+/* api to collect driver records */
+wifi_error wifi_get_ringdata(wifi_request_id id,
+ wifi_interface_handle iface, wifi_ring_buffer_id ring_id, char * buffer, int buffer_size, wifi_ring_buffer_status *status);
+
+
/* Feature set */
#define WIFI_LOGGER_MEMORY_DUMP_SUPPORTED 1
#define WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORTED 2
diff --git a/uevent/uevent.c b/uevent/uevent.c index b9e3557..e40aa2e 100644 --- a/uevent/uevent.c +++ b/uevent/uevent.c @@ -16,6 +16,7 @@ #include <hardware_legacy/uevent.h> +#include <malloc.h> #include <string.h> #include <unistd.h> #include <poll.h> diff --git a/wifi/wifi.c b/wifi/wifi.c index 87be8d8..3e99715 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -34,10 +34,9 @@ #include "cutils/misc.h" #include "cutils/properties.h" #include "private/android_filesystem_config.h" -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> -#endif extern int do_dhcp(); extern int ifc_init(); @@ -405,10 +404,8 @@ int wifi_start_supplicant(int p2p_supported) { char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; int count = 200; /* wait at most 20 seconds for completion */ -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES const prop_info *pi; unsigned serial = 0, i; -#endif if (p2p_supported) { strcpy(supplicant_name, P2P_SUPPLICANT_NAME); @@ -447,7 +444,6 @@ int wifi_start_supplicant(int p2p_supported) /* Reset sockets used for exiting from hung state */ exit_sockets[0] = exit_sockets[1] = -1; -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES /* * Get a reference to the status property, so we can distinguish * the case where it goes stopped => running => stopped (i.e., @@ -459,14 +455,12 @@ int wifi_start_supplicant(int p2p_supported) if (pi != NULL) { serial = __system_property_serial(pi); } -#endif property_get("wifi.interface", primary_iface, WIFI_TEST_INTERFACE); property_set("ctl.start", supplicant_name); sched_yield(); while (count-- > 0) { -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES if (pi == NULL) { pi = __system_property_find(supplicant_prop_name); } @@ -483,12 +477,6 @@ int wifi_start_supplicant(int p2p_supported) } } } -#else - if (property_get(supplicant_prop_name, supp_status, NULL)) { - if (strcmp(supp_status, "running") == 0) - return 0; - } -#endif usleep(100000); } return -1; |