Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Mar 15, 2024

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 tannewt and jepler 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
Copy link
Member

@tannewt tannewt left a comment

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