Commit Graph

43 Commits

Author SHA1 Message Date
Solomon Peachy cc6b036ef5 logf: Fix an incorrect fix in 835d0c737a
Change-Id: I060033d9a7cd54bab75e4f82e3de002bdb027af2
2021-08-15 09:03:16 -04:00
Solomon Peachy 835d0c737a logf: Fix two issues with logf_panic_dump()
* It had a (read) buffer overflow when dumping the stuff on the back half of the buffer
 * a highly questionable code construct was nuked

Change-Id: I7f6f119524fc2095f788fc9b3d356459955d3ace
2021-08-06 10:08:00 -04:00
Solomon Peachy 7c87467ba4 configure: Add prompt for USB Serial into the advanced mode
And explicitly disable USB_ENABLE_SERIAL when HAVE_USBSTACK is not define

Change-Id: Ieb4176b02a60eb1b9db81f0b8c69403898a76ca1
2020-11-18 08:50:05 -05:00
Michael Sevakis 5c9688961e Implement a much more capable vuprintf()
New support as well as some buggy support fixed.

Still no floating point support if ever that would be desired.

Support (*):
* Flags: '-', '+', ' ', '#', '0'

* Width and precision: 'n', '.n', '*' and '.*'

* Length modifiers: 'hh', 'h', 'j', 'l', 'll', 't', 'z'

* Radix: 'c', 'd', 'i', 'n', 'o', 'p/P', 's', 'u', 'x/X'

(*) Provision exists to switch lesser-used stuff on or off or when
certain functionality isn't desired (bootloader?). The compulsory
radixes are everything but 'o', 'n', 'p/P' and 'x/X' with length
modifiers being optional. The default setup is 'l', 'z', 'c', 'd',
'p/P', 's', 'u', 'x/X'.

* Move fdprintf() to its own file. It was in a strange place.

* Make callers compatible and fix a couple snprintf() bugs while
at it.

Could smush it down in size but I'm gonna get over the binsize
neurosis and just the let optimizer do its thing.

Change-Id: Ibdc613a9b6775802c188b29b9dd46c568c94f7c3
2017-11-21 05:00:27 -05:00
Mihail Zenkov e599810ffa Don't add new message to logf when we dump it to file
Fix log file corruption if we have new messages at dumping log to file. Comment
removed as it incorrect. We store all messages in direct order (last message at
end of file).

Change-Id: I4acfa8a0935cc41a889e08f6bc42974fefd1ade2
2016-04-04 11:07:44 +02:00
Thomas Jarosch cfbd9cb22f Make a few local variables static
Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
2015-01-11 18:02:43 +01:00
Thomas Jarosch ef1497c3df Add missing va_end() call when the log is full
No need to go out of memory, too ;)

cppcheck reported:
[rockbox/firmware/logf.c:338]: (error) va_list 'ap' was opened but not closed by va_end().

Change-Id: I00e4c04d7e3d5d1415aa5066487ce1d9209e53aa
2014-12-20 13:48:43 +01:00
Thomas Martitz 470989bd70 events: Rework event subsystem (add_event, send_event) to be more versatile.
add_event_ex is added that takes an extra user_data pointer. This pointer is
passed to the callback (add_event and add_event_ex have slightly different
callbacks types). All callbacks also get the event id passed. Events added
with add_event_ex must be removed with remove_event_ex because the user_data
pointer must match in addition to the callback pointer.

On the other add_event is simplified to omit the oneshort parameter which
was almost always false (still there with add_event_ex).

As a side effect the ata_idle_notify callbacks are changed as well, they
do not take a data parameter anymore which was always NULL anyway.

This commit also adds some documentation to events.h

Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
2014-03-14 23:36:30 +01:00
Frank Gevaerts 25e50ed8f1 Print `last logf lines on panic().
If logf is enabled, panic() will print the last lines. On small
screens this is more or less useless, but on large screens it
can be very useful for debugging.

Change-Id: I26dfc76e9ac4a2ddc2def8db1616a04f943dbba3
Reviewed-on: http://gerrit.rockbox.org/709
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Reviewed-by: Frank Gevaerts <frank@gevaerts.be>
Tested: Frank Gevaerts <frank@gevaerts.be>
2014-01-11 11:37:18 +01:00
Amaury Pouly c13f21a4d5 Fix logdisk
The code was broken in a subtle but crucial way: storage idle
callbacks are oneshot so after the first flush everything would
stay in the buffer forever and would never be written to the disk
thus resulting into many events being lost. This changed correctly
registers the idle callback each time the buffer is not empty.
Note that the idle storage code checks if a callback
has is in the queue already so we don't register twice.

Change-Id: Ifdf331d4b757e05b8a6902bf5926cbc7689f5109
2013-08-16 21:59:16 +02:00
Michael Giacomelli 633dd49283 Remove copy/pasted preprocessor defines that shouldn't have been included.
Also, add dummy defines for application targets so that ERRORF, etc
map to DEBUGF instead of a compile error and add a new line at the
end of logf.c.

Change-Id: Ie7c5bc3397a853af619e810defce6123114e7a51
2012-08-06 19:20:47 -04:00
Michael Giacomelli d46b090771 Introduce logging to disk feature into rockbox.
Logs information, errors, etc to disk using the register_storage_idle_func
mechanism to write to the disk when available.  Currently, this is disabled
in normal builds, but can be enabled by adding ROCKBOX_HAS_LOGDISKF to the
config file.  By default, it uses a 2KB buffer and drops text if the buffer
overflows.

The system includes a simple warning level mechanism that can be used to by
default exclude non-serious errors from logging on release builds.

Change-Id: I0a3d186a93625c7c93dae37b993a0d37e5a3a925
Reviewed-on: http://gerrit.rockbox.org/288
Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
Tested-by: Michael Giacomelli <mgiacomelli@gmail.com>
Reviewed-by: Michael Giacomelli <mgiacomelli@gmail.com>
2012-08-07 00:53:46 +02:00
Ralf Ertzinger d2f97da668 Make logf() output to serial optional
Only output logf() to the serial port if LOGF_SERIAL is defined
(in addition to HAVE_SERIAL). Add an option to advanced configure
to set this (defaults to off).

Change-Id: I13d0f5df391e5371f7797f46a3faaf7a6974b9e4
Reviewed-on: http://gerrit.rockbox.org/92
Reviewed-by: Björn Stenberg <bjorn@haxx.se>
2012-02-16 14:44:43 +01:00
Rafaël Carré d00b7e8a6d Only use lcd-remote.h #ifdef HAVE_REMOTE_LCD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31613 a1c6a512-1295-4272-9138-f99709370657
2012-01-07 19:54:47 +00:00
Amaury Pouly c0838068e3 Fix a logf bug which would trigger undefined behaviour(and probably crash) when both DEBUG, CONFIG_PLATFORM & PLATFORM_HOSTED are enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27663 a1c6a512-1295-4272-9138-f99709370657
2010-08-02 09:10:35 +00:00
Thomas Martitz 35e8b1429a Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently).
The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR).
The new define is to (de-)select code to compile on hosted platforms generally.

Should be no functional change to targets or the simulator.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-06-21 16:53:00 +00:00
Jeffrey Goode b8a51adb57 vuprintf does not belong in stdio.h, causes problems with other versions of stdio.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26042 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 03:47:06 +00:00
Thomas Martitz 6ac64206f3 Revert r25854 which was bad for the database tool (I forgot it still needs the wrappers from uisimulator/common/io.c). Fix it so it works for both.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25856 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 22:17:34 +00:00
Thomas Martitz 1ddb91ad36 Rename vfnprintf to vuprintf (u stands for user for the user callback and data passed to it) to avoid confusion with file and buffer size related functions from the printf-family, and add a comment to its declaration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23503 a1c6a512-1295-4272-9138-f99709370657
2009-11-03 21:20:09 +00:00
Jeffrey Goode fade88af24 Echoes logf output to the sim console when logf build is enabled
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23485 a1c6a512-1295-4272-9138-f99709370657
2009-11-02 15:30:06 +00:00
Maurus Cuelenaere 20b0dd2788 A new implementation of logf, logfdisplay and logfdump.
Flyspray: FS#10528
Author: Amaury Pouly


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22462 a1c6a512-1295-4272-9138-f99709370657
2009-08-21 22:54:23 +00:00
Rafaël Carré 27934e26b7 Fix a wrong memcpy in logf() introduced in r22253
Flyspray: FS#10515
Author: Amaury Pouly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22276 a1c6a512-1295-4272-9138-f99709370657
2009-08-12 16:10:04 +00:00
Rafaël Carré 9a5174c8a3 Fix logf() multilines handling
Each line (of MAX_LOGF_ENTRY characters) would be marked with
LOGF_TERMINATE_CONTINUE_LINE, but still be padded with a '\0'

This also reverts r22250 which worked around the problem in logfdump()

Flyspray: FS#10513
Author: Amaury Pouly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22253 a1c6a512-1295-4272-9138-f99709370657
2009-08-11 16:12:03 +00:00
Nils Wallménius 3d4701a6e4 FS#10080
* Move strncpy() from core to the pluginlib
* Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins
* Drop strncpy() from the codec api as no codec used it
* Bump codec and plugin api versions


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
2009-07-14 13:57:45 +00:00
Frank Gevaerts c61a75173b Reorganise USB stack defines. Now config.h decides which class drivers get enabled instead of usb_core.h
Also enable HID, and use that as the dummy class instead of charging-only for controllers that have working interrupt transfers.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21053 a1c6a512-1295-4272-9138-f99709370657
2009-05-23 14:30:20 +00:00
Maurus Cuelenaere dd9a9e40f8 Commit FS#9970 by Yoshihisa Uchida: fix building when HAVE_SERIAL & ROCKBOX_HAS_LOGF is defined in a simulator build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20291 a1c6a512-1295-4272-9138-f99709370657
2009-03-11 16:42:25 +00:00
Frank Gevaerts 7ae9c8d5ce Fix building of tools/database/
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19940 a1c6a512-1295-4272-9138-f99709370657
2009-02-07 19:59:51 +00:00
Maurus Cuelenaere aec45210ea Fix (USB) serial logf()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19634 a1c6a512-1295-4272-9138-f99709370657
2009-01-01 19:54:30 +00:00
Maurus Cuelenaere b6eaf1db1b Fix off-by-one
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19626 a1c6a512-1295-4272-9138-f99709370657
2008-12-31 17:14:24 +00:00
Maurus Cuelenaere 4c793febc8 Commit FS#9733 (multiline logf) by Yoshihisa Uchida
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19625 a1c6a512-1295-4272-9138-f99709370657
2008-12-31 17:01:00 +00:00
Daniel Stenberg 2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Jonathan Gordon bdbdb97f19 FS#9051 - remove LCD margins... use viewports if you need them...
NOTE to WPS people....
%m has been removed, but (i think) because of the other %m tags it wont fail if you try loading a wps with %m|..|, it will just be ignored.
Also note that if the statusbar is enabled the default viewport is 8 pixels shorter than when its not, i.e (0,0) is really (0,8) if the statusbar is shown... I dont think this will be a major issue because almost no WPS show the bar and use bitmaps... text only WPS shouldnt be affected.

Please report problem screens in http://forums.rockbox.org/index.php?topic=17358.0


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17763 a1c6a512-1295-4272-9138-f99709370657
2008-06-23 13:20:35 +00:00
Frank Gevaerts 776d015cc4 implement logf over usb-serial. Needs USB_SERIAL defined in usb_core.h to work, and needs to be enabled in the debug menu.
It stops sending data after a while for unknown reasons.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16486 a1c6a512-1295-4272-9138-f99709370657
2008-03-02 20:45:33 +00:00
Miika Pekkarinen 0dd7ea2d71 Support building tagcache db natively on PC using the core of the
Rockbox tagcache database engine. Only host endian support at the
moment and no command line parameters. Mainly for developers for
debugging at the moment.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11497 a1c6a512-1295-4272-9138-f99709370657
2006-11-10 08:03:33 +00:00
Linus Nielsen Feltzing 00d218257b Logf output on the serial port for h100 targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11207 a1c6a512-1295-4272-9138-f99709370657
2006-10-12 20:22:16 +00:00
Michiel Van Der Kolk 25b55e16bc better logf
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6949 a1c6a512-1295-4272-9138-f99709370657
2005-06-30 15:14:33 +00:00
Tomas Salfischberger 1a558dae37 Moved to logf.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6808 a1c6a512-1295-4272-9138-f99709370657
2005-06-22 14:48:39 +00:00
Daniel Stenberg 6ebdbe8df3 Modified logf to use a define for the log width, and changed it to default to
21 as that is what fits in an iriver LCD by default since the font is 6 pixels
wide.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6547 a1c6a512-1295-4272-9138-f99709370657
2005-06-01 13:21:20 +00:00
Daniel Stenberg edc07922eb (Optional) logf support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6538 a1c6a512-1295-4272-9138-f99709370657
2005-05-30 13:00:43 +00:00
Daniel Stenberg 9e9f58f5c6 use proper remote lcd functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6522 a1c6a512-1295-4272-9138-f99709370657
2005-05-24 14:28:48 +00:00
Daniel Stenberg 11bf87fefa initial remote-LCD logf browser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6520 a1c6a512-1295-4272-9138-f99709370657
2005-05-24 14:26:54 +00:00
Linus Nielsen Feltzing 056effc945 Uses indices instead of pointers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6517 a1c6a512-1295-4272-9138-f99709370657
2005-05-24 14:01:16 +00:00
Daniel Stenberg b033f6cf4e initial logf() work, not added to SOURCES yet (on purpose)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6514 a1c6a512-1295-4272-9138-f99709370657
2005-05-23 22:47:42 +00:00