-
Notifications
You must be signed in to change notification settings - Fork 9
I2C bus hardcoded to /dev/i2c-1 — should be configurable #26
Copy link
Copy link
Open
Description
Problem
The compiled library liboptigatrust-i2c-linux-aarch64.so has /dev/i2c-1
hardcoded in the binary. On some Linux systems (such as Raspberry Pi 4B running
Trixie), the OPTIGA Trust M is not on bus 1.
For example, on Raspberry Pi 4B with Trixie, i2cdetect confirms the Trust M
is visible at address 0x30 on /dev/i2c-21, but the library always tries
/dev/i2c-1 and fails to connect.
Expected Behavior
The I2C bus should be configurable — either via an environment variable
(e.g. OPTIGA_I2C_DEV) or a configuration file — so the library works on
systems where the Trust M is not on bus 1.
Steps to Reproduce
- Connect Trust M breakout to Raspberry Pi 4B via QWIIC
- Run
i2cdetect -y 21— Trust M visible at 0x30 - Run
python3 -c "import optigatrust; c = optigatrust.Chip(interface='i2c'); print(c)" - Result:
i2c: Failed to connect
Additional Information
- Hardware: Raspberry Pi 4B running Debian 13 (Trixie)
- Trust M breakout: Adafruit OPTIGA Trust M (ADA4351)
- The source file
extras/pal/linux/target/rpi3/pal_ifx_i2c_config.c
hardcodes/dev/i2c-1— this should read from an environment variable
Suggested Fix
In pal_ifx_i2c_config.c, read the I2C device from an environment variable:
const char *env = getenv("OPTIGA_I2C_DEV");
if (env != NULL) {
strncpy(i2c_dev, env, sizeof(i2c_dev) - 1);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels