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

Added option to use task PID for EUI seed under native POSIX #49

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

sgilbert182
Copy link
Contributor

sys_rand32_get() seems to return the same sequence when spooling up multiple thingset duplicate POSIX applications. This uses the task PID instead.

@martinjaeger
Copy link
Contributor

Thanks for the PR.

Under some circumstances it may be desirable to have a "predictable" random generator, e.g. for tests in CI, which is why such a generator is used by default in native_posix. I'm not sure, maybe that can be disabled via Kconfig?

Otherwise you can also alter the seed value on the command line:

./build/zephyr/zephyr.exe -seed=$RANDOM

Would that be sufficient?

If not, I'd be fine with your proposed change, but I'd like it to be selectable via Kconfig (defaulting to no), as I prefer having always the same ID when I do some debugging (as this is more like an actual device which is switched off and on).

@sgilbert182
Copy link
Contributor Author

Thanks Martin, I was not aware that I could update the seed in this way and that'll probably work for my needs.

I still think the changes may be useful so I'll add your Kconfig suggestions shortly.

@sgilbert182 sgilbert182 changed the title Changed EUI seed to use task PID for native POSIX Added option to use task PID for EUI seed under native POSIX Jun 18, 2024
Kconfig Show resolved Hide resolved
Copy link
Contributor

@martinjaeger martinjaeger left a comment

Choose a reason for hiding this comment

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

Thanks! Added a tiny improvement to make sure the Kconfig is only displayed when building for native_posix.

Gonna merge as soon as CI is green.

@martinjaeger martinjaeger merged commit b9ddc01 into ThingSet:main Jun 19, 2024
1 check passed
garethpotter pushed a commit to garethpotter/thingset-zephyr-sdk that referenced this pull request Jul 12, 2024
…t#49)

* Changed EUI seed to use task PID for native POSIX
* Use Kconfig to switch between RNG and PID based EUI generation
* Add BOARD_NATIVE_POSIX dependency to Kconfig

Co-authored-by: Simon Gilbert <[email protected]>
garethpotter pushed a commit to garethpotter/thingset-zephyr-sdk that referenced this pull request Aug 11, 2024
…t#49)

* Changed EUI seed to use task PID for native POSIX
* Use Kconfig to switch between RNG and PID based EUI generation
* Add BOARD_NATIVE_POSIX dependency to Kconfig

Co-authored-by: Simon Gilbert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants