Skip to content
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

I2C bus coordination #21

Open
gmos opened this issue Apr 29, 2020 · 0 comments
Open

I2C bus coordination #21

gmos opened this issue Apr 29, 2020 · 0 comments

Comments

@gmos
Copy link
Contributor

gmos commented Apr 29, 2020

We are using a growing number of I2C type sensors.
Ans we use libraries for I2C sensors that naively set-up their private I2C (import smbus etc). Then they are using the shared I2C bus resource as if they are the only user from their private smbus objects.

As it seems having multiple smbus objects, governing the same I2C bus seems to work if you are not using asyncio, threading or multi-processing that is. The smbus object probably does not keep much state or may use a singleton under the hood).

Anyway, the model breaks down when there are concurrent users of the bus. And in our case there will be. So we'll need a locking mechanism for the bus that works for multiple processes / threads sharing the bus.

Most appropriate solution may be using fcntl on a dummy lock file. @MichielBbal, should/can we put a card in Trello to solve this issue?

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