summaryrefslogtreecommitdiffstats
path: root/common/console_common.c
Commit message (Collapse)AuthorAgeFilesLines
* stdio: Replace FILE functions with filedescriptor functionsSascha Hauer2016-04-151-9/+9
| | | | | | | | | | | | We have defined stdin, stdout and stderr as integer file descriptors, but normally they should be FILE *. Also fprintf, fputc and fputs take file descriptors instead of FILE *. As FILE * are inconvenient in the barebox environment replace the f* functions with the corresponding d* functions. dprintf is POSIX conform whereas dputc and dputs are barebox specific, but do not conflict with any stdc function. fgetc is unused and can be removed without replacing it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: use int rather than uint in printf() and friendsMasahiro Yamada2015-09-071-3/+3
| | | | | | | | These functions and vsprintf() return int type. No reason to use uint type. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: rework login mechanismSascha Hauer2015-08-281-27/+0
| | | | | | | | | | | | | | We used to have the login functionality in the /env/bin/init script. This is hard to review and it's too easy to break the login functionality with changes to this script. Move the places to ask for a password to C code where we have only a few places where we have to ask for a password. Mainly these are run_shell() and the menutree command. This patch introduces a login() function which will only return if the correct password has been entered. Following calls will return immediately without asking for a password again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-06-091-3/+11
|\
| * console: use regular malloc for log messagesSascha Hauer2015-05-151-3/+11
| | | | | | | | | | | | | | | | Using xfunctions to allocate log messages is not a good idea. Should we be out of memory the xfunctions will panic which will cause another allocation, so we deadlock the system with no message going out. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console: Add console_get_by_nameSascha Hauer2015-06-091-0/+13
|/ | | | | | | Commands like loadx/loady wish to find a console device by its name. Add a function for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: Make locally used function staticSascha Hauer2015-03-041-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: console_console: put functions under correct ifdefLucas Stach2015-01-191-35/+35
| | | | | | | | | | So they aren't build when no console support is selected. Fixes: In function `console_get_by_dev': undefined reference to `console_list' Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: Make sure xzalloc is only used when it's availableSascha Hauer2015-01-051-1/+1
| | | | | | | | To make it possible to call the pr_* functions very early before malloc is initialized test if malloc is available before using it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce message logging supportSascha Hauer2014-09-301-3/+126
| | | | | | | | | | This adds a buffer for log messages and a 'dmesg' command to print the messages. The log buffer is implemented as log objects rather than a string buffer. This makes it easy to implement limiting the messages, cleaning the buffer and timestamping the messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rs485'Sascha Hauer2013-10-071-0/+13
|\ | | | | | | | | Conflicts: common/console_common.c
| * console: introduce console_get_by_devJean-Christophe PLAGNIOL-VILLARD2013-09-241-0/+13
| | | | | | | | | | | | | | so we can get console by it's device Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/login'Sascha Hauer2013-10-071-0/+60
|\ \ | | | | | | | | | | | | Conflicts: include/console.h
| * | introduce runtime loglevelSascha Hauer2013-09-291-0/+27
| | | | | | | | | | | | | | | | | | | | | With this the verbosity of barebox can be controlled during runtime using the 'loglevel' globalvar. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | login: disable input console if password wrongJean-Christophe PLAGNIOL-VILLARD2013-09-191-0/+33
| |/ | | | | | | | | | | | | so we guarantee that barebox is secured again user interaction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / console: factorise function to get the first enabled consoleJean-Christophe PLAGNIOL-VILLARD2013-10-061-0/+22
|/ | | | | | | rename it to console_get_first_active Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: consolidate common console codeSascha Hauer2013-02-131-0/+110
The different console implementations share a good amount of code, share this in console_common.c. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>