sys/auto_init: Allow to auto-initalize sensors and actuators independ of SAUL#11871
sys/auto_init: Allow to auto-initalize sensors and actuators independ of SAUL#11871maribu wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
ghost
left a comment
There was a problem hiding this comment.
Looks way better than I imagined, well done.
But if I understand correctly, there is no way to de/activate auto_init for specific drivers only? If so, is this wanted?
Also I would appreciate more verbose documentation - but it's obvsly not blocking.
I don't really want to ack/block this at all since I don't see the need for it and don't agree with all the arguments. I prefer another maintainer (@kaspar030?) takes the responsibility. Summon me if this PR get's stuck.
I'll add that on Monday (hopefully, otherwise as soon as I can). |
|
@SemjonKerner: I extended the documentation as you suggested. |
|
OK, no one seems to complain :-) @MichelRottleuthner: Mind to take a look? (Btw: It is good that the merge conflict is showing. This PR should never have touched that file. I'll rebase to fix that.) |
c1d022c to
27d17d8
Compare
|
Why not just have one |
I have nothing against merging them. (There are some reasons to keep them separated though, for one both groups are continuously growing and having them separate roughly cuts the number of drivers in the group in half; two smaller lists are easier to read than one long list. Secondly, someone wanting all sensors auto-initalized but manually initializing the actuators will find this separation useful.) If they should be merged in to a single group, I think just "drivers" would not be the ideal name, as e.g. network device drivers are already in the |
|
Ping! (Also: please give feedback on whether I should merge auto init for sensors and actuators to the same auto_init submodule. To me, either is fine.) |
|
Hey, merging both makes sense to me. I can't think of a use case where it is important to differentiate that way. Also it resembles the file structure of the code base and it will look cleaner and minimize new keywords. |
haukepetersen
left a comment
There was a problem hiding this comment.
The general idea to have some user-friendly, simple was to initialize devices without a dependency to SAUL is quite nice, thanks for taking this on!
With the current state of the code/concept I see at least two problems:
- IMHO it does not make sense to split between sensors and actuators. Why even focus on these two - the approach is valid for all supported devices!
- the current code leads to significant code duplication comparing it to all those ugly
saul/auto_init_xx.cfiles. So we should actually combine both: use the generic auto_init for devices, an put the SAUL auto init on top of it
In terms or requirements, I think we should keep the following in mind:
- all the auto_init should be optional, it must always be possible to manually configure/initialize device from a use application for complete control
- the configuration (submodule-names and effects) should be as intuitive as possible so its always clear which devices are actually auto-initialized and which are not
- we should make sure to integrate nicely with existing auto-init blocks -> how about combining this also with
auto_init/netif?!
+1 But lets focus on sensors and actuators for now. First, not everyone seems to agree on that (while everyone no at least can tolerate the auto init for sensors and actuators). Second, it makes sense to me to do this is smaller steps. (To me: One PR for the infrastructure of each driver group and one PR per driver. This should PR should the infrastructure for auto initialization of sensors and actuators.)
+1 This is actually exactly what I proposed and what I did in the proof of concept implementation. The
+1 This was the single point in the discussion so far everyone agreed upon, and everyone did so strongly as far as I can tell.
+1 Maybe Maybe the pseudomodule to auto-init everything (that can be sensible auto-initialized) is best named I'm also not sure if there is actually a use case of wanting to add modules to auto init by group. I can easily see someone generally wanting to auto init the modules, with the exception of one or two modules. That would be best done by
Can you elaborate on that? So for the auto init implementations seem to be deliberately independent of each other, so that the do not have and inter-dependencies or interactions. With the huge number of individual auto_init implementations, I think it would easily become a maintenance mess if would no longer be able to treat same is completely isolated from each other. The number of possible auto_init configurations with n auto init implementations is: That is too huge to test. So we really should have them as isolated as possible IMHO. |
I like the idea. I hope I get time to push this forward again; maybe during my parental leave that is expected to start in a few weeks. |
04e456d to
66c4dd2
Compare
|
I updated this PR to merge the auto initialization of sensors and actuators and solved the merge conflicts. The proof of concept implementation in #11872 has been updated on top of this. |
Hmm, as the issue is with the upstream RIOT, I'd say it is better to discuss this in an issue. You can reference this PR, if this PR should take lessons learned into account. Could you also provide some details? Maybe you could share a trimmed down version of your code? (Only the initialization part, the actual application logic is most likely not relevant for the issue.) That way it would be easier to understand the issue. Feel free to mention me in the issue, so that I have a look. |
|
+1 for going forward with this one. I do think it might make sense to make a distinction between the
I would also say that fine grained is better, but maybe not always justified, I would think it would be best to have:
|
I still don't get how this distinction is "worth it". We had this topic already, but feel free to change my mind. I agree we shouldn't have this PR pending much longer. It has good potential. |
|
@maribu can we revive this? from re-reading the discussion current state of the PR was preferred by reviewers so let's move forward as is? |
- Added module auto_init_actuators_sensors to auto-initialize actuator
and sensor drivers
- Auto-initialization for actuator/sensor driver `foo` will be
implemented in submodule `auto_init_actuators_sensors_foo`
- SAUL registration is also performed by that hook, if
`auto_init_saul` is used
- Pseudo-module `auto_init_sensors_actuators_default` is used to pull in
sensor and actuator auto_init submodules for all drivers used
- Made `auto_init_saul` depend on `auto_init_sensors_actuators_default`
b77cdd2 to
e1936d8
Compare
I guess a rebase and two ACKs? The rebase is done :-) |
|
I was about to ACK (and postpone merging for a week to until after sofrt freeze), but seeing the discussion above, would it make sense to directly come up with an XFA based init scheme? |
Likely. Also, having to migrate init code isn't fun. Doing two migrations for the cost of one sounds like a sweet deal to me. I try to come up with a scheme till hard feature freeze. |
Don't rush and let's maybe sync, I've many ideas already! |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
|
Damn it - I found this one too late. Is this PR sill up to date anyway? |
|
Actually, let's drop this PR. We better reimplement this with @fabian18's XFA auto init as foundation. Let's see who is the first to open a PR for that :) |
Contribution description
auto_init_actuators_sensorsto auto-initialize actuators and sensorsfooand actuator driverbarwill be implemented in submoduleauto_init_actuators_sensors_fooandauto_init_actuators_sensors_bar, respectivelyauto_init_actuators_sensors_defaultis intended to pull in sensor and actuator auto_init submodules for all drivers usedauto_init_sauldepend on them onauto_init_actuators_sensors_defaultTesting procedure
This cannot be reasonable be done without a user of the new interface. Therefore, please head over to #11872 to test the adaption of the SHT1X driver to this new auto_init concept, once the fundamentals and the API proposed here are agreed upon.
Issues/PRs references
Implements the seemingly reached consensus in Issue #11826