diff options
4 files changed, 142 insertions, 86 deletions
diff --git a/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch b/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch deleted file mode 100644 index 4b17087ef8..0000000000 --- a/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From d314f26e024aaf15bf4ab22ceb98501148d0eac8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 7 May 2018 19:53:33 -0700 | ||
4 | Subject: [PATCH] Replace strncpy with memcpy | ||
5 | |||
6 | gcc8 detects that strncpy is overwiritng the null terminating character | ||
7 | the source strings are already initialized to 0 so memcpy would do the same | ||
8 | job | ||
9 | |||
10 | Fixes | ||
11 | rn2903.c:153:5: error: 'strncpy' output may be truncated copying 16 bytes from a string of length 511 [-Werror=stringop-truncation] | ||
12 | strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64); | ||
13 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
14 | |||
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
16 | --- | ||
17 | src/ecezo/ecezo.c | 2 +- | ||
18 | src/rn2903/rn2903.c | 2 +- | ||
19 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/src/ecezo/ecezo.c b/src/ecezo/ecezo.c | ||
22 | index 6a195fc1..56c6dab3 100644 | ||
23 | --- a/src/ecezo/ecezo.c | ||
24 | +++ b/src/ecezo/ecezo.c | ||
25 | @@ -488,7 +488,7 @@ int ecezo_send_command(const ecezo_context dev, char *cmd, char *buffer, | ||
26 | // our write buffer | ||
27 | char writeBuffer[ECEZO_MAX_BUFFER_LEN]; | ||
28 | |||
29 | - strncpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN); | ||
30 | + memcpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN-1); | ||
31 | writeBuffer[ECEZO_MAX_BUFFER_LEN - 1] = 0; | ||
32 | |||
33 | int writelen = strlen(writeBuffer); | ||
34 | diff --git a/src/rn2903/rn2903.c b/src/rn2903/rn2903.c | ||
35 | index f30a33ae..01a011da 100644 | ||
36 | --- a/src/rn2903/rn2903.c | ||
37 | +++ b/src/rn2903/rn2903.c | ||
38 | @@ -150,7 +150,7 @@ static rn2903_context _rn2903_postinit(rn2903_context dev, | ||
39 | rn2903_close(dev); | ||
40 | return NULL; | ||
41 | } | ||
42 | - strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64); | ||
43 | + memcpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64); | ||
44 | |||
45 | return dev; | ||
46 | } | ||
47 | -- | ||
48 | 2.17.0 | ||
49 | |||
diff --git a/meta-oe/recipes-extended/upm/upm/0001-Use-stdint-types.patch b/meta-oe/recipes-extended/upm/upm/0001-Use-stdint-types.patch new file mode 100644 index 0000000000..40856fcf0d --- /dev/null +++ b/meta-oe/recipes-extended/upm/upm/0001-Use-stdint-types.patch | |||
@@ -0,0 +1,139 @@ | |||
1 | From 5a1e731d71d577f56a2c013e4a75a8e90188e63b Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
3 | Date: Tue, 9 Jul 2019 05:21:59 -0700 | ||
4 | Subject: [PATCH] Use stdint types | ||
5 | |||
6 | Fixes compilation with musl. | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
11 | --- | ||
12 | src/bma250e/bma250e.cxx | 16 ++++++++-------- | ||
13 | src/bmg160/bmg160.cxx | 10 +++++----- | ||
14 | src/bmi160/bosch_bmi160.h | 2 +- | ||
15 | src/bmm150/bmm150.cxx | 8 ++++---- | ||
16 | 4 files changed, 18 insertions(+), 18 deletions(-) | ||
17 | |||
18 | diff --git a/src/bma250e/bma250e.cxx b/src/bma250e/bma250e.cxx | ||
19 | index a8792782..1b3ecdd8 100644 | ||
20 | --- a/src/bma250e/bma250e.cxx | ||
21 | +++ b/src/bma250e/bma250e.cxx | ||
22 | @@ -195,35 +195,35 @@ BMA250E::BMA250E(std::string initStr) : mraaIo(initStr) | ||
23 | fifoConfig(mode, axes); | ||
24 | } | ||
25 | if(tok.substr(0, 20) == "setInterruptEnable0:") { | ||
26 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
27 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
28 | setInterruptEnable0(bits); | ||
29 | } | ||
30 | if(tok.substr(0, 20) == "setInterruptEnable1:") { | ||
31 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
32 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
33 | setInterruptEnable1(bits); | ||
34 | } | ||
35 | if(tok.substr(0, 20) == "setInterruptEnable2:") { | ||
36 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
37 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
38 | setInterruptEnable2(bits); | ||
39 | } | ||
40 | if(tok.substr(0, 17) == "setInterruptMap0:") { | ||
41 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
42 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
43 | setInterruptMap0(bits); | ||
44 | } | ||
45 | if(tok.substr(0, 17) == "setInterruptMap1:") { | ||
46 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
47 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
48 | setInterruptMap1(bits); | ||
49 | } | ||
50 | if(tok.substr(0, 17) == "setInterruptMap2:") { | ||
51 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
52 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
53 | setInterruptMap2(bits); | ||
54 | } | ||
55 | if(tok.substr(0, 16) == "setInterruptSrc:") { | ||
56 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
57 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
58 | setInterruptSrc(bits); | ||
59 | } | ||
60 | if(tok.substr(0, 26) == "setInterruptOutputControl:") { | ||
61 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0); | ||
62 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(26), nullptr, 0); | ||
63 | setInterruptOutputControl(bits); | ||
64 | } | ||
65 | if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { | ||
66 | diff --git a/src/bmg160/bmg160.cxx b/src/bmg160/bmg160.cxx | ||
67 | index 1a0939f8..2438c399 100644 | ||
68 | --- a/src/bmg160/bmg160.cxx | ||
69 | +++ b/src/bmg160/bmg160.cxx | ||
70 | @@ -173,23 +173,23 @@ BMG160::BMG160(std::string initStr) : mraaIo(initStr) | ||
71 | fifoConfig(mode, axes); | ||
72 | } | ||
73 | if(tok.substr(0, 20) == "setInterruptEnable0:") { | ||
74 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
75 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); | ||
76 | setInterruptEnable0(bits); | ||
77 | } | ||
78 | if(tok.substr(0, 17) == "setInterruptMap0:") { | ||
79 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
80 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
81 | setInterruptMap0(bits); | ||
82 | } | ||
83 | if(tok.substr(0, 17) == "setInterruptMap1:") { | ||
84 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
85 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
86 | setInterruptMap1(bits); | ||
87 | } | ||
88 | if(tok.substr(0, 16) == "setInterruptSrc:") { | ||
89 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
90 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
91 | setInterruptSrc(bits); | ||
92 | } | ||
93 | if(tok.substr(0, 26) == "setInterruptOutputControl:") { | ||
94 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0); | ||
95 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(26), nullptr, 0); | ||
96 | setInterruptOutputControl(bits); | ||
97 | } | ||
98 | if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { | ||
99 | diff --git a/src/bmi160/bosch_bmi160.h b/src/bmi160/bosch_bmi160.h | ||
100 | index 87ca2249..cd9efe6f 100644 | ||
101 | --- a/src/bmi160/bosch_bmi160.h | ||
102 | +++ b/src/bmi160/bosch_bmi160.h | ||
103 | @@ -81,7 +81,7 @@ typedef int16_t s16;/**< used for signed 16bit */ | ||
104 | typedef int32_t s32;/**< used for signed 32bit */ | ||
105 | typedef int64_t s64;/**< used for signed 64bit */ | ||
106 | |||
107 | -typedef u_int8_t u8;/**< used for unsigned 8bit */ | ||
108 | +typedef uint8_t u8;/**< used for unsigned 8bit */ | ||
109 | typedef u_int16_t u16;/**< used for unsigned 16bit */ | ||
110 | typedef u_int32_t u32;/**< used for unsigned 32bit */ | ||
111 | typedef u_int64_t u64;/**< used for unsigned 64bit */ | ||
112 | diff --git a/src/bmm150/bmm150.cxx b/src/bmm150/bmm150.cxx | ||
113 | index 234ebf92..02436788 100644 | ||
114 | --- a/src/bmm150/bmm150.cxx | ||
115 | +++ b/src/bmm150/bmm150.cxx | ||
116 | @@ -170,19 +170,19 @@ BMM150::BMM150(std::string initStr) : mraaIo(initStr) | ||
117 | setOpmode(opmode); | ||
118 | } | ||
119 | if(tok.substr(0, 19) == "setInterruptEnable:") { | ||
120 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0); | ||
121 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(19), nullptr, 0); | ||
122 | setInterruptEnable(bits); | ||
123 | } | ||
124 | if(tok.substr(0, 19) == "setInterruptConfig:") { | ||
125 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0); | ||
126 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(19), nullptr, 0); | ||
127 | setInterruptConfig(bits); | ||
128 | } | ||
129 | if(tok.substr(0, 17) == "setRepetitionsXY:") { | ||
130 | - u_int8_t reps = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
131 | + uint8_t reps = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); | ||
132 | setRepetitionsXY(reps); | ||
133 | } | ||
134 | if(tok.substr(0, 16) == "setRepetitionsZ:") { | ||
135 | - u_int8_t reps = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
136 | + uint8_t reps = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); | ||
137 | setRepetitionsZ(reps); | ||
138 | } | ||
139 | if(tok.substr(0, 14) == "setPresetMode:") { | ||
diff --git a/meta-oe/recipes-extended/upm/upm/0001-include-sys-types.h-for-uint-definition.patch b/meta-oe/recipes-extended/upm/upm/0001-include-sys-types.h-for-uint-definition.patch deleted file mode 100644 index a0a47411d7..0000000000 --- a/meta-oe/recipes-extended/upm/upm/0001-include-sys-types.h-for-uint-definition.patch +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | From 48a580bd402cf6a3ee9e42013653219bfeb3caf6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 21 Jun 2018 18:39:16 -0700 | ||
4 | Subject: [PATCH] include sys/types.h for uint definition | ||
5 | |||
6 | uint is defined in sys/types.h, therefore this | ||
7 | header needs to be included, it gets exposed with | ||
8 | musl where this header is not getting included indirectly | ||
9 | as it is happening when building on glibc | ||
10 | |||
11 | Fixes build errors on musl e.g. | ||
12 | upm/src/kx122/kx122.hpp:456:31: error: 'uint' has not been declared | ||
13 | | void setBufferThreshold(uint samples); | ||
14 | | ^~~~ | ||
15 | |||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | Upstream-Status: Submitted [https://github.com/intel-iot-devkit/upm/pull/656] | ||
19 | src/kx122/kx122.h | 1 + | ||
20 | 1 file changed, 1 insertion(+) | ||
21 | |||
22 | diff --git a/src/kx122/kx122.h b/src/kx122/kx122.h | ||
23 | index 1622ed50..56e5215e 100644 | ||
24 | --- a/src/kx122/kx122.h | ||
25 | +++ b/src/kx122/kx122.h | ||
26 | @@ -31,6 +31,7 @@ extern "C"{ | ||
27 | #include <assert.h> | ||
28 | #include <unistd.h> | ||
29 | #include <math.h> | ||
30 | +#include <sys/types.h> | ||
31 | |||
32 | #include <mraa/i2c.h> | ||
33 | #include <mraa/spi.h> | ||
diff --git a/meta-oe/recipes-extended/upm/upm_git.bb b/meta-oe/recipes-extended/upm/upm_git.bb index 8854a33bcb..a6b379ec36 100644 --- a/meta-oe/recipes-extended/upm/upm_git.bb +++ b/meta-oe/recipes-extended/upm/upm_git.bb | |||
@@ -7,13 +7,12 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=66493d54e65bfc12c7983ff2e884f37f" | |||
7 | 7 | ||
8 | DEPENDS = "libjpeg-turbo mraa" | 8 | DEPENDS = "libjpeg-turbo mraa" |
9 | 9 | ||
10 | SRCREV = "dc45cd78595c7c24c8a8574c63bb48b5bb99c5aa" | 10 | SRCREV = "5cf20df96c6b35c19d5b871ba4e319e96b4df72d" |
11 | PV = "1.6.0-git${SRCPV}" | 11 | PV = "2.0.0+git${SRCPV}" |
12 | 12 | ||
13 | SRC_URI = "git://github.com/intel-iot-devkit/${BPN}.git;protocol=http \ | 13 | SRC_URI = "git://github.com/intel-iot-devkit/${BPN}.git;protocol=http \ |
14 | file://0001-Replace-strncpy-with-memcpy.patch \ | ||
15 | file://0001-include-sys-types.h-for-uint-definition.patch \ | ||
16 | file://0001-CMakeLists.txt-Use-SWIG_SUPPORT_FILES-to-find-the-li.patch \ | 14 | file://0001-CMakeLists.txt-Use-SWIG_SUPPORT_FILES-to-find-the-li.patch \ |
15 | file://0001-Use-stdint-types.patch \ | ||
17 | " | 16 | " |
18 | 17 | ||
19 | S = "${WORKDIR}/git" | 18 | S = "${WORKDIR}/git" |