Skip to content

Commit 1e38bef

Browse files
authored
fix(v4l2): warn on a failed control listing and don't cache it (follow-up #3391) (#3407)
* warn when video controls could not be applied `list_ctrls()` returning nothing leaves `vid_control_params` untouched, so the UI values are silently dropped. Only "failed to list controls of device" was logged, which does not mention that consequence. * fix(v4l2): don't cache an empty control list list_ctrls() cached its result unconditionally, including the empty dict a failed lookup produces. The cache has no expiry and is only cleared by list_devices(), so a briefly unreachable device kept an empty control list until that ran or motionEye restarted.
1 parent da7e73b commit 1e38bef

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

motioneye/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,12 @@ def motion_camera_ui_to_dict(ui, prev_config=None):
11311131
)
11321132
data['vid_control_params'] = ','.join(vid_control_params)
11331133

1134+
else:
1135+
logging.warning(
1136+
f'camera {prev_config["@id"]} control listing failed, '
1137+
'controls not updated'
1138+
)
1139+
11341140
else: # assuming netcam
11351141
if match(
11361142
r'^rtsp|^rtmp', data.get('netcam_url', prev_config.get('netcam_url', ''))

motioneye/controls/v4l2ctl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def list_ctrls(device):
205205

206206
controls[control] = properties
207207

208-
_ctrls_cache[device] = controls
208+
# don't cache an empty result, the cache has no expiry
209+
if controls:
210+
_ctrls_cache[device] = controls
209211

210212
return controls

0 commit comments

Comments
 (0)