summaryrefslogtreecommitdiffstats
path: root/common/ratp/ratp.c
Commit message (Collapse)AuthorAgeFilesLines
* ratp: Increase the establish timeout to 1secJules Maselbas2023-02-131-1/+1
| | | | | | | | | | Current timeout was only 100ms which is also the current initial value for the RTO (Retransmission Time Out), this is too short as it doesn't give barebox a chance to resent a packet during the handshake. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20230207162055.10050-4-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net' into masterSascha Hauer2020-09-251-14/+43
|\
| * ratp: Switch to workqueuesSascha Hauer2020-08-131-14/+43
| | | | | | | | | | | | | | This switches running barebox commands in ratp to a context where it's safe to do so: In a work queue. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ratp: Remove duplicated includesJules Maselbas2020-08-031-2/+0
| | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ratp: Abort console_countdown when activatedJules Maselbas2020-08-031-0/+3
|/ | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: Straighten ratp deregistrationSascha Hauer2020-06-161-49/+49
| | | | | | | | | | | | | There are some bugs in the error path when ratp initialization fails half way through. Reusing the global ratp context which might be half initialized makes the code hard to follow and hard to fix, so the strategy is changed to always allocating a fresh ratp context and returning -EBUSY when one exists already. We store in the context what has been done in the initialization path and add a ratp_unregister() which uses this information to tear down everything that has been initialized. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2020-06-111-1/+16
|\
| * ratp: Remove unnecessary poller_call()Sascha Hauer2020-05-201-1/+0
| | | | | | | | | | | | | | poller_call() is called by is_timeout(), no need to do this again in a timeout loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: Test if console exists before using itSascha Hauer2020-05-201-0/+16
| | | | | | | | | | | | | | | | Consoles can be unregistered, this happens for example when barebox implements the barebox serial USB gadget. Before using the console we have to explicitly test if the pointer is still valid each time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | poller: Give pollers a nameSascha Hauer2020-05-201-1/+1
|/ | | | | | It helps debugging when pollers have a name, so give them one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-271-3/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: fix out-of-bounds read in dputc(/dev/*, ...)Ahmad Fatoum2019-09-021-7/+5
| | | | | | | | | | | | | | | | | | Trying to output a single character via echo -a /dev/serial0-1 currently results in garbage output after the newline, because console.c's fops_write discards the buffer length and passes the buffer to (struct cdev)::puts which only handles NUL-terminated strings. Fix this by amending (struct cdev)::puts with a new nbytes parameter, which is correctly propagated. All this functions now return at most the nbytes parameter they were passed in. This fixes __console_puts, which used to count new lines twice in its return value. Fixes: b4f55fcf35 ("console: expose consoles in devfs") Cc: Bastian Krause <bst@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: fix compile warningsOleksij Rempel2018-10-231-1/+1
| | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: use xstrndup() instead of a custom xmemdup_add_zero()Aleksander Morgado2018-03-011-12/+1
| | | | | | | | The console operations done via RATP expect strings, so just use xstrndup() instead of defining a custom method. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: implement getenv as a standard ratp commandAleksander Morgado2018-03-011-30/+0
| | | | | | | | Also, use xstrndup() instead of the custom xmemdup_add_zero() as we're working with strings anyway. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: implement ping as a standard ratp commandAleksander Morgado2018-03-011-24/+0
| | | | | Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: allow building without full console supportAleksander Morgado2018-03-011-2/+5
| | | | | | | | | | | | | Make CONFIG_RATP a selectable config option, so that the user can enable RATP support without explicitly needing to enable the full console support over RATP (e.g. only for RATP FS or built-in command support). The full console can still be explicitly enabled with CONFIG_CONSOLE_RATP. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: moved logic to its own subdirectoryAleksander Morgado2018-03-011-0/+544
We are going to add new RATP command implementations in separate files within this subdirectory. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>