From a851c85cbf4c10d67b871aa3e0648c1e121f35bc Mon Sep 17 00:00:00 2001 From: Marc-Antoine Ruel Date: Sat, 27 Oct 2018 20:36:39 -0400 Subject: [PATCH] sysfs: fix Tx() to always set KeepCS This was an error to not set it. This was broken by 6c72da6, which was a while ago. :( Fixes #222 --- host/sysfs/spi.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/host/sysfs/spi.go b/host/sysfs/spi.go index 35e47383a..676f8eba0 100644 --- a/host/sysfs/spi.go +++ b/host/sysfs/spi.go @@ -183,6 +183,7 @@ func newSPI(busNumber, chipSelect int) (*SPI, error) { f: f, busNumber: busNumber, chipSelect: chipSelect, + p: [2]spi.Packet{{KeepCS: true}, {KeepCS: true}}, }, }, nil } @@ -500,6 +501,9 @@ func spiIOCTx(l int) uint { } // spiIOCTransfer is spi_ioc_transfer in linux/spi/spidev.h. +// +// Also documented as struct spi_transfer at +// https://www.kernel.org/doc/html/latest/driver-api/spi.html type spiIOCTransfer struct { tx uint64 // Pointer to byte slice rx uint64 // Pointer to byte slice