Don't set antenna mask for devices that don't support it

Newer iwlwifi parts don't support this antenna mask, and
attempting to set it causes test to fail when the command
errors out complaining about this.  Work around this by
not setting the antenna mask if that operation is not supported.

BUG=chromium:377044
TEST=iwlwifi based parts can set up APs in the 2.4Ghz range after
this patch.

Change-Id: Ife691640c8961d7c19d8a1688718fecd4abe9e04
Reviewed-on: https://chromium-review.googlesource.com/203960
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/client/common_lib/cros/network/iw_runner.py b/client/common_lib/cros/network/iw_runner.py
index 2aa889d..5b4d831 100644
--- a/client/common_lib/cros/network/iw_runner.py
+++ b/client/common_lib/cros/network/iw_runner.py
@@ -45,7 +45,8 @@
 #   max_scan_ssids: Maximum number of SSIDs which can be scanned at once.
 IwPhy = collections.namedtuple(
     'Phy', ['name', 'bands', 'modes', 'commands', 'max_scan_ssids',
-            'avail_tx_antennas', 'avail_rx_antennas'])
+            'avail_tx_antennas', 'avail_rx_antennas',
+            'supports_setting_antenna_mask'])
 
 DEFAULT_COMMAND_IW = 'iw'
 
@@ -290,7 +291,8 @@
                             tuple(pending_phy_commands),
                             pending_phy_max_scan_ssids,
                             pending_phy_tx_antennas,
-                            pending_phy_rx_antennas)
+                            pending_phy_rx_antennas,
+                            pending_phy_tx_antennas and pending_phy_rx_antennas)
             all_phys.append(new_phy)
 
         for line in output.splitlines():
diff --git a/server/site_linux_router.py b/server/site_linux_router.py
index 23935f9..884c2f7 100644
--- a/server/site_linux_router.py
+++ b/server/site_linux_router.py
@@ -155,7 +155,7 @@
         hostapd_conf_dict = configuration.generate_dict(
                 interface, control_interface,
                 self._build_unique_ssid(configuration.ssid_suffix))
-        logging.info('Starting hostapd with parameters: %r', hostapd_conf_dict)
+        logging.debug('hostapd parameters: %r', hostapd_conf_dict)
 
         # Generate hostapd.conf.
         self.router.run("cat <<EOF >%s\n%s\nEOF\n" %
@@ -163,7 +163,9 @@
             "%s=%s" % kv for kv in hostapd_conf_dict.iteritems())))
 
         # Run hostapd.
-        logging.info("Starting hostapd...")
+        logging.info('Starting hostapd on %s(%s) channel=%s...',
+                     interface, self.iw_runner.get_interface(interface).phy,
+                     configuration.channel)
         self.router.run('rm %s' % log_file, ignore_status=True)
         self.router.run('stop wpasupplicant', ignore_status=True)
         start_command = '%s -dd -t %s &> %s & echo $!' % (
diff --git a/server/site_linux_system.py b/server/site_linux_system.py
index 45574c2..3739a55 100644
--- a/server/site_linux_system.py
+++ b/server/site_linux_system.py
@@ -349,12 +349,16 @@
 
         """
         for phy in self.phy_list:
+            if not phy.supports_setting_antenna_mask:
+                continue
             self.iw_runner.set_antenna_bitmap(phy.name, tx_bitmap, rx_bitmap)
 
 
     def set_default_antenna_bitmap(self):
         """Setup default antenna bitmaps for all the phys."""
         for phy in self.phy_list:
+            if not phy.supports_setting_antenna_mask:
+                continue
             self.iw_runner.set_antenna_bitmap(phy.name, phy.avail_tx_antennas,
                                               phy.avail_rx_antennas)