Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to the latest libphidgets 1.6 library. #91

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libphidget22/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ set(extra_c_flags "-g -O2 -Wno-incompatible-pointer-types -Wno-deprecated-declar

include(ExternalProject)
ExternalProject_Add(EP_${PROJECT_NAME}
URL https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.6.20200417.tar.gz
URL_MD5 f8c85f8348ddc0fb46146c0d9d8f884e
URL https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.6.20210312.tar.gz
URL_MD5 5cd2049b8f7ee0c72f88ff1f7fe3c70b

PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/libphidgets22-1.6.20200417-fix-warnings.patch
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/libphidgets22-1.6.20210312-fix-warnings.patch
SOURCE_DIR ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src
CONFIGURE_COMMAND
<SOURCE_DIR>/configure
Expand Down
77 changes: 77 additions & 0 deletions libphidget22/patch/libphidgets22-1.6.20210312-fix-warnings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
diff -urp libphidget22-1.6.20210312.orig/configure libphidget22-1.6.20210312/configure
--- libphidget22-1.6.20210312.orig/configure 2021-03-12 17:23:02.000000000 +0000
+++ libphidget22-1.6.20210312/configure 2021-03-22 13:55:52.553323821 +0000
@@ -5681,7 +5681,7 @@ esac
fi

: ${AR=ar}
-: ${AR_FLAGS=cru}
+: ${AR_FLAGS=cr}



diff -urp libphidget22-1.6.20210312.orig/src/class/dataadapter.c libphidget22-1.6.20210312/src/class/dataadapter.c
--- libphidget22-1.6.20210312.orig/src/class/dataadapter.c 2021-03-12 17:22:46.000000000 +0000
+++ libphidget22-1.6.20210312/src/class/dataadapter.c 2021-03-22 13:52:16.752083410 +0000
@@ -90,7 +90,7 @@ PhidgetDataAdapter_bridgeInput(PhidgetCh
uint32_t dataLen;
Phidget_DeviceID deviceID;
Phidget_DeviceClass deviceClass;
- PhidgetDataAdapter_PacketErrorCode err;
+ uint32_t err;

ch = (PhidgetDataAdapterHandle)phid;

diff -urp libphidget22-1.6.20210312.orig/src/util/dataadaptersupport.c libphidget22-1.6.20210312/src/util/dataadaptersupport.c
--- libphidget22-1.6.20210312.orig/src/util/dataadaptersupport.c 2021-03-12 17:22:45.000000000 +0000
+++ libphidget22-1.6.20210312/src/util/dataadaptersupport.c 2021-03-22 13:53:10.348894764 +0000
@@ -859,49 +859,6 @@ PhidgetReturnCode sendI2CData(PhidgetCha
return sendDataBuffer(ch, totalCount, (const uint8_t *)buffer, bp, waitResposne);
}

-static PhidgetReturnCode
-waitForNAKClear(mosiop_t iop, PhidgetChannelHandle ch, uint32_t milliseconds) {
- PhidgetDataAdapterSupportHandle dataAdapterSupport;
- mostime_t duration;
- mostime_t start;
-
- assert(ch);
- TESTATTACHED(ch);
-
- dataAdapterSupport = DATAADAPTER_SUPPORT(ch);
- assert(dataAdapterSupport);
-
- start = 0; // make compiler happy
-
- if (milliseconds)
- start = mos_gettime_usec();
-
- PhidgetLock(ch);
- for (;;) {
- if (dataAdapterSupport->nakFlag == 0) {
- PhidgetUnlock(ch);
- return (EPHIDGET_OK);
- }
-
- if (!_ISOPEN(ch)) {
- PhidgetUnlock(ch);
- return (MOS_ERROR(iop, EPHIDGET_CLOSED, "Channel was closed while waiting for clear to send."));
- }
-
- if (milliseconds) {
- duration = (mos_gettime_usec() - start) / 1000;
- if (duration >= milliseconds) {
-
- PhidgetUnlock(ch);
- return (EPHIDGET_TIMEOUT);
- }
- PhidgetTimedWait(ch, milliseconds - (uint32_t)duration);
- } else {
- PhidgetWait(ch);
- }
- }
-}
-
static PhidgetReturnCode sendTXDataVINT(mosiop_t iop, PhidgetChannelHandle ch, uint8_t *buf, size_t packetLen, PhidgetTransaction *trans){
PhidgetReturnCode ret;
SetNAK(ch);