Torizon: Distinguishing modules inside container

Hi team,

I’m currently developing a demo, and I’m looking to support different modules. This demo uses I2C.

The issue is that the I2C bus changes among modules. Hopefully, what I’m asking is not impossible but any simple way to identify the module I’m using (inside the container)? I’m looking to have something like:

if (Colibri_iMX6) bus = 1
else if (Colibri iMX8X) bus = 17

I think this is a good use case that customers might implement to have the same code across modules and could be worth documenting. Thanks

Half-answering myself, I believe that we are implementing interfaces across the family, like colibri-tty1 or colibri-i2c1. With this, there is no need to make any distinction. However, someone please confirm anyway if it is possible to distinguish the module within Python / a container.

Greetings @alvaro.tx,

One way you could give the container awareness of what module it’s running on, is by bind-mounting the hostname into the container. (i.e. /etc/hostname). Alternatively you could parse the info from the device-tree file at `/proc/device-tree/toradex,product-id.

Either way your Python application could then read and figure out the module from these files. There may also be other methods via playing around with environment variables and such. But I believe bind-mounting the above files is most likely the straightforward method.

Best Regards,