diff --git a/core/services/ardupilot_manager/flight_controller_detector/linux/linux_boards.py b/core/services/ardupilot_manager/flight_controller_detector/linux/linux_boards.py index bda807ede9..d7e54f6fc0 100644 --- a/core/services/ardupilot_manager/flight_controller_detector/linux/linux_boards.py +++ b/core/services/ardupilot_manager/flight_controller_detector/linux/linux_boards.py @@ -23,8 +23,8 @@ def get_serials(self) -> List[Serial]: def check_for_i2c_device(self, bus_number: int, address: int) -> bool: try: - bus = SMBus(bus_number) - bus.read_byte_data(address, 0) + with SMBus(bus_number) as bus: + bus.read_byte_data(address, 0) return True except OSError: return False