Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next generation hardware handling #2429

Merged
merged 49 commits into from
Jan 28, 2021
Merged

Next generation hardware handling #2429

merged 49 commits into from
Jan 28, 2021

Conversation

pvizeli
Copy link
Member

@pvizeli pvizeli commented Jan 12, 2021

Proposed change

Rewrite the complete udev handling inside Supervisor. Now we only based on the host udev events and all hardware interactions are based on these events/lists.

It also removes the udev handling needs from the add-on. This is now a complete handle over the supervisor. The add-on config has a new option type device. This will be lookup and control by Supervisor and make most of the device hot&plug able. Based on device types or USB IDs, we generate a complete list for UI selection. We work internally also with the udev ID to make sure devices get correct mapped, also if the user does not use device-by-id selectors.

These changes aim a full working device handling to the user, almost like he do run Core.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints of add-on configuration are added/changed:

@pvizeli pvizeli marked this pull request as draft January 12, 2021 16:53
@pvizeli pvizeli added the new-feature A new feature label Jan 13, 2021
pvizeli and others added 3 commits January 27, 2021 15:38
@pvizeli
Copy link
Member Author

pvizeli commented Jan 27, 2021

This would be also requested by Deconz @manup

supervisor/addons/model.py Show resolved Hide resolved
supervisor/addons/validate.py Outdated Show resolved Hide resolved
supervisor/addons/validate.py Outdated Show resolved Hide resolved
supervisor/api/hardware.py Outdated Show resolved Hide resolved
supervisor/docker/addon.py Show resolved Hide resolved
supervisor/docker/addon.py Outdated Show resolved Hide resolved
@@ -284,7 +308,7 @@ def volumes(self) -> Dict[str, Dict[str, str]]:
# Init other hardware mappings

# GPIO support
if self.addon.with_gpio and self.sys_hardware.support_gpio:
if self.addon.with_gpio and self.sys_hardware.helper.support_gpio:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new libgpiod uses /dev/gpiochip* devices. Do we support that? I guess we could just add that as well if an addon wants GPIO access. See e.g. https://embeddedbits.org/new-linux-kernel-gpio-user-space-interface/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done by cgroup rules. We need only to know if we can apply it. But yeah, this function would be gone after I know the sys endpoint and can do it like for audio.

supervisor/exceptions.py Outdated Show resolved Hide resolved
supervisor/hardware/data.py Show resolved Hide resolved
pvizeli and others added 5 commits January 28, 2021 11:47
Co-authored-by: Stefan Agner <stefan@agner.ch>
Co-authored-by: Stefan Agner <stefan@agner.ch>
Co-authored-by: Stefan Agner <stefan@agner.ch>
Copy link
Member

@ludeeus ludeeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the deprecation warnings, I think we should only print those for add-ons that are installed.

supervisor/addons/validate.py Outdated Show resolved Hide resolved
supervisor/addons/validate.py Outdated Show resolved Hide resolved
supervisor/addons/validate.py Outdated Show resolved Hide resolved
supervisor/hardware/helper.py Show resolved Hide resolved
supervisor/hardware/monitor.py Outdated Show resolved Hide resolved
tests/hardware/test_module.py Outdated Show resolved Hide resolved
pvizeli and others added 2 commits January 28, 2021 13:26
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
@pvizeli pvizeli requested a review from ludeeus January 28, 2021 12:28
@ludeeus ludeeus added new-feature A new feature and removed new-feature A new feature labels Jan 28, 2021
@pvizeli pvizeli merged commit 6a0206c into main Jan 28, 2021
@pvizeli pvizeli deleted the next-hardware branch January 28, 2021 14:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants