diff --git a/pi4j-native/src/main/native/com_pi4j_wiringpi_Spi.c b/pi4j-native/src/main/native/com_pi4j_wiringpi_Spi.c index e8b80563c..876b1ecd6 100644 --- a/pi4j-native/src/main/native/com_pi4j_wiringpi_Spi.c +++ b/pi4j-native/src/main/native/com_pi4j_wiringpi_Spi.c @@ -73,7 +73,7 @@ JNIEXPORT jint JNICALL Java_com_pi4j_wiringpi_Spi_wiringPiSPIDataRW__I_3BI // copy the bytes from the data array argument into a native character buffer jbyte *body = (*env)->GetByteArrayElements(env, data, 0); for (i = 0; i < length; i++) { - buffer[i] = body[i + offset]; + buffer[i] = body[i]; } jint result = wiringPiSPIDataRW(channel, (unsigned char *)buffer, length); @@ -82,7 +82,7 @@ JNIEXPORT jint JNICALL Java_com_pi4j_wiringpi_Spi_wiringPiSPIDataRW__I_3BI for (i = 0; i < length; i++) { body[i] = buffer[i]; } - (*env)->ReleaseByteArrayElements(env, data, bodyReturn, 0); + (*env)->ReleaseByteArrayElements(env, data, body, 0); return result; } diff --git a/pi4j-native/src/main/native/wiringpi-build.sh b/pi4j-native/src/main/native/wiringpi-build.sh index 682e2bfa6..9f9255a24 100644 --- a/pi4j-native/src/main/native/wiringpi-build.sh +++ b/pi4j-native/src/main/native/wiringpi-build.sh @@ -24,7 +24,6 @@ # limitations under the License. # #L% ### - # ---------------------------------- # install prerequisites # ---------------------------------- @@ -36,7 +35,6 @@ sudo apt-get install git-core -y # ---------------------------------- git clone git://github.com/WiringPi/WiringPi.git wiringPi cd wiringPi -git pull origin # ---------------------------------- # uninstall any previous copies @@ -48,4 +46,4 @@ sudo make uninstall # build latest wiringPi # ---------------------------------- cd .. -./build \ No newline at end of file +./build