Merge branch 'master' into 29-generic-entities-support

This commit is contained in:
Fabio Manganiello 2023-01-08 00:23:57 +01:00
commit 66000a0774
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 7 additions and 5 deletions

View file

@ -213,7 +213,6 @@ class HidPlugin(RunnablePlugin):
for path in new_device_paths: for path in new_device_paths:
device = scanned_devices[path] device = scanned_devices[path]
get_bus().post(HidDeviceConnectedEvent(**device)) get_bus().post(HidDeviceConnectedEvent(**device))
monitor_rule = self._get_monitor_rule(device) monitor_rule = self._get_monitor_rule(device)
if monitor_rule: if monitor_rule:
self._register_device_monitor(device, monitor_rule) self._register_device_monitor(device, monitor_rule)
@ -227,7 +226,10 @@ class HidPlugin(RunnablePlugin):
lost_device_paths = available_device_paths.difference(scanned_device_paths) lost_device_paths = available_device_paths.difference(scanned_device_paths)
for path in lost_device_paths: for path in lost_device_paths:
get_bus().post(HidDeviceDisconnectedEvent(**self._available_devices[path])) device = self._available_devices.get(path)
if device:
get_bus().post(HidDeviceDisconnectedEvent(**device))
self._unregister_device_monitor(device['path'])
def _handle_device_events(self, scanned_devices: dict): def _handle_device_events(self, scanned_devices: dict):
""" """

View file

@ -50,7 +50,7 @@ class HidDeviceSchema(Schema):
class HidMonitoredDeviceSchema(HidDeviceSchema): class HidMonitoredDeviceSchema(HidDeviceSchema):
notify_only_if_changed = fields.Boolean( notify_only_if_changed = fields.Boolean(
missing=True, load_default=True,
metadata={ metadata={
'description': 'If set to true (default), only changes in the ' 'description': 'If set to true (default), only changes in the '
'values of the device will trigger events. So if you are e.g. ' 'values of the device will trigger events. So if you are e.g. '
@ -60,7 +60,7 @@ class HidMonitoredDeviceSchema(HidDeviceSchema):
) )
data_size = fields.Integer( data_size = fields.Integer(
missing=64, load_default=64,
metadata={ metadata={
'description': 'How many bytes should be read from the device on ' 'description': 'How many bytes should be read from the device on '
'each iteration (default: 64)', 'each iteration (default: 64)',
@ -68,7 +68,7 @@ class HidMonitoredDeviceSchema(HidDeviceSchema):
) )
poll_seconds = fields.Float( poll_seconds = fields.Float(
missing=0, load_default=0,
metadata={ metadata={
'description': 'How often we should wait before data reads ' 'description': 'How often we should wait before data reads '
'(default: no wait)' '(default: no wait)'