選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。

module_copy_silabs.py 2.2KB

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