OSDN Git Service

fix to hal interface
authorPierre Vandwalle <vandwalle@google.com>
Wed, 18 Mar 2015 20:36:18 +0000 (13:36 -0700)
committerPierre Vandwalle <vandwalle@google.com>
Thu, 19 Mar 2015 02:36:15 +0000 (19:36 -0700)
Change-Id: I32f3e22fd19e79669ab8b117acd51352d132dbc3

include/hardware_legacy/gscan.h
include/hardware_legacy/wifi_logger.h

index 3cc8050..af74346 100644 (file)
@@ -22,6 +22,7 @@ const unsigned MAX_HOTLIST_APS             = 128;
 const unsigned MAX_SIGNIFICANT_CHANGE_APS  = 64;
 const unsigned MAX_PNO_SSID                = 128;
 const unsigned MAX_HOTLIST_SSID            = 8;
+const unsigned MAX_BLACKLIST_BSSID         = 16;
 
 wifi_error wifi_get_valid_channels(wifi_interface_handle handle,
         int band, int max_channels, wifi_channel *channels, int *num_channels);
@@ -33,7 +34,8 @@ typedef struct {
     int max_rssi_sample_size;                // number of RSSI samples used for averaging RSSI
     int max_scan_reporting_threshold;        // max possible report_threshold as described
                                              // in wifi_scan_cmd_params
-    int max_hotlist_aps;                     // maximum number of entries for hotlist APs
+    int max_hotlist_bssids;                  // maximum number of entries for hotlist BSSIDs
+    int max_hotlist_ssids;                   // maximum number of entries for hotlist SSIDs
     int max_significant_wifi_change_aps;     // maximum number of entries for
                                              // significant wifi change APs
     int max_bssid_history_entries;           // number of BSSID/RSSI entries that device can hold
@@ -172,7 +174,7 @@ typedef struct {
 
 typedef struct {
     int lost_ap_sample_size;
-    int num_ap;                                 // number of hotlist APs
+    int num_bssid;                                 // number of hotlist APs
     ap_threshold_param ap[MAX_HOTLIST_APS];     // hotlist APs
 } wifi_bssid_hotlist_params;
 
@@ -200,8 +202,8 @@ typedef struct {
 
 typedef struct {
     int lost_ssid_sample_size;
-    int num_ap;                                 // number of hotlist APs
-    ssid_threshold_param ssid[MAX_HOTLIST_APS];     // hotlist APs
+    int num_ssid;                                   // number of hotlist SSIDs
+    ssid_threshold_param ssid[MAX_HOTLIST_SSID];    // hotlist SSIDs
 } wifi_ssid_hotlist_params;
 
 
@@ -212,6 +214,18 @@ wifi_error wifi_set_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface
 /* Clear the SSID Hotlist */
 wifi_error wifi_reset_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface);
 
+
+/* BSSID blacklist */
+typedef struct {
+    int num_bssid;                           // number of blacklisted BSSIDs
+    mac_addr bssids[MAX_BLACKLIST_BSSID];    // blacklisted BSSIDs
+} wifi_bssid_params;
+
+/* Set the BSSID blacklist */
+wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface,
+        wifi_bssid_params params);
+
+
 /* Significant wifi change */
 typedef struct {
     mac_addr bssid;                     // BSSID
@@ -234,7 +248,7 @@ typedef struct {
     int rssi_sample_size;               // number of samples for averaging RSSI
     int lost_ap_sample_size;            // number of samples to confirm AP loss
     int min_breaching;                  // number of APs breaching threshold
-    int num_ap;                         // max 64
+    int num_bssid;                         // max 64
     ap_threshold_param ap[MAX_SIGNIFICANT_CHANGE_APS];
 } wifi_significant_change_params;
 
@@ -377,7 +391,7 @@ typedef struct {
 
     // Hysteresis: ensuring the currently associated BSSID is favored
     // so as to prevent ping-pong situations
-    int lazy_roam_histeresys;       // boost applied to current BSSID
+    int lazy_roam_hysteresis;       // 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
@@ -395,7 +409,7 @@ wifi_error wifi_enable_lazy_roam(wifi_request_id id, wifi_interface_handle iface
  * Per BSSID preference
  */
 typedef struct {
-    char bssid[6];
+    mac_addr bssid;
     int rssi_modifier;  // modifier applied to the RSSI of the BSSID for the purpose of comparing
                         // it with other roam candidate
 } wifi_bssid_preference;
index 48f18b9..ceb8401 100644 (file)
@@ -36,13 +36,15 @@ extern "C"
 typedef int wifi_radio;\r
 typedef int wifi_ring_buffer_id;\r
 \r
+#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX 1 //  0: TX, 1: RX\r
+#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS 2 // whether packet was transmitted or received/decrypted successfully\r
+#define PER_PACKET_ENTRY_FLAGS_80211_HEADER 4 // has full 802.11 header, else has 802.3 header\r
+#define PER_PACKET_ENTRY_FLAGS_PROTECTED 8  // whether packet was encrypted\r
+\r
 typedef struct {\r
-    u8 direction:1; //  0: TX, 1: RX\r
-    u8 success:1; // whether packet was transmitted or received/decrypted successfully\r
-    u8 has_80211_header:1; // has full 802.11 header, else has 802.3 header\r
-    u8 protected_packet:1; // whether packet was encrypted\r
-    u8 tid:4; // transmit  or received tid\r
-    u8 MCS; // modulation and bandwidth\r
+    u8 flags;\r
+    u8 tid; // transmit or received tid\r
+    u16 MCS; // modulation and bandwidth\r
     u8 rssi; // TX: RSSI of ACK for that packet\r
              // RX: RSSI of packet\r
     u8 num_retries; // number of attempted retries\r
@@ -60,7 +62,7 @@ typedef struct {
     u8 data[0]; // packet data. The length of packet data is determined by the entry_size field of\r
                 // the wifi_ring_buffer_entry structure. It is expected that first bytes of the\r
                 // packet, or packet headers only (up to TCP or RTP/UDP headers) will be copied into the ring\r
-} wifi_ring_per_packet_status_entry;\r
+} wifi_ring_per_packet_status_entry __attribute__((packed));\r
 \r
 static char per_packet_status_ring_name[] = "wifi_per_packet_status"; // Ring buffer name for per-packet status ring\r
 \r
@@ -134,7 +136,7 @@ typedef struct {
     u16 tag;\r
     u16 length; // length of value\r
     u8 value[0];\r
-} tlv_log;\r
+} tlv_log __attribute__((packed));\r
 \r
 typedef struct {\r
     u16 event;\r
@@ -143,7 +145,7 @@ typedef struct {
                         // parameter as transmit rate, num retries, num scan result found etc...\r
                         // as well, event_data can include a vendor proprietary part which is\r
                         // understood by the developer only.\r
-} wifi_ring_buffer_driver_connectivity_event;\r
+} wifi_ring_buffer_driver_connectivity_event __attribute__((packed));\r
 \r
 // Ring buffer name for connectivity events ring\r
 static char connectivity_event_ring_name[] = "wifi_connectivity_events";\r
@@ -155,16 +157,15 @@ typedef struct {
     int status;   // 0 taken, 1 released\r
     int reason;   // reason why this wake lock is taken\r
     char name[0]; // null terminated\r
-} wake_lock_event;\r
+} wake_lock_event __attribute__((packed));\r
 \r
 typedef struct {\r
     u16 event;\r
     tlv_log tlvs[0];\r
-} wifi_power_event;\r
+} wifi_power_event __attribute__((packed));\r
 \r
 static char power_event_ring_name[] = "wifi_power_events";\r
 \r
-\r
 /**\r
  * This structure represent a logger entry within a ring buffer.\r
  * Wifi driver are responsible to manage the ring buffer and write the debug\r
@@ -180,23 +181,25 @@ static char power_event_ring_name[] = "wifi_power_events";
  * data logged by drivers into their ring buffer, store the data into log files and include\r
  * the logs into android bugreports.\r
  */\r
+\r
+#define RING_BUFFER_ENTRY_FLAGS_HAS_BINARY 1 // set for binary entries\r
+#define RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP 2 // set if 64 bits timestamp is present\r
+\r
 typedef struct {\r
-    u16 entry_size:13;\r
-    u16 binary:1; //set for binary entries\r
-    u16 has_timestamp:1; //set if 64 bits timestamp is present\r
-    u16 reserved:1;\r
+    u16 entry_size;\r
+    u8 flags;\r
     u8 type; // Per ring specific\r
-    u8 resvd;\r
     u64 timestamp; //present if has_timestamp bit is set.\r
     union {\r
         u8 data[0];\r
         wifi_ring_buffer_driver_connectivity_event connectivity_event;\r
         wifi_ring_per_packet_status_entry packet_status;\r
+        wifi_power_event power_event;\r
         };\r
-} wifi_ring_buffer_entry;\r
+} wifi_ring_buffer_entry __attribute__((packed));\r
 \r
 #define WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES 0x00000001     // set if binary entries are present\r
-#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRI    0x00000002     // set if ascii entries are present\r
+#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES  0x00000002     // set if ascii entries are present\r
 \r
 /* ring buffer params */\r
 /**\r
@@ -268,15 +271,15 @@ wifi_error wifi_get_ring_buffers_status(wifi_request_id id,
 \r
 /* api to collect a firmware memory dump for a given iface */\r
 wifi_error wifi_get_firmware_memory_dump(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char ** buffer, int *buffer_size);\r
 \r
 /* api to collect a firmware version string */\r
 wifi_error wifi_get_firmware_version(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char *buffer, int buffer_size);\r
 \r
 /* api to collect a driver version string */\r
 wifi_error wifi_get_driver_version(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char *buffer, int buffer_size);\r
 \r
 \r
 /* api to collect driver records */\r