Skip to content

Commit 0ece283

Browse files
committed
refactor: remove unused fan merging logic and add uv.lock for dependencies
1 parent cdbbf88 commit 0ece283

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

jtop/core/fan.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -136,57 +136,6 @@ def _collect_hwmon_fans(root_dir):
136136
return pwm_files, rpm_only
137137

138138

139-
def _merge_split_fans(pwm_files, rpm_only):
140-
if not pwm_files or not rpm_only:
141-
return pwm_files
142-
143-
unmatched_rpm = dict(rpm_only)
144-
145-
# First try to match by shared of_node or device path.
146-
for fan_name, fan_data in pwm_files.items():
147-
if 'rpm' in fan_data:
148-
continue
149-
150-
best_match = None
151-
fan_of_node = fan_data.get('of_node', '')
152-
fan_device = fan_data.get('device', '')
153-
154-
for rpm_name, rpm_data in unmatched_rpm.items():
155-
rpm_of_node = rpm_data.get('of_node', '')
156-
rpm_device = rpm_data.get('device', '')
157-
158-
if fan_of_node and rpm_of_node and fan_of_node == rpm_of_node:
159-
best_match = rpm_name
160-
break
161-
if fan_device and rpm_device and fan_device == rpm_device:
162-
best_match = rpm_name
163-
break
164-
165-
if best_match is not None:
166-
fan_data['rpm'] = unmatched_rpm[best_match]['rpm']
167-
fan_data['rpm_path'] = unmatched_rpm[best_match]['path']
168-
logger.info("Matched split RPM node %s -> fan %s by topology", best_match, fan_name)
169-
del unmatched_rpm[best_match]
170-
171-
# Thor fallback: one PWM fan and one standalone RPM node.
172-
if is_thor() and len(pwm_files) == 1 and len(unmatched_rpm) == 1:
173-
fan_name = next(iter(pwm_files))
174-
rpm_name = next(iter(unmatched_rpm))
175-
if 'rpm' not in pwm_files[fan_name]:
176-
pwm_files[fan_name]['rpm'] = unmatched_rpm[rpm_name]['rpm']
177-
pwm_files[fan_name]['rpm_path'] = unmatched_rpm[rpm_name]['path']
178-
logger.info("Matched Thor split RPM node %s -> fan %s", rpm_name, fan_name)
179-
del unmatched_rpm[rpm_name]
180-
181-
# Generic fallback: if still exactly one of each, merge them.
182-
if len(pwm_files) == 1 and len(unmatched_rpm) == 1:
183-
fan_name = next(iter(pwm_files))
184-
rpm_name = next(iter(unmatched_rpm))
185-
if 'rpm' not in pwm_files[fan_name]:
186-
pwm_files[fan_name]['rpm'] = unmatched_rpm[rpm_name]['rpm']
187-
pwm_files[fan_name]['rpm_path'] = unmatched_rpm[rpm_name]['path']
188-
189-
190139
def _merge_split_fans(pwm_files, rpm_only):
191140
if not pwm_files or not rpm_only:
192141
return pwm_files

0 commit comments

Comments
 (0)