diff --git a/apio/managers/scons.py b/apio/managers/scons.py index e4679cd9..d79bfc20 100644 --- a/apio/managers/scons.py +++ b/apio/managers/scons.py @@ -675,12 +675,17 @@ def _check_ftdi(board, board_data, ext_ftdi_id): desc_pattern = f"^{board_desc}.*$" # Match the discovered FTDI chips - ftdi_devices = System().get_ftdi_devices() - if len(ftdi_devices) == 0: + # -- Get the list of the connected FTDI devices + # -- (execute the command "lsftdi" from the apio System module) + system = System() + connected_devices = system.get_ftdi_devices() + + if len(connected_devices) == 0: # Board not available raise AttributeError("board " + board + " not available") - for ftdi_device in ftdi_devices: + + for ftdi_device in connected_devices: index = ftdi_device.get("index") # ftdi device indices can start at zero if ext_ftdi_id is not None and ext_ftdi_id != index: diff --git a/apio/managers/system.py b/apio/managers/system.py index cf356f08..00fc6522 100644 --- a/apio/managers/system.py +++ b/apio/managers/system.py @@ -123,7 +123,7 @@ def get_ftdi_devices(self) -> list: This list is obtained by running the "lsftdi" command * OUTPUT: A list of objects with the FTDI devices - Ex. [{'index': '0', 'manufacturer': 'AlhambraBits', + Ex. [{'index': '0', 'manufacturer': 'AlhambraBits', 'description': 'Alhambra II v1.0A - B07-095'}] It raises an exception in case of not being able to @@ -141,7 +141,7 @@ def get_ftdi_devices(self) -> list: # -- Get the list of the ftdi devices. It is read # -- from the command stdout - # -- Ex: [{'index': '0', 'manufacturer': 'AlhambraBits', + # -- Ex: [{'index': '0', 'manufacturer': 'AlhambraBits', # -- 'description': 'Alhambra II v1.0A - B07-095'}] ftdi_devices = self._parse_ftdi_devices(result["out"]) @@ -152,7 +152,6 @@ def get_ftdi_devices(self) -> list: # -- for reading the ftdi devices raise RuntimeError("Error executing lsftdi") - def _run_command(self, command: str, silent=False) -> dict: """Execute the given system command * INPUT: