I2c bus access migration from TX1 to TX2

Hi,
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.

  1. Change the i2c alias in the i2c driver for TX2 which makes it look like TX1 (not sure if it breaks some other apps).
  2. 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).
  3. 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.

Thank you.

Can’t promise without any problem. At least you need to check all of the device tree that involve the i2c bus number.

@ShaneCCC : Thanks for your prompt reply, I will probably use the 3rd approach, changing the scripts to detect platform and open correct buses accordingly.