From 5525b6250f9eccb5b7f705df3249d9a4bee24060 Mon Sep 17 00:00:00 2001 From: Dolf Andringa Date: Mon, 2 Mar 2020 06:05:04 +0000 Subject: [PATCH] Correct port number --- wiringPi/wiringPiSPI.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wiringPi/wiringPiSPI.c b/wiringPi/wiringPiSPI.c index ff1ca66..e65da1e 100644 --- a/wiringPi/wiringPiSPI.c +++ b/wiringPi/wiringPiSPI.c @@ -97,7 +97,7 @@ int wiringPiSPIDataRW (int channel, unsigned char *data, int len) */ void getDevice(char* spidev, int channel, int port) { - sprintf(spidev, "/dev/spidev/%i.%i", channel, port); + sprintf(spidev, "/dev/spidev%i.%i", channel, port); } int wiringPiSPISetupMode (int channel, int port, int speed, int mode) @@ -110,6 +110,7 @@ int wiringPiSPISetupMode (int channel, int port, int speed, int mode) static char spidev[14]; getDevice(spidev, channel, port); + printf("Opening device %s\n", spidev); if ((fd = open (spidev, O_RDWR)) < 0) return wiringPiFailure (WPI_ALMOST, "Unable to open SPI device: %s\n", strerror (errno)) ;