pytactl 3.2.0__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {pytactl-3.2.0/pytactl.egg-info → pytactl-3.3.0}/PKG-INFO +1 -1
  2. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/__init__.py +1 -1
  3. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/debugboard.py +9 -2
  4. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/service.py +52 -11
  5. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_65.pinout.json +1 -1
  6. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_7.pinout.json +1 -1
  7. {pytactl-3.2.0 → pytactl-3.3.0/pytactl.egg-info}/PKG-INFO +1 -1
  8. {pytactl-3.2.0 → pytactl-3.3.0}/tests/test_script_parsing.py +27 -0
  9. {pytactl-3.2.0 → pytactl-3.3.0}/LICENSE +0 -0
  10. {pytactl-3.2.0 → pytactl-3.3.0}/README.md +0 -0
  11. {pytactl-3.2.0 → pytactl-3.3.0}/pyproject.toml +0 -0
  12. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/cli.py +0 -0
  13. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/installconfigs.py +0 -0
  14. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/shell.py +0 -0
  15. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/README.md +0 -0
  16. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_13.pinout.json +0 -0
  17. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_15.pinout.json +0 -0
  18. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_16.pinout.json +0 -0
  19. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_18.pinout.json +0 -0
  20. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_19.pinout.json +0 -0
  21. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_20.pinout.json +0 -0
  22. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_21.pinout.json +0 -0
  23. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_22.pinout.json +0 -0
  24. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_23.pinout.json +0 -0
  25. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_25.pinout.json +0 -0
  26. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_26.pinout.json +0 -0
  27. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_27.pinout.json +0 -0
  28. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_28.pinout.json +0 -0
  29. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_29.pinout.json +0 -0
  30. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_30.pinout.json +0 -0
  31. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_32.pinout.json +0 -0
  32. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_33.pinout.json +0 -0
  33. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_36.pinout.json +0 -0
  34. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_37.pinout.json +0 -0
  35. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_38.pinout.json +0 -0
  36. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_39.pinout.json +0 -0
  37. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_40.pinout.json +0 -0
  38. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_41.pinout.json +0 -0
  39. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_42.pinout.json +0 -0
  40. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_45.pinout.json +0 -0
  41. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_48.pinout.json +0 -0
  42. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_49.pinout.json +0 -0
  43. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_51.pinout.json +0 -0
  44. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_52.pinout.json +0 -0
  45. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_55.pinout.json +0 -0
  46. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_56.pinout.json +0 -0
  47. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_60.pinout.json +0 -0
  48. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_63.pinout.json +0 -0
  49. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_64.pinout.json +0 -0
  50. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_67.pinout.json +0 -0
  51. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_69.pinout.json +0 -0
  52. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_70.pinout.json +0 -0
  53. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_71.pinout.json +0 -0
  54. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_72.pinout.json +0 -0
  55. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_73.pinout.json +0 -0
  56. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_77.pinout.json +0 -0
  57. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_FTDI_78.pinout.json +0 -0
  58. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PIC32CXAuto_54.pinout.json +0 -0
  59. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PIC32CXAuto_81.pinout.json +0 -0
  60. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PIC32CXAuto_85.pinout.json +0 -0
  61. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_14.pinout.json +0 -0
  62. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_17.pinout.json +0 -0
  63. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_24.pinout.json +0 -0
  64. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_31.pinout.json +0 -0
  65. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_35.pinout.json +0 -0
  66. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_44.pinout.json +0 -0
  67. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_57.pinout.json +0 -0
  68. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_66.pinout.json +0 -0
  69. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_74.pinout.json +0 -0
  70. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_82.pinout.json +0 -0
  71. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/TAC_PSOC_87.pinout.json +0 -0
  72. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tac_configs/devicelist.json +0 -0
  73. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl/tacconfig.py +0 -0
  74. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl.egg-info/SOURCES.txt +0 -0
  75. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl.egg-info/dependency_links.txt +0 -0
  76. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl.egg-info/entry_points.txt +0 -0
  77. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl.egg-info/requires.txt +0 -0
  78. {pytactl-3.2.0 → pytactl-3.3.0}/pytactl.egg-info/top_level.txt +0 -0
  79. {pytactl-3.2.0 → pytactl-3.3.0}/setup.cfg +0 -0
  80. {pytactl-3.2.0 → pytactl-3.3.0}/tests/test_config_loading.py +0 -0
  81. {pytactl-3.2.0 → pytactl-3.3.0}/tests/test_create_board.py +0 -0
  82. {pytactl-3.2.0 → pytactl-3.3.0}/tests/test_smoke.py +0 -0
  83. {pytactl-3.2.0 → pytactl-3.3.0}/tests/test_tacconfig.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytactl
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: Python Test Automation Controller (TAC/Alpaca) for Qualcomm debug boards
5
5
  Author-email: "Qualcomm Technologies, Inc." <qc.opensource@qti.qualcomm.com>
6
6
  Maintainer-email: Milosz Wasilewski <milosz.wasilewski@oss.qualcomm.com>
@@ -5,7 +5,7 @@ import os
5
5
 
6
6
  import platformdirs
7
7
 
8
- __version__ = "3.2.0"
8
+ __version__ = "3.3.0"
9
9
 
10
10
  # Configs bundled with the package: a .pinout.json per board plus
11
11
  # devicelist.json, synced from upstream with the fixes pytactl needs.
@@ -296,13 +296,20 @@ class Board(dict):
296
296
  new_script = name_re.sub(new_name, new_script)
297
297
 
298
298
  # replace variables with actual values
299
+ # Match each "$name" only as a whole token: without the trailing
300
+ # (?!\w), substituting "$edl" would also rewrite the start of
301
+ # "$edl_long". The value is passed through a function so that it is
302
+ # inserted literally rather than parsed as a replacement template.
299
303
  variables = self.full_config.get("variables", [])
300
304
  for variable in variables:
301
305
  # create global variables
302
306
  var_name = variable.get("name")
303
307
  if var_name:
304
- var_re = re.compile(rf"\${var_name}")
305
- new_script = var_re.sub(variable["default_value"], new_script)
308
+ var_re = re.compile(rf"\${re.escape(var_name)}(?!\w)")
309
+ value = str(variable["default_value"])
310
+ new_script = var_re.sub(
311
+ lambda _match, value=value: value, new_script
312
+ )
306
313
 
307
314
  # A "$name" left over is a variable the script uses but the config
308
315
  # never declares, so there is no value to substitute. Say which,
@@ -4,10 +4,11 @@
4
4
  # SPDX-License-Identifier: BSD-3-Clause
5
5
 
6
6
  import logging
7
+ from concurrent.futures import ThreadPoolExecutor
7
8
 
8
9
  from flask import Flask
9
10
  from flask_restful import Api, Resource, reqparse
10
- from werkzeug.exceptions import BadRequest
11
+ from werkzeug.exceptions import BadRequest, NotFound
11
12
  from werkzeug.serving import run_simple
12
13
 
13
14
  from .debugboard import Board, TACException
@@ -17,6 +18,9 @@ api = Api(app)
17
18
 
18
19
  logger = logging.getLogger()
19
20
  boards = {}
21
+ # One single-worker executor per board: requests for the same board are
22
+ # executed one at a time in FIFO order, different boards run in parallel.
23
+ executors = {}
20
24
 
21
25
  rparser = reqparse.RequestParser()
22
26
  rparser.add_argument(
@@ -24,6 +28,24 @@ rparser.add_argument(
24
28
  )
25
29
 
26
30
 
31
+ def get_board(boardid):
32
+ b = boards.get(boardid)
33
+ if b is None:
34
+ raise NotFound(f"unknown board {boardid}")
35
+ return b
36
+
37
+
38
+ def run_on_board(boardid, fn):
39
+ b = get_board(boardid)
40
+ return executors[boardid].submit(fn, b).result()
41
+
42
+
43
+ def snapshot_pins(b):
44
+ # Copy while still on the board worker so the response isn't mutated by
45
+ # the next queued request during serialization.
46
+ return {k: dict(v) for k, v in b.pins.items()}
47
+
48
+
27
49
  class BoardView(Resource):
28
50
  def get(self, boardid):
29
51
  return boards.get(boardid, {})
@@ -42,13 +64,19 @@ class QuickMethodView(Resource):
42
64
  return {}
43
65
 
44
66
  def put(self, boardid, name):
45
- b = boards.get(boardid, {})
46
- if b:
67
+ # name comes from the URL: only dispatch to registered quick methods,
68
+ # never to arbitrary Board attributes.
69
+ if name not in get_board(boardid).quick_methods:
70
+ raise NotFound(f"unknown quick method {name}")
71
+
72
+ def job(b):
47
73
  try:
48
74
  getattr(b, name)()
49
75
  except Exception:
50
76
  raise TACException
51
- return b.pins
77
+ return snapshot_pins(b)
78
+
79
+ return run_on_board(boardid, job)
52
80
 
53
81
 
54
82
  class QuickMethodList(Resource):
@@ -71,15 +99,21 @@ class CommandView(Resource):
71
99
  value = args.get("value")
72
100
  if value is None:
73
101
  raise BadRequest("insufficient parameters")
74
- b = boards.get(boardid, {})
75
- if b:
102
+ # name comes from the URL: only dispatch to registered commands,
103
+ # never to arbitrary Board attributes.
104
+ if name not in get_board(boardid).commands:
105
+ raise NotFound(f"unknown command {name}")
106
+
107
+ def job(b):
76
108
  try:
77
109
  c = getattr(b, name)
78
110
  if c:
79
111
  c(value)
80
112
  except Exception:
81
113
  raise TACException
82
- return b.pins
114
+ return snapshot_pins(b)
115
+
116
+ return run_on_board(boardid, job)
83
117
 
84
118
 
85
119
  class CommandList(Resource):
@@ -102,11 +136,15 @@ class PinView(Resource):
102
136
  value = args.get("value")
103
137
  if value is None:
104
138
  raise BadRequest("insufficient parameters")
105
- b = boards.get(boardid, {})
106
- if b:
139
+
140
+ def job(b):
107
141
  p = b.pins.get(pinid)
142
+ if p is None:
143
+ raise NotFound(f"unknown pin {pinid}")
108
144
  p.set(value)
109
- return b.pins.get(pinid)
145
+ return dict(p)
146
+
147
+ return run_on_board(boardid, job)
110
148
 
111
149
 
112
150
  class PinList(Resource):
@@ -148,5 +186,8 @@ api.add_resource(CommandList, "/<boardid>/command")
148
186
  def run_service(serials, tac_config_path, hostname="0.0.0.0", port=5000):
149
187
  for serial in serials:
150
188
  boards.update({serial: Board.create_board(serial, tac_config_path)})
189
+ executors[serial] = ThreadPoolExecutor(
190
+ max_workers=1, thread_name_prefix=f"board-{serial}"
191
+ )
151
192
 
152
- run_simple(hostname, port, app)
193
+ run_simple(hostname, port, app, threaded=True)
@@ -39,7 +39,7 @@
39
39
  "platform_id": 65,
40
40
  "platform_type": "FTDI",
41
41
  "reset_enabled": false,
42
- "script": "def powerOffTheDevice() \n\tlogComment ====== powerOffTheDevice sequence start ======\n\n\tbattery 1\n\tusb0 1\n\tusb1 1\n\n\tlogComment ====== powerOffTheDevice sequence finish ======\n\ndef powerOnTheDevice()\n\tlogComment ====== powerOnTheDevice sequence start ======\n\n\tdelay 500\n\tbattery 0\n\tdelay 900\n\tusb0 0\n\tusb1 0\n\tdelay 30\n\n\tlogComment ====== powerOnTheDevice sequence finish ======\n\ndef powerOff()\n\tlogComment ====== powerOff start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 0\n\n\tlogComment ====== powerOff finish ======\n\ndef powerOn()\n\tlogComment ====== powerOn start ======\n\n\tpowerOff\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tlogComment ====== powerOn finish ======\n\ndef bootToEDL()\n\tlogComment ====== bootToEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tpedl 0\n\n\tlogComment ====== bootToEDL finish ======\n\ndef bootToSecondaryEDL()\n\tlogComment ====== bootToSecondaryEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tsedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tdelay 1300\n\n\tsedl 0\n\n\tlogComment ====== bootToSecondaryEDL finish ======\n\ndef bootToBatteryEDL()\n\tlogComment ====== bootToBatteryEDL start ======\n\t\n\tpedl 1 //set EDL high\n\tvoldn 1 //reset MTP after 115 seconds\n\tdelay 14000\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\t\n\t//reset buttons\n\tdelay 6000\n\tvoldn 0 \n\tpedl 0\n\n\tlogComment ====== bootToBatteryEDL finish ======\n\ndef bootToUEFI()\n\tlogComment ====== bootToUEFIMenu start ======\n\n\tpowerOffTheDevice\n\n\t// Put buttons in a set state\n\tpkey 0\n\tvolup 1\n\tvoldn 0\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\tdelay 1500 //requires at least 700ms for pd controller negotiation\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\tvolup 0\n\tdelay 12\n\tpkey 1\n\tvolup 1\n\n\tpkey 0\n\tvolup 0\n\n\tlogComment ====== bootToUEFIMenu finish ======\n\ndef bootToFastboot()\n\tlogComment ====== bootToFastboot start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 1\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 2000\n\tpkey 0\n\n\tdelay 6000\n\tvoldn 0\n\tdelay 30\n\tvoldn 1\n\n\tvoldn 0\n\n\tlogComment ====== bootToFastboot finished ======\n\ndef batteryReset()\n\tlogComment ====== batteryReset ======\n\t\n\tpedl 0 //reset EDL\n\tvoldn 1 //reset MTP after 14 seconds\n\tdelay 14000\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tdelay 6000\n\tvoldn 0 //release voldn to stop MTP reset\n\n\tlogComment ====== batteryReset ======",
42
+ "script": "def powerOffTheDevice() \n\tlogComment ====== powerOffTheDevice sequence start ======\n\n\tbattery 1\n\tusb0 1\n\n\tlogComment ====== powerOffTheDevice sequence finish ======\n\ndef powerOnTheDevice()\n\tlogComment ====== powerOnTheDevice sequence start ======\n\n\tdelay 500\n\tbattery 0\n\tdelay 900\n\tusb0 0\n\tdelay 30\n\n\tlogComment ====== powerOnTheDevice sequence finish ======\n\ndef powerOff()\n\tlogComment ====== powerOff start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 0\n\n\tlogComment ====== powerOff finish ======\n\ndef powerOn()\n\tlogComment ====== powerOn start ======\n\n\tpowerOff\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tlogComment ====== powerOn finish ======\n\ndef bootToEDL()\n\tlogComment ====== bootToEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tpedl 0\n\n\tlogComment ====== bootToEDL finish ======\n\ndef bootToSecondaryEDL()\n\tlogComment ====== bootToSecondaryEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tsedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tdelay 1300\n\n\tsedl 0\n\n\tlogComment ====== bootToSecondaryEDL finish ======\n\ndef bootToBatteryEDL()\n\tlogComment ====== bootToBatteryEDL start ======\n\t\n\tpedl 1 //set EDL high\n\tvoldn 1 //reset MTP after 115 seconds\n\tdelay 14000\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\t\n\t//reset buttons\n\tdelay 6000\n\tvoldn 0 \n\tpedl 0\n\n\tlogComment ====== bootToBatteryEDL finish ======\n\ndef bootToUEFI()\n\tlogComment ====== bootToUEFIMenu start ======\n\n\tpowerOffTheDevice\n\n\t// Put buttons in a set state\n\tpkey 0\n\tvolup 1\n\tvoldn 0\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\tdelay 1500 //requires at least 700ms for pd controller negotiation\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\tvolup 0\n\tdelay 12\n\tpkey 1\n\tvolup 1\n\n\tpkey 0\n\tvolup 0\n\n\tlogComment ====== bootToUEFIMenu finish ======\n\ndef bootToFastboot()\n\tlogComment ====== bootToFastboot start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 1\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 2000\n\tpkey 0\n\n\tdelay 6000\n\tvoldn 0\n\tdelay 30\n\tvoldn 1\n\n\tvoldn 0\n\n\tlogComment ====== bootToFastboot finished ======\n\ndef batteryReset()\n\tlogComment ====== batteryReset ======\n\t\n\tpedl 0 //reset EDL\n\tvoldn 1 //reset MTP after 14 seconds\n\tdelay 14000\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tdelay 6000\n\tvoldn 0 //release voldn to stop MTP reset\n\n\tlogComment ====== batteryReset ======",
43
43
  "usb_descriptor": "ALPACA-LITE MTP8975",
44
44
  "pins": [
45
45
  {
@@ -13,7 +13,7 @@
13
13
  "platform_id": 7,
14
14
  "platform_type": "PSOC",
15
15
  "reset_enabled": true,
16
- "script": "def powerOffTheDevice() \n\tlogComment ====== powerOffTheDevice sequence start ======\n\n\tbattery 1\n\tusb0 1\n\tusb1 1\n\n\tlogComment ====== powerOffTheDevice sequence finish ======\n\ndef powerOnTheDevice()\n\tlogComment ====== powerOnTheDevice sequence start ======\n\n\tdelay 500\n\tbattery 0\n\tdelay 900\n\tusb0 0\n\tusb1 0\n\tdelay 30\n\n\tlogComment ====== powerOnTheDevice sequence finish ======\n\ndef powerOff()\n\tlogComment ====== powerOff start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 0\n\n\tlogComment ====== powerOff finish ======\n\ndef powerOn()\n\tlogComment ====== powerOn start ======\n\n\tpowerOff\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tlogComment ====== powerOn finish ======\n\ndef bootToEDL()\n\tlogComment ====== bootToEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tpedl 0\n\n\tlogComment ====== bootToEDL finish ======\n\ndef bootToSecondaryEDL()\n\tlogComment ====== bootToSecondaryEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tsedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tdelay 1300\n\n\tsedl 0\n\n\tlogComment ====== bootToSecondaryEDL finish ======\n\ndef bootToUEFI()\n\tlogComment ====== bootToUEFIMenu start ======\n\n\tpowerOffTheDevice\n\n\t// Put buttons in a set state\n\tpkey 0\n\tvolup 1\n\tvoldn 0\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\tvolup 0\n\tdelay 12\n\tpkey 1\n\tvolup 1\n\n\tpkey 0\n\tvolup 0\n\n\tlogComment ====== bootToUEFIMenu finish ======\n\ndef bootToFastBoot()\n\tlogComment ====== bootToFastBoot start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 1\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\n\tdelay 8000\n\tvoldn 0\n\tdelay 30\n\tvoldn 1\n\n\tvoldn 0\n\n\tlogComment ====== bootToFastBoot finished ======\n",
16
+ "script": "def powerOffTheDevice() \n\tlogComment ====== powerOffTheDevice sequence start ======\n\n\tbattery 1\n\tusb0 1\n\tusb1 1\n\n\tlogComment ====== powerOffTheDevice sequence finish ======\n\ndef powerOnTheDevice()\n\tlogComment ====== powerOnTheDevice sequence start ======\n\n\tdelay 500\n\tbattery 0\n\tdelay 900\n\tusb0 0\n\tusb1 0\n\tdelay 30\n\n\tlogComment ====== powerOnTheDevice sequence finish ======\n\ndef powerOff()\n\tlogComment ====== powerOff start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 0\n\n\tlogComment ====== powerOff finish ======\n\ndef powerOn()\n\tlogComment ====== powerOn start ======\n\n\tpowerOff\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tlogComment ====== powerOn finish ======\n\ndef bootToEDL()\n\tlogComment ====== bootToEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tpedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 1300\n\tpkey 0\n\n\tdelay 10000\n\tpedl 0\n\n\tlogComment ====== bootToEDL finish ======\n\ndef bootToSecondaryEDL()\n\tlogComment ====== bootToSecondaryEDL start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 0\n\n\tsedl 1\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 800\n\tpkey 0\n\n\tdelay 1300\n\n\tsedl 0\n\n\tlogComment ====== bootToSecondaryEDL finish ======\n\ndef bootToUEFI()\n\tlogComment ====== bootToUEFIMenu start ======\n\n\tpowerOffTheDevice\n\n\t// Put buttons in a set state\n\tpkey 0\n\tvolup 1\n\tvoldn 0\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\tvolup 0\n\tdelay 12\n\tpkey 1\n\tvolup 1\n\n\tpkey 0\n\tvolup 0\n\n\tlogComment ====== bootToUEFIMenu finish ======\n\ndef bootToFastBoot()\n\tlogComment ====== bootToFastBoot start ======\n\n\tpowerOffTheDevice\n\n\tpkey 0\n\tvolup 0\n\tvoldn 1\n\n\tpedl 0\n\n\tpowerOnTheDevice\n\n\tpkey 1\n\tdelay 8000\n\tpkey 0\n\n\tdelay 8000\n\tvoldn 0\n\tdelay 30\n\tvoldn 1\n\n\tvoldn 0\n\n\tlogComment ====== bootToFastBoot finished ======\n",
17
17
  "supportedFirmwareVer": [
18
18
  15
19
19
  ],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytactl
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: Python Test Automation Controller (TAC/Alpaca) for Qualcomm debug boards
5
5
  Author-email: "Qualcomm Technologies, Inc." <qc.opensource@qti.qualcomm.com>
6
6
  Maintainer-email: Milosz Wasilewski <milosz.wasilewski@oss.qualcomm.com>
@@ -140,6 +140,33 @@ def test_declared_variables_are_substituted(tmp_path):
140
140
  board.bootToEDL()
141
141
 
142
142
 
143
+ def test_variable_sharing_a_prefix_is_not_clobbered(tmp_path):
144
+ """Substituting $edl must not also rewrite the start of $edl_long, whatever
145
+ order the config declares them in."""
146
+ for variables in (
147
+ [
148
+ {"name": "edl", "default_value": "1300"},
149
+ {"name": "edl_long", "default_value": "5000"},
150
+ ],
151
+ [
152
+ {"name": "edl_long", "default_value": "5000"},
153
+ {"name": "edl", "default_value": "1300"},
154
+ ],
155
+ ):
156
+ path = write_config(
157
+ tmp_path,
158
+ "def bootToEDL()\n\tdelay $edl\n\tdelay $edl_long\n",
159
+ variables=variables,
160
+ )
161
+
162
+ board = debugboard.Board.create_from_config(path)
163
+ delays = []
164
+ board.delay = delays.append
165
+ board.bootToEDL()
166
+
167
+ assert delays == [1300, 5000]
168
+
169
+
143
170
  def test_undeclared_variable_is_reported_by_name(tmp_path):
144
171
  """TAC_FTDI_72 drives $edl/$uefi/$fastboot but declares no variables. There
145
172
  is nothing to substitute and the delay is a board timing only the config can
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes