[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 627: Add Broadcom Capri support

Message ID 20130620153518.32115.48783.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Tyler Baker June 20, 2013, 3:35 p.m.
Merge authors:
  Tyler Baker (tyler-baker)
Related merge proposals:
  https://code.launchpad.net/~tyler-baker/lava-dispatcher/capri-support/+merge/170186
  proposed by: Tyler Baker (tyler-baker)
  review: Approve - Dave Pigott (dpigott)
------------------------------------------------------------
revno: 627 [merge]
committer: Tyler Baker <tyler.baker@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2013-06-20 08:34:19 -0700
message:
  Add Broadcom Capri support
added:
  lava_dispatcher/default-config/lava-dispatcher/device-types/capri.conf
  lava_dispatcher/device/capri.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/capri.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/capri.conf	1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/capri.conf	2013-06-18 01:41:07 +0000
@@ -0,0 +1,46 @@ 
+client_type = capri
+
+# The ADB command line.
+#
+# In the case where there are multiple android devices plugged into a
+# single host, this connection command must be overriden on each device to
+# include the serial number of the device, e.g.
+#
+#   serial_number = XXXXXXXXXXXXXXXX
+#   adb_command = adb -s %(serial_number)s
+adb_command = adb
+
+# The fastboot command.
+#
+# The same as above: if you have more than one device, you will want to
+# override this in your device config to add a serial number, e.g.
+#
+#   serial_number = XXXXXXXXXXXXXXXX
+#   fastboot_command = fastboot -s %(serial_number)s
+#
+# Of course, in the case you override both adb_command *and* fastboot_command,
+# you don't need to specify `serial_number` twice.
+fastboot_command = fastboot
+
+# Working directory for temporary files. By default, the usual place for LAVA
+# images will be used.
+#
+# This is useful when the lava dispatcher is controlling the device under test which is
+# physically plugged to other machines by setting adb_command to something like
+# "ssh <phone-host> adb" and fastboot_command to something like "ssh
+# <phone-host> fastboot". adb and fastboot always operate on local files, so
+# you need your local files to also be seen as local files on the host where
+# adb/fastboot are executed.
+#
+# In this case, you should set shared_working_directory to a shared directory
+# between the machine running the dispatcher and the machine where the phone is
+# plugged.  This shared directory must have the same path in both machines.
+# For example, you can have your /var/tmp/lava mounted at /var/tmp/lava at
+# <phone-host> (or the other way around).
+shared_working_directory =
+
+connection_command = %(adb_command)s shell
+
+enable_network_after_boot_android = false
+android_adb_over_usb = true
+android_adb_over_tcp = false

=== added file 'lava_dispatcher/device/capri.py'
--- lava_dispatcher/device/capri.py	1970-01-01 00:00:00 +0000
+++ lava_dispatcher/device/capri.py	2013-06-18 19:34:56 +0000
@@ -0,0 +1,84 @@ 
+# Copyright (C) 2013 Linaro Limited
+#
+# Author: Tyler Baker <Tyler.Baker@linaro.org>
+#
+# This file is part of LAVA Dispatcher.
+#
+# LAVA Dispatcher is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LAVA Dispatcher is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along
+# with this program; if not, see <http://www.gnu.org/licenses>.
+
+import logging
+from lava_dispatcher.device.target import (
+    Target
+)
+from lava_dispatcher.device.fastboot import (
+    FastbootTarget
+)
+from lava_dispatcher.device.master import (
+     MasterImageTarget
+)
+
+class CapriTarget(FastbootTarget, MasterImageTarget):
+
+    def __init__(self, context, config):
+        super(CapriTarget, self).__init__(context, config)
+
+    def _enter_fastboot(self):
+        if self.fastboot.on():
+            logging.debug("Device is on fastboot - no need to hard reset")
+            return
+        try:
+            self._soft_reboot()
+            self._enter_bootloader()
+        except:
+            logging.exception("_enter_bootloader failed")
+            self._hard_reboot()
+            self._enter_bootloader()
+        self.proc.sendline("fastboot")
+
+
+    def deploy_android(self, boot, system, userdata):
+
+        boot = self._get_image(boot)
+        system = self._get_image(system)
+        userdata = self._get_image(userdata)
+
+        self._enter_fastboot()
+        self.fastboot.flash('boot', boot)
+        self.fastboot.flash('system', system)
+        self.fastboot.flash('userdata', userdata)
+
+        self.deployment_data = Target.android_deployment_data
+        self.deployment_data['boot_image'] = boot
+
+    def power_on(self):
+        if not self.deployment_data.get('boot_image', False):
+            raise CriticalError('Deploy action must be run first')
+
+        self._enter_fastboot()
+        self.fastboot('reboot')
+        self.proc.expect(self.context.device_config.master_str,
+                          timeout=300)
+
+        # The capri does not yet have adb support, so we do not wait for adb.
+        #self._adb('wait-for-device')
+
+        self._booted = True
+        self.proc.sendline("") # required to put the adb shell in a reasonable state
+        self.proc.sendline("export PS1='%s'" % self.deployment_data['TESTER_PS1'])
+        self._runner = self._get_runner(self.proc)
+
+        return self.proc
+
+target_class = CapriTarget