This patch ensures that CCC values for Intermediate Temperature and Termperature Measurement are always written when connecting to device. This is to i.e. disable notifications and/or indications in case they are already enabled (reconnection scenario) but we don't have watcher registered so it's pointless for remote to send us data. --- profiles/thermometer/thermometer.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c index 30f79b0..ad1a41d 100644 --- a/profiles/thermometer/thermometer.c +++ b/profiles/thermometer/thermometer.c @@ -550,19 +550,23 @@ static void process_thermometer_desc(struct characteristic *ch, uint16_t uuid, if (g_strcmp0(ch->uuid, TEMPERATURE_MEASUREMENT_UUID) == 0) { ch->t->measurement_ccc_handle = handle; - if (g_slist_length(ch->t->tadapter->fwatchers) == 0) - return; - - val = GATT_CLIENT_CHARAC_CFG_IND_BIT; - msg = g_strdup("Enable Temperature Measurement indication"); + if (g_slist_length(ch->t->tadapter->fwatchers) == 0) { + val = 0x0000; + msg = g_strdup("Disable Temperature Measurement ind"); + } else { + val = GATT_CLIENT_CHARAC_CFG_IND_BIT; + msg = g_strdup("Enable Temperature Measurement ind"); + } } else if (g_strcmp0(ch->uuid, INTERMEDIATE_TEMPERATURE_UUID) == 0) { ch->t->intermediate_ccc_handle = handle; - if (g_slist_length(ch->t->tadapter->iwatchers) == 0) - return; - - val = GATT_CLIENT_CHARAC_CFG_NOTIF_BIT; - msg = g_strdup("Enable Intermediate Temperature notification"); + if (g_slist_length(ch->t->tadapter->iwatchers) == 0) { + val = 0x0000; + msg = g_strdup("Disable Intermediate Temperature noti"); + } else { + val = GATT_CLIENT_CHARAC_CFG_NOTIF_BIT; + msg = g_strdup("Enable Intermediate Temperature noti"); + } } else if (g_strcmp0(ch->uuid, MEASUREMENT_INTERVAL_UUID) == 0) { val = GATT_CLIENT_CHARAC_CFG_IND_BIT; msg = g_strdup("Enable Measurement Interval indication"); -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html