1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 Daniel Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #ifdef ROCKBOX_HAS_LOGF
26 #include <timefuncs.h>
37 #ifdef HAVE_LCD_BITMAP
38 bool logfdisplay(void)
46 bool lcd
= false; /* fixed atm */
49 lcd_getstringsize("A", &w
, &h
);
51 #ifdef HAVE_REMOTE_LCD
58 #ifdef HAVE_REMOTE_LCD
65 if (columns
> MAX_LOGF_ENTRY
)
66 columns
= MAX_LOGF_ENTRY
;
75 for(i
= lines
-1; i
>=0; i
--) {
76 unsigned char buffer
[columns
+ 1];
80 index
= MAX_LOGF_LINES
-1;
85 memcpy(buffer
, logfbuffer
[index
], columns
);
87 lcd_puts(0, i
, buffer
);
90 } while(!action_userabort(HZ
));
94 #else /* HAVE_LCD_BITMAP */
95 bool logfdisplay(void)
98 /* TODO: implement a browser for charcell bitmaps */
101 #endif /* HAVE_LCD_BITMAP */
103 /* Store the logf log to logf.txt in the .rockbox directory. The order of the
104 * entries will be "reversed" so that the most recently logged entry is on the
110 if(!logfindex
&& !logfwrap
)
111 /* nothing is logged just yet */
114 fd
= open(ROCKBOX_DIR
"/logf.txt", O_CREAT
|O_WRONLY
|O_TRUNC
);
116 unsigned char buffer
[MAX_LOGF_ENTRY
+1];
117 int index
= logfindex
-1;
118 int stop
= logfindex
;
121 while(index
!= stop
) {
124 index
= MAX_LOGF_LINES
-1;
129 memcpy(buffer
, logfbuffer
[index
], MAX_LOGF_ENTRY
);
130 buffer
[MAX_LOGF_ENTRY
]=0;
131 fdprintf(fd
, "%s\n", buffer
);
139 #endif /* ROCKBOX_HAS_LOGF */