 
 Signed-off-by: Martin Jansa <martin.jansa@lge.com>
 ---
- CMakeLists.txt                                | 36 +-----------
- cmake/libphidget22-extras.cmake.in            |  4 +-
- ...ts22-fix-uninitialized-memory-access.patch | 56 -------------------
- 3 files changed, 3 insertions(+), 93 deletions(-)
- delete mode 100644 patch/libphidgets22-fix-uninitialized-memory-access.patch
+ CMakeLists.txt                                |  37 +--
+ cmake/libphidget22-extras.cmake.in            |   4 +-
+ ...phidgets22-1.6.20200417-fix-warnings.patch | 260 ------------------
+ 3 files changed, 3 insertions(+), 298 deletions(-)
+ delete mode 100644 patch/libphidgets22-1.6.20200417-fix-warnings.patch
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c19ed20..706e59a 100644
+index 462ee7f..706e59a 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -3,40 +3,6 @@ project(libphidget22)
+@@ -3,41 +3,6 @@ project(libphidget22)
  
  find_package(ament_cmake REQUIRED)
  
--set(extra_c_flags "-g -O2 -Wno-incompatible-pointer-types -Wno-deprecated-declarations -Wno-format-truncation")
+-set(extra_c_flags "-g -O2 -Wno-incompatible-pointer-types -Wno-deprecated-declarations -Wno-format-truncation -fPIC")
 -
 -include(ExternalProject)
 -ExternalProject_Add(EP_${PROJECT_NAME}
--    URL https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.4.20190605.tar.gz
--    URL_MD5 96e5d64263866d34e1d9a5f4ba78ba65
--
--    PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/libphidgets22-fix-uninitialized-memory-access.patch
+-    URL https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.6.20200417.tar.gz
+-    URL_MD5 f8c85f8348ddc0fb46146c0d9d8f884e
+-
+-    PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/libphidgets22-1.6.20200417-fix-warnings.patch
 -    SOURCE_DIR ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src
 -    CONFIGURE_COMMAND
 -      <SOURCE_DIR>/configure
 -      CFLAGS=${extra_c_flags}
 -      --prefix=${CMAKE_CURRENT_BINARY_DIR}/libphidget22_install
+-      --disable-ldconfig
 -    BUILD_COMMAND $(MAKE)
 -    INSTALL_COMMAND $(MAKE) install
 -)

- 	ch->count = 0;
- 
- 	return (ret);
-diff -Nurp libphidget22-1.4.20190605.orig/configure libphidget22-1.4.20190605/configure
---- libphidget22-1.4.20190605.orig/configure	2019-06-05 16:06:56.000000000 -0400
-+++ libphidget22-1.4.20190605/configure	2019-09-05 11:50:10.510502872 -0400
-@@ -5676,7 +5676,7 @@ esac
- fi
- 
- : ${AR=ar}
--: ${AR_FLAGS=cru}
-+: ${AR_FLAGS=cr}
- 
- 
- 

-list(APPEND @PROJECT_NAME@_LIBRARIES "${@PROJECT_NAME@_DIR}/../../../opt/libphidget22/lib/libphidget22.so")
+list(APPEND @PROJECT_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/../../../../usr/include")
+list(APPEND @PROJECT_NAME@_LIBRARIES "${@PROJECT_NAME@_DIR}/../../../../usr/lib/libphidget22.so")
diff --git a/patch/libphidgets22-1.6.20200417-fix-warnings.patch b/patch/libphidgets22-1.6.20200417-fix-warnings.patch
deleted file mode 100644
index f197d1a..0000000
--- a/patch/libphidgets22-1.6.20200417-fix-warnings.patch
+++ /dev/null
@@ -1,260 +0,0 @@
-diff -urp libphidget22-1.6.20200417.orig/configure libphidget22-1.6.20200417/configure
---- libphidget22-1.6.20200417.orig/configure	2020-04-17 21:51:11.000000000 +0000
-+++ libphidget22-1.6.20200417/configure	2020-06-02 13:31:26.487312313 +0000
-@@ -5678,7 +5678,7 @@ esac
- fi
- 
- : ${AR=ar}
--: ${AR_FLAGS=cru}
-+: ${AR_FLAGS=cr}
- 
- 
- 
-diff -urp libphidget22-1.6.20200417.orig/src/class/dataadapter.gen.c libphidget22-1.6.20200417/src/class/dataadapter.gen.c
---- libphidget22-1.6.20200417.orig/src/class/dataadapter.gen.c	2020-04-17 21:50:42.000000000 +0000
-+++ libphidget22-1.6.20200417/src/class/dataadapter.gen.c	2020-06-02 13:26:36.101638546 +0000
-@@ -46,137 +46,6 @@ struct _PhidgetDataAdapter {
- };
- 
- static PhidgetReturnCode CCONV
--_setStatus(PhidgetChannelHandle phid, BridgePacket *bp) {
--	PhidgetDataAdapterHandle ch;
--	int version;
--
--	ch = (PhidgetDataAdapterHandle)phid;
--
--	version = getBridgePacketUInt32ByName(bp, "_class_version_");
--	if (version != 3) {
--		loginfo("%"PRIphid": server/client class version mismatch: %d != 3 - functionality may be limited.", phid, version);
--	}
--
--	if(version >= 3)
--		ch->responseReceived = getBridgePacketInt32ByName(bp, "responseReceived");
--	if(version >= 3)
--		memcpy(&ch->lastData, getBridgePacketUInt8ArrayByName(bp, "lastData"), sizeof (uint8_t) * 8192);
--	if(version >= 3)
--		ch->lastDataIndex = getBridgePacketUInt32ByName(bp, "lastDataIndex");
--	if(version >= 3)
--		memcpy(&ch->eventData, getBridgePacketUInt8ArrayByName(bp, "eventData"), sizeof (uint8_t) * 8192);
--	if(version >= 3)
--		ch->lastDataLen = getBridgePacketUInt32ByName(bp, "lastDataLen");
--	if(version >= 3)
--		ch->lastDataError = getBridgePacketUInt32ByName(bp, "lastDataError");
--	if(version >= 3)
--		memcpy(&ch->I2CFormat, getBridgePacketUInt8ArrayByName(bp, "I2CFormat"), sizeof (char) * 2049);
--	if(version >= 3)
--		ch->lastDataRead = getBridgePacketInt32ByName(bp, "lastDataRead");
--	if(version >= 3)
--		ch->baudRate = getBridgePacketUInt32ByName(bp, "baudRate");
--	if(version >= 3)
--		ch->minBaudRate = getBridgePacketUInt32ByName(bp, "minBaudRate");
--	if(version >= 3)
--		ch->maxBaudRate = getBridgePacketUInt32ByName(bp, "maxBaudRate");
--	if(version >= 3)
--		ch->dataBits = getBridgePacketUInt32ByName(bp, "dataBits");
--	if(version >= 3)
--		ch->minDataBits = getBridgePacketUInt32ByName(bp, "minDataBits");
--	if(version >= 3)
--		ch->maxDataBits = getBridgePacketUInt32ByName(bp, "maxDataBits");
--	if(version >= 3)
--		ch->deviceAddress = getBridgePacketUInt32ByName(bp, "deviceAddress");
--	if(version >= 3)
--		ch->handshakeMode = getBridgePacketInt32ByName(bp, "handshakeMode");
--	if(version >= 3)
--		ch->endianness = getBridgePacketInt32ByName(bp, "endianness");
--	if(version >= 3)
--		ch->IOVoltage = getBridgePacketInt32ByName(bp, "IOVoltage");
--	if(version >= 3)
--		ch->maxPacketLength = getBridgePacketUInt32ByName(bp, "maxPacketLength");
--	if(version >= 3)
--		ch->parity = getBridgePacketInt32ByName(bp, "parity");
--	if(version >= 3)
--		ch->protocol = getBridgePacketInt32ByName(bp, "protocol");
--	if(version >= 3)
--		ch->SPIMode = getBridgePacketInt32ByName(bp, "SPIMode");
--	if(version >= 3)
--		ch->stopBits = getBridgePacketInt32ByName(bp, "stopBits");
--	if(version >= 3)
--		ch->timeout = getBridgePacketUInt32ByName(bp, "timeout");
--	if(version >= 3)
--		ch->minTimeout = getBridgePacketUInt32ByName(bp, "minTimeout");
--	if(version >= 3)
--		ch->maxTimeout = getBridgePacketUInt32ByName(bp, "maxTimeout");
--
--	return (EPHIDGET_OK);
--}
--
--static PhidgetReturnCode CCONV
--_getStatus(PhidgetChannelHandle phid, BridgePacket **bp) {
--	PhidgetDataAdapterHandle ch;
--
--	ch = (PhidgetDataAdapterHandle)phid;
--
--	return (createBridgePacket(bp, 0, "_class_version_=%u"
--	  ",responseReceived=%d"
--	  ",lastData=%8192R"
--	  ",lastDataIndex=%u"
--	  ",eventData=%8192R"
--	  ",lastDataLen=%u"
--	  ",lastDataError=%u"
--	  ",I2CFormat=%2049R"
--	  ",lastDataRead=%d"
--	  ",baudRate=%u"
--	  ",minBaudRate=%u"
--	  ",maxBaudRate=%u"
--	  ",dataBits=%u"
--	  ",minDataBits=%u"
--	  ",maxDataBits=%u"
--	  ",deviceAddress=%u"
--	  ",handshakeMode=%d"
--	  ",endianness=%d"
--	  ",IOVoltage=%d"
--	  ",maxPacketLength=%u"
--	  ",parity=%d"
--	  ",protocol=%d"
--	  ",SPIMode=%d"
--	  ",stopBits=%d"
--	  ",timeout=%u"
--	  ",minTimeout=%u"
--	  ",maxTimeout=%u"
--	  ,3 /* class version */
--	  ,ch->responseReceived
--	  ,ch->lastData
--	  ,ch->lastDataIndex
--	  ,ch->eventData
--	  ,ch->lastDataLen
--	  ,ch->lastDataError
--	  ,ch->I2CFormat
--	  ,ch->lastDataRead
--	  ,ch->baudRate
--	  ,ch->minBaudRate
--	  ,ch->maxBaudRate
--	  ,ch->dataBits
--	  ,ch->minDataBits
--	  ,ch->maxDataBits
--	  ,ch->deviceAddress
--	  ,ch->handshakeMode
--	  ,ch->endianness
--	  ,ch->IOVoltage
--	  ,ch->maxPacketLength
--	  ,ch->parity
--	  ,ch->protocol
--	  ,ch->SPIMode
--	  ,ch->stopBits
--	  ,ch->timeout
--	  ,ch->minTimeout
--	  ,ch->maxTimeout
--	));
--}
--
--static PhidgetReturnCode CCONV
- _bridgeInput(PhidgetChannelHandle phid, BridgePacket *bp) {
- 	PhidgetDataAdapterHandle ch;
- 	PhidgetReturnCode res;
-diff -urp libphidget22-1.6.20200417.orig/src/class/distancesensor.gen.c libphidget22-1.6.20200417/src/class/distancesensor.gen.c
---- libphidget22-1.6.20200417.orig/src/class/distancesensor.gen.c	2020-04-17 21:50:46.000000000 +0000
-+++ libphidget22-1.6.20200417/src/class/distancesensor.gen.c	2020-06-02 13:27:20.497435784 +0000
-@@ -228,8 +228,8 @@ _initAfterOpen(PhidgetChannelHandle phid
- 		MOS_PANIC("Unsupported Channel");
- 	}
