From 9392a49f5e58913c3089450d7f83006320ea324e Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 7 May 2012 17:12:58 +0200 Subject: fix bug on port indices --- src/k8055.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k8055.c b/src/k8055.c index 6cde669..99ba866 100644 --- a/src/k8055.c +++ b/src/k8055.c @@ -251,7 +251,7 @@ void closeDevice(int port) { static int writeData(int port) { int writeStatus = 0; - if (port < 0 || K8055_MAX_DEVICES < port) { + if (port < 0 || K8055_MAX_DEVICES <= port) { printError("invalid port number, port p should be 0<=p<=3"); return K8055_ERROR_INDEX; } @@ -288,7 +288,7 @@ static int writeData(int port) { static int readData(int port, int cycles) { int readStatus = 0; - if (port < 0 || K8055_MAX_DEVICES < port) { + if (port < 0 || K8055_MAX_DEVICES <= port) { printError("invalid port number, port p should be 0<=p<=3"); return K8055_ERROR_INDEX; } -- cgit v1.2.3