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

Shell autocreate shell instance #10511

Merged

Conversation

jakub-uC
Copy link
Contributor

@jakub-uC jakub-uC commented Oct 11, 2018

With this PR user will not have to bother creating shell backend. All that is required from the user is to enable particular shell backend in the Kconfig file. For each enabled backend shell instance will be created automatically.

Next step is to add console backend to the shell. Once this will be in place it will be enough to activate shell commands to start default shell instance: console.

Fixes #10480

@codecov-io
Copy link

codecov-io commented Oct 11, 2018

Codecov Report

Merging #10511 into master will increase coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10511      +/-   ##
==========================================
+ Coverage   53.18%   53.34%   +0.15%     
==========================================
  Files         210      210              
  Lines       25816    25816              
  Branches     5682     5682              
==========================================
+ Hits        13731    13772      +41     
+ Misses       9780     9733      -47     
- Partials     2305     2311       +6
Impacted Files Coverage Δ
lib/posix/pthread_sched.c 41.66% <0%> (-20.84%) ⬇️
lib/posix/pthread_mutex.c 77.77% <0%> (+1.38%) ⬆️
lib/posix/pthread.c 80.36% <0%> (+12.32%) ⬆️
lib/posix/pthread_cond.c 83.33% <0%> (+20.83%) ⬆️
include/posix/posix_sched.h 100% <0%> (+100%) ⬆️
lib/posix/pthread_barrier.c 100% <0%> (+100%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a103ea...35a6eac. Read the comment docs.

@@ -26,17 +26,13 @@

#include <gatt/hrs.h>

#define print(_sh, _ft, ...) \
#define print_sh(_sh, _ft, ...) \
Copy link
Member

Choose a reason for hiding this comment

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

WHy is this rename needed as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was affraid that print and printk are too similar.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that's an issue. Can you remove that change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this will block your approval I can do it ;)

Copy link
Member

Choose a reason for hiding this comment

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

Well yes, because it's unrelated to this particular problem you are solving with the PR here

Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

Thanks for this support. I tested this with multiple networking related shells and things work now as expected.

print(&uart_shell, "Type \"help\" for supported commands.");
print(&uart_shell, "Before any Bluetooth commands you must `bt init`"
" to initialize the stack.");
printk("Type \"help\" for supported commands.");
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change this from print to printk?

Copy link
Contributor

Choose a reason for hiding this comment

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

shell_fprintf must be used only in the scope of the command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

print is a macro, in fact it is a function shell_fprintf. This function shall not be used outside of command context what is a case here. I was trying to print this welcome message by Logger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is more you do not have access to uart_shell any more because it is created in shell_uart.c file.

Copy link
Member

Choose a reason for hiding this comment

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

OK, that makes sense.

Jakub Rzeszutko added 2 commits October 11, 2018 11:17
If user will enable shell than for each backend shell instance
will be created automatically.

Update all shell examples according to the new initialization
procedure.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
User do not need to initialize shell instance manually now
and this change has been reflected in the documentation.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
@jakub-uC jakub-uC force-pushed the shell_autocreate_shell_instance branch from 60cdad2 to 35a6eac Compare October 11, 2018 09:17
@carlescufi carlescufi merged commit 5b6f6e3 into zephyrproject-rtos:master Oct 11, 2018
@jakub-uC jakub-uC deleted the shell_autocreate_shell_instance branch January 30, 2019 15:00
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.

5 participants