Skip to content

Commit

Permalink
adi/ad908[1|4]_mc.py: Fix label parsing in _map_to_dict()
Browse files Browse the repository at this point in the history
In recent kernels the IIO core adds labels for all channels
with extended names. This now causes undesired behavior.
Before splitting, check if the split string is part of the string.
This will also catch the 'buffer_only' case.

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Oct 25, 2023
1 parent 1ee2658 commit 3aec7b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adi/ad9081_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def _map_to_dict(paths, ch, dev_name):
if "label" in ch.attrs and "buffer_only" in ch.attrs["label"].value:
if "->" not in ch.attrs["label"].value:
return paths, False
fddc, cddc, adc = ch.attrs["label"].value.split("->")
if dev_name not in paths.keys():
Expand Down
2 changes: 1 addition & 1 deletion adi/ad9084_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def _map_to_dict(paths, ch, dev_name):
if "label" in ch.attrs and "buffer_only" in ch.attrs["label"].value:
if "->" not in ch.attrs["label"].value:
return paths, False
side, fddc, cddc, adc = ch.attrs["label"].value.replace(":", "->").split("->")
if dev_name not in paths.keys():
Expand Down

0 comments on commit 3aec7b7

Please sign in to comment.