]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/workspace_tools/host_tests/host_tests_plugins/module_reset_silabs.py
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / workspace_tools / host_tests / host_tests_plugins / module_reset_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 HostTestPluginResetMethod_SiLabs(HostTestPluginBase):
22
23 # Plugin interface
24 name = 'HostTestPluginResetMethod_SiLabs'
25 type = 'ResetMethod'
26 stable = True
27 capabilities = ['eACommander', 'eACommander-usb']
28 required_parameters = ['disk']
29
30 def setup(self, *args, **kwargs):
31 """ Configure plugin, this function should be called before plugin execute() method is used.
32 """
33 # Note you need to have eACommander.exe on your system path!
34 self.EACOMMANDER_CMD = 'eACommander.exe'
35 return True
36
37 def execute(self, capabilitity, *args, **kwargs):
38 """ Executes capability by name.
39 Each capability may directly just call some command line
40 program or execute building pythonic function
41 """
42 result = False
43 if self.check_parameters(capabilitity, *args, **kwargs) is True:
44 disk = kwargs['disk'].rstrip('/\\')
45
46 if capabilitity == 'eACommander':
47 # For this copy method 'disk' will be 'serialno' for eACommander command line parameters
48 # Note: Commands are executed in the order they are specified on the command line
49 cmd = [self.EACOMMANDER_CMD,
50 '--serialno', disk,
51 '--resettype', '2', '--reset',]
52 result = self.run_command(cmd)
53 elif capabilitity == 'eACommander-usb':
54 # For this copy method 'disk' will be 'usb address' for eACommander command line parameters
55 # Note: Commands are executed in the order they are specified on the command line
56 cmd = [self.EACOMMANDER_CMD,
57 '--usb', disk,
58 '--resettype', '2', '--reset',]
59 result = self.run_command(cmd)
60 return result
61
62
63 def load_plugin():
64 """ Returns plugin available in this module
65 """
66 return HostTestPluginResetMethod_SiLabs()
Imprint / Impressum