summaryrefslogtreecommitdiff
path: root/mesh/model.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2019-11-11 20:54:06 +0100
committerBrian Gix <brian.gix@intel.com>2019-12-02 12:07:28 -0800
commit73401290cfe79853d4957a2d603237b1e73c4b71 (patch)
treee7cf52384250b8322e2320b5b37d0f52701c6716 /mesh/model.c
parentf246d31a775233578a7c4b721757e9fa9a49f69c (diff)
downloadbluez-73401290cfe79853d4957a2d603237b1e73c4b71.tar.gz
mesh: fix (re)transmit count & interval steps
The Foundation Model Layer uses little endian ordering. As a consequence the (re)transmit count and interval steps in the Config Relay, Config Model Publication and Config Network Transmit messages use the lower 3 bits for the (re)transmission count and the higher 5 bits for the interval steps. The figure 4.5 in section 4.3.2.16 of the Mesh Profile Bluetooth Specification provides a good clarification. This patch therefore fixes those messages for both the daemon and configuration client parts.
Diffstat (limited to 'mesh/model.c')
-rw-r--r--mesh/model.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesh/model.c b/mesh/model.c
index 57a63c59e..4091881ec 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -1633,8 +1633,8 @@ struct mesh_model *mesh_model_setup(struct mesh_node *node, uint8_t ele_idx,
if (pub && (pub->virt || !(IS_UNASSIGNED(pub->addr)))) {
uint8_t mod_addr[2];
uint8_t *pub_addr;
- uint8_t retransmit = (pub->count << 5) +
- (pub->interval / 50 - 1);
+ uint8_t retransmit = pub->count +
+ ((pub->interval / 50 - 1) << 3);
/* Add publication */
l_put_le16(pub->addr, &mod_addr);