Skip to content

Using /boot/config.txt for config_file #19

@c4mz

Description

@c4mz

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)

Why is it only using /boot/config.txt and not /boot/firmware/config.txt? Shouldn't it do the same logic that i2c-setup.sh does? I'm getting errors using bookworm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions