e temp - use labels not paths to match sensors - more reliable

the device PATHS may change - depending on probe times/order and luck,
so use the labels to match as these should be more reliable boot to
boot.

@fix
This commit is contained in:
Carsten Haitzler 2021-12-14 19:53:02 +00:00
parent 988df49def
commit d936a22ff6
2 changed files with 14 additions and 4 deletions

View File

@ -81,7 +81,7 @@ _fill_data_tempget(E_Config_Dialog_Data *cfdata)
EINA_LIST_FREE(sensors, sen) EINA_LIST_FREE(sensors, sen)
{ {
if ((cfdata->inst->sensor_name) && if ((cfdata->inst->sensor_name) &&
(!strcmp(sen->name, cfdata->inst->sensor_name))) (!strcmp(sen->label, cfdata->inst->sensor_name)))
cfdata->sensor = n; cfdata->sensor = n;
cfdata->sensors = eina_list_append(cfdata->sensors, sen); cfdata->sensors = eina_list_append(cfdata->sensors, sen);
n++; n++;
@ -192,7 +192,7 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
sen = eina_list_nth(cfdata->sensors, cfdata->sensor); sen = eina_list_nth(cfdata->sensors, cfdata->sensor);
if (sen) if (sen)
eina_stringshare_replace(&(cfdata->inst->sensor_name), sen->name); eina_stringshare_replace(&(cfdata->inst->sensor_name), sen->label);
e_config_save_queue(); e_config_save_queue();
temperature_face_update_config(cfdata->inst); temperature_face_update_config(cfdata->inst);

View File

@ -601,7 +601,12 @@ init(Tempthread *tth)
{ {
EINA_LIST_FOREACH(mon->temps, ll, temp) EINA_LIST_FOREACH(mon->temps, ll, temp)
{ {
tth->sensor_name = eina_stringshare_add(temp->path); char buf[256];
snprintf(buf, sizeof(buf), "%s - %s",
mon->label ? mon->label : mon->name,
temp->label ? temp->label : temp->name);
tth->sensor_name = eina_stringshare_add(buf);
break; break;
} }
} }
@ -630,7 +635,12 @@ check(Tempthread *tth)
{ {
EINA_LIST_FOREACH(mon->temps, ll, temp) EINA_LIST_FOREACH(mon->temps, ll, temp)
{ {
if (!strcmp(tth->sensor_name, temp->path)) char buf[256];
snprintf(buf, sizeof(buf), "%s - %s",
mon->label ? mon->label : mon->name,
temp->label ? temp->label : temp->name);
if (!strcmp(tth->sensor_name, buf))
{ {
t = temp->temp; t = temp->temp;
break; break;