PiicoDev_Unified.py bookworm config

I am a python noob, but inside the PiicoDev_Unified.py code, shouldn’t this class be using the same logic the i2c_setup.sh is doing in regards to working out the config file location? In bookworm, it should be boot/firmware/config.txt

class I2CUnifiedLinux(I2CBase):
    def __init__(self, bus=None, suppress_warnings=True):
        if suppress_warnings == False:
            with open('/boot/config.txt') as config_file:
                if 'dtparam=i2c_arm=on' in config_file.read():
                    pass
                else:
                    print('I2C is not enabled. To enable' + setupi2c_str)
                config_file.close()
            with open('/boot/config.txt') as config_file:
                if 'dtparam=i2c_arm_baudrate=400000' in config_file.read():
                    pass
                else:
                    print('Slow baudrate detected. If glitching occurs' + setupi2c_str)
                config_file.close()
        if bus is None:
            bus = 1
        self.i2c = SMBus(bus)
2 Likes

Hi @Cam267847,

Welcome to the forums! I can’t say I have much experience in setting up libraries for hardware but I know that that config path is correct for most Pi OS releases.

Looking through some Raspberry Pi forum posts this changed only impacts Bookworm and not the other distributions.

Does this fix work for you?

2 Likes