aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2012-05-07 17:12:58 +0200
committerJakob Odersky <jodersky@gmail.com>2012-05-07 17:12:58 +0200
commit9392a49f5e58913c3089450d7f83006320ea324e (patch)
treedd5a45d0a0c3f7726c6d31034197cd172ecb06e0
parent3a631dc8c572a3d9ed63c823a294809e75dc08ad (diff)
downloadk8055-9392a49f5e58913c3089450d7f83006320ea324e.tar.gz
k8055-9392a49f5e58913c3089450d7f83006320ea324e.tar.bz2
k8055-9392a49f5e58913c3089450d7f83006320ea324e.zip
fix bug on port indices
-rw-r--r--src/k8055.c4
1 files 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;
}