Skip to content

displayio common_hal_xxx_begin_transaction() routines not used or implemented safely #1619

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

Closed
dhalbert opened this issue Mar 5, 2019 · 1 comment

Comments

@dhalbert
Copy link
Collaborator

dhalbert commented Mar 5, 2019

The common_hal routines common_hal_displayio_fourwire_begin_transaction() and common_hal_displayio_parallelbus_begin_transaction() return true or false depending on whether they've successfully started a display transaction. However, their return value is never checked: the callers assume that once called, the transaction has begun, even though the start-transaction has failed.

For ParallelBus, it doesn't matter, because there's no contention, and the routine always returns true. But for FourWire, the routine does a common_hal_busio_spi_try_lock(), which might fail and return false if someone else is holding the lock.

So either the return values should be checked, and the calling code should busy-wait or fail nicely, or the xxx_begin_transaction() routine should itself busy-wait.

If we do MICROPY_VM_HOOK_LOOP during the busy-wait, we have to avoid calling ourselves recursively, so a flag should be set that can be checked to avoid doing any displayio background operations while waiting.

These routines are either called directly in FourWire.send() and ParallelBus.send(), or via self->begin_transaction() in various Display methods.

@dhalbert
Copy link
Collaborator Author

dhalbert commented Mar 7, 2019

Fixed by #1620

@dhalbert dhalbert closed this as completed Mar 7, 2019
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

No branches or pull requests

1 participant