Skip to content

Allow ctrl-c of adafruit_bus_device.spi_device lock hang#9055

Merged
tannewt merged 1 commit into
adafruit:mainfrom
dhalbert:ctrl-c-spi-bus-device
Mar 18, 2024
Merged

Allow ctrl-c of adafruit_bus_device.spi_device lock hang#9055
tannewt merged 1 commit into
adafruit:mainfrom
dhalbert:ctrl-c-spi-bus-device

Conversation

@dhalbert

@dhalbert dhalbert commented Mar 15, 2024

Copy link
Copy Markdown
Collaborator

The __enter__() for the native SPIDevice context manager would spin waiting for the lock. It did not check for ctrl-c or run background tasks.

This is an old bug: it is present in 8.x.x and probably before, so doesn't need to be included in 9.0.0 final.

Tested with the test program in #9054. Now it does:

>>> import spilock
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "spilock.py", line 8, in <module>
        [typed ctrl-C here]
KeyboardInterrupt: 
>>> 

@dhalbert dhalbert added this to the 9.0.x milestone Mar 15, 2024
@dhalbert dhalbert requested review from jepler and tannewt March 15, 2024 21:35
@dhalbert dhalbert force-pushed the ctrl-c-spi-bus-device branch from 6d42af8 to d388bfb Compare March 15, 2024 21:48
@dhalbert dhalbert force-pushed the ctrl-c-spi-bus-device branch from d388bfb to d148831 Compare March 15, 2024 22:40

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 84e937f into adafruit:main Mar 18, 2024
@dhalbert dhalbert deleted the ctrl-c-spi-bus-device branch March 25, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants