]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/workspace_tools/host_tests/host_tests_plugins/module_copy_silabs.py
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / workspace_tools / host_tests / host_tests_plugins / module_copy_silabs.py
1 """
2 mbed SDK
3 Copyright (c) 2011-2013 ARM Limited
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 """
17
18 from host_test_plugins import HostTestPluginBase
19
20
21 class HostTestPluginCopyMethod_Silabs(HostTestPluginBase):
22
23 # Plugin interface
24 name = 'HostTestPluginCopyMethod_Silabs'
25 type = 'CopyMethod'
26 capabilities = ['eACommander', 'eACommander-usb']
27 required_parameters = ['image_path', 'destination_disk']
28
29 def setup(self, *args, **kwargs):
30 """ Configure plugin, this function should be called before plugin execute() method is used.
31 """
32 self.EACOMMANDER_CMD = 'eACommander.exe'
33 return True
34
35 def execute(self, capabilitity, *args, **kwargs):
36 """ Executes capability by name.
37 Each capability may directly just call some command line
38 program or execute building pythonic function
39 """
40 result = False
41 if self.check_parameters(capabilitity, *args, **kwargs) is True:
42 image_path = kwargs['image_path']
43 destination_disk = kwargs['destination_disk']
44 if capabilitity == 'eACommander':
45 cmd = [self.EACOMMANDER_CMD,
46 '--serialno', destination_disk,
47 '--flash', image_path,
48 '--resettype', '2', '--reset']
49 result = self.run_command(cmd)
50 elif capabilitity == 'eACommander-usb':
51 cmd = [self.EACOMMANDER_CMD,
52 '--usb', destination_disk,
53 '--flash', image_path]
54 result = self.run_command(cmd)
55 return result
56
57
58 def load_plugin():
59 """ Returns plugin available in this module
60 """
61 return HostTestPluginCopyMethod_Silabs()
Imprint / Impressum