diff --git a/hal/README.md b/hal/README.md index 4eb2903..5ada136 100644 --- a/hal/README.md +++ b/hal/README.md @@ -63,7 +63,9 @@ int TPM2_IoCb(TPM2_CTX* ctx, const byte* txBuf, byte* rxBuf, ## Additional Compiler macros * `TPM2_SPI_DEV_PATH`: Set to the device string to be opened by the Linux IOCb. Default: "/dev/spidev0." -* `TPM2_SPI_DEV_CS`: Set to the number string of the CS to use or the lowest CS to try during autodetect. Default: "0" +* `TPM2_SPI_DEV_CS`: Set to the number string of the CS to use. Default: "0" These can be set during configure as: ./configure CPPFLAGS="-DTPM2_SPI_DEV_PATH=\"/dev/spidev0.\" -DTPM2_SPI_DEV_CS=\"0\" " + +Note that autodetect will use TPM2_SPI_DEV_PATH[0..4] for the searched device paths. diff --git a/hal/tpm_io_linux.c b/hal/tpm_io_linux.c index fa07f21..f1589b9 100644 --- a/hal/tpm_io_linux.c +++ b/hal/tpm_io_linux.c @@ -80,7 +80,7 @@ #define TPM2_SPI_DEV_CS "0" #else /* OPTIGA SLB9670/SLB9762 and LetsTrust TPM use CE1 */ - #define TPM2_SPI_DEV_CS "0" + #define TPM2_SPI_DEV_CS "1" #endif #endif @@ -91,7 +91,7 @@ #ifdef WOLFTPM_AUTODETECT #undef TPM2_SPI_DEV /* this will try incrementing spidev chip selects */ - static char TPM2_SPI_DEV[] = TPM2_SPI_DEV_PATH TPM2_SPI_DEV_CS; + static char TPM2_SPI_DEV[] = TPM2_SPI_DEV_PATH "0"; #define MAX_SPI_DEV_CS '4' static int foundSpiDev = 0; #else