@@ -302,7 +302,7 @@ class Chip:
mapped_output_values = None
name_map = dict()
- offset_map = dict()
+ requested_lines = list()
global_output_values = list()
for line, settings in config_iter(config):
@@ -310,6 +310,7 @@ class Chip:
offset = self.line_offset_from_id(line)
offsets.append(offset)
+ requested_lines.append(line)
# If there's a global output value for this offset, store it in the
# list for later.
@@ -322,7 +323,6 @@ class Chip:
if isinstance(line, str):
name_map[line] = offset
- offset_map[offset] = line
line_cfg.add_line_settings(
offsets, _line_settings_to_ext(settings or LineSettings())
@@ -340,9 +340,7 @@ class Chip:
request._offsets = req_internal.offsets
request._name_map = name_map
- request._lines = [
- offset_map[off] if off in offset_map else off for off in request.offsets
- ]
+ request._lines = requested_lines
return request
Previously, an offset map was maintained to lookup the name used to request a line so that a list could be generated that reflected the identifier used to request a given line. For example, if a config looked like {0: None, ("foo", "bar"): None}, the LineRequest.lines property would contain [0, "foo", "bar"]. Now, the line identifier is tracked in request order as the config object is iterated to avoid maintaining an offset map. Signed-off-by: Vincent Fazio <vfazio@gmail.com> --- bindings/python/gpiod/chip.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)