1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 Daniel Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #ifdef ROCKBOX_HAS_LOGF
24 #include <timefuncs.h>
35 #ifdef HAVE_LCD_BITMAP
36 bool logfdisplay(void)
44 bool lcd
= false; /* fixed atm */
47 lcd_getstringsize("A", &w
, &h
);
49 #ifdef HAVE_REMOTE_LCD
56 #ifdef HAVE_REMOTE_LCD
63 if (columns
> MAX_LOGF_ENTRY
)
64 columns
= MAX_LOGF_ENTRY
;
74 for(i
= lines
-1; i
>=0; i
--) {
75 unsigned char buffer
[columns
+ 1];
79 index
= MAX_LOGF_LINES
-1;
84 memcpy(buffer
, logfbuffer
[index
], columns
);
86 lcd_puts(0, i
, buffer
);
89 } while(!action_userabort(HZ
));
93 #else /* HAVE_LCD_BITMAP */
94 bool logfdisplay(void)
97 /* TODO: implement a browser for charcell bitmaps */
100 #endif /* HAVE_LCD_BITMAP */
102 /* Store the logf log to logf.txt in the .rockbox directory. The order of the
103 * entries will be "reversed" so that the most recently logged entry is on the
109 if(!logfindex
&& !logfwrap
)
110 /* nothing is logged just yet */
113 fd
= open(ROCKBOX_DIR
"/logf.txt", O_CREAT
|O_WRONLY
|O_TRUNC
);
115 unsigned char buffer
[MAX_LOGF_ENTRY
+1];
116 int index
= logfindex
-1;
117 int stop
= logfindex
;
120 while(index
!= stop
) {
123 index
= MAX_LOGF_LINES
-1;
128 memcpy(buffer
, logfbuffer
[index
], MAX_LOGF_ENTRY
);
129 buffer
[MAX_LOGF_ENTRY
]=0;
130 fdprintf(fd
, "%s\n", buffer
);
138 #endif /* ROCKBOX_HAS_LOGF */