Skip to content

native adafruit_bus_device.spi_device.SPIDevice will hang and disconnect if device is locked #9054

@dhalbert

Description

@dhalbert

The C implementation of adafruit_bus_device.spi_device.SPIDevice will hang on __enter__() if the busio.SPI() object is locked and not released while it's waiting for the lock. It cannot be ctrl-C'd.

Test program:

import board
import adafruit_bus_device.spi_device

spi = board.SPI()
spid = adafruit_bus_device.spi_device.SPIDevice(spi)

spi.try_lock()
with spid as spi:
    print("waiting to write")
    spi.write(b'abc')
    # cannot ctrl-C here
    print("wrote")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions