I am migrating our platform SW from TX1 to TX2 which opens few i2c buses. There are dozens of python scripts those have hard coded bus addresses for TX1. For example, we have FPGA device at bus 6. When I migrate the solution on TX2, we need to change all scripts for i2c bus on TX2.
The mapping for TX2 has changed and same FPGA device is accessible on bus 2. Our daughter board connects over camera expansion port, which has this FPGA device.
I am evaluating following approaches, so I make a minimum or no changes to the python scripts and make them platform independent.
- Change the i2c alias in the i2c driver for TX2 which makes it look like TX1 (not sure if it breaks some other apps).
- Create a new alias (for example i2c50) in the driver which points to bus 6 on both TX1 and bus 2 on TX2, then change all our scripts to open device 50 (I don’t know if that is even possible).
- Detect the platform (using
/proc/device-tree/model) when the script runs and then call appropriate bus (This will require touching all scripts).
Any guidance/approach is helpful.