summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2007-10-21 11:06:30 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2007-10-21 11:06:30 +0000
commitcaff835d78449d92166a78abd7b0c2d2559e38f2 (patch)
tree80f01783ab8fa45826f5008a047341c088360dac /apps
parent47cdc8955271f7c2bd0e73c8b5ed0436c9003a8a (diff)
Fixed debug menu crashing. Show last file processed by tagcache engine in debug menu. Enabled autoupdating of deleted files for flash storage devices.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15244 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c38
-rw-r--r--apps/gui/list.c6
-rw-r--r--apps/tagcache.c31
-rw-r--r--apps/tagcache.h7
4 files changed, 67 insertions, 15 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 995333e582..81f1c58d55 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1833,9 +1833,12 @@ static bool dbg_dircache_info(void)
#ifdef HAVE_TAGCACHE
static int database_callback(int btn, struct gui_synclist *lists)
{
- (void)btn; (void)lists;
+ (void)lists;
struct tagcache_stat *stat = tagcache_get_stat();
+ static bool synced = false;
+
simplelist_set_line_count(0);
+
simplelist_addline(SIMPLELIST_ADD_LINE, "Initialized: %s",
stat->initialized ? "Yes" : "No");
simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s",
@@ -1846,18 +1849,38 @@ static int database_callback(int btn, struct gui_synclist *lists)
stat->ramcache_used, stat->ramcache_allocated);
simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)",
stat->progress, stat->processed_entries);
+ simplelist_addline(SIMPLELIST_ADD_LINE, "Curfile: %s",
+ stat->curentry ? stat->curentry : "---");
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d",
stat->commit_step);
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s",
stat->commit_delayed ? "Yes" : "No");
+
+
+ if (synced)
+ {
+ synced = false;
+ tagcache_screensync_event();
+ }
+
+ if (!btn && stat->curentry)
+ {
+ synced = true;
+ return ACTION_REDRAW;
+ }
+
+ if (btn == ACTION_STD_CANCEL)
+ tagcache_screensync_enable(false);
+
return btn;
}
static bool dbg_tagcache_info(void)
{
struct simplelist_info info;
- simplelist_info_init(&info, "Database Info", 7, NULL);
+ simplelist_info_init(&info, "Database Info", 8, NULL);
info.action_callback = database_callback;
info.hide_selection = true;
+ tagcache_screensync_enable(true);
return simplelist_show_list(&info);
}
#endif
@@ -2257,15 +2280,10 @@ static char* dbg_menu_getname(int item, void * data, char *buffer)
bool debug_menu(void)
{
struct simplelist_info info;
- info.title = "Debug Menu";
- info.selection_size = 1;
- info.count = ARRAYLEN(menuitems);
- info.selection_size = 1;
+
+ simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL);
info.action_callback = menu_action_callback;
- info.hide_selection = false;
- info.scroll_all = false;
- info.get_icon = NULL;
info.get_name = dbg_menu_getname;
- info.callback_data = NULL;
+
return simplelist_show_list(&info);
}
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 6727f9b998..5c16c00aeb 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -1185,7 +1185,7 @@ bool simplelist_show_list(struct simplelist_info *info)
while(1)
{
gui_syncstatusbar_draw(&statusbars, true);
- action = get_action(CONTEXT_STD, HZ/5);
+ action = get_action(CONTEXT_STD, HZ/100);
if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD))
continue;
if (info->action_callback)
@@ -1196,14 +1196,16 @@ bool simplelist_show_list(struct simplelist_info *info)
}
if (action == ACTION_STD_CANCEL)
break;
- else if ((action == ACTION_REDRAW) || (old_line_count == simplelist_line_count))
+ else if ((action == ACTION_REDRAW) || (old_line_count != simplelist_line_count))
{
if (info->get_name == NULL)
gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size);
gui_synclist_draw(&lists);
+ old_line_count = simplelist_line_count;
}
else if(default_event_handler(action) == SYS_USB_CONNECTED)
return true;
+
}
return false;
}
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 96c04bde89..4ddf1d2d2d 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -3673,7 +3673,8 @@ static bool load_tagcache(void)
# endif
{
-# if 0 /* Maybe we could enable this for flash players. Too slow otherwise. */
+ /* Enabled for flash based targets. Too slow otherwise. */
+# ifdef HAVE_FLASH_STORAGE
/* Check if entry has been removed. */
if (global_settings.tagcache_autoupdate)
{
@@ -3834,11 +3835,20 @@ static bool check_dir(const char *dirname)
if (entry->attribute & ATTR_DIRECTORY)
check_dir(curpath);
else
+ {
+ tc_stat.curentry = curpath;
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
add_tagcache(curpath, dir->internal_entry);
#else
add_tagcache(curpath);
#endif
+
+ /* Wait until current path for debug screen is read and unset. */
+ while (tc_stat.syncscreen && tc_stat.curentry != NULL)
+ yield();
+
+ tc_stat.curentry = NULL;
+ }
curpath[len] = '\0';
}
@@ -3848,6 +3858,16 @@ static bool check_dir(const char *dirname)
return success;
}
+void tagcache_screensync_event(void)
+{
+ tc_stat.curentry = NULL;
+}
+
+void tagcache_screensync_enable(bool state)
+{
+ tc_stat.syncscreen = state;
+}
+
void build_tagcache(const char *path)
{
struct tagcache_header header;
@@ -4046,10 +4066,15 @@ static void tagcache_thread(void)
if (global_settings.tagcache_autoupdate)
{
build_tagcache("/");
- /* Don't do auto removal without dircache (very slow). */
-#ifdef HAVE_DIRCACHE
+ /* Don't do auto removal without dircache or flash
+ * storage (very slow). */
+#ifdef HAVE_FLASH_STORAGE
+ check_deleted_files();
+#else
+# ifdef HAVE_DIRCACHE
if (dircache_is_enabled())
check_deleted_files();
+# endif
#endif
}
diff --git a/apps/tagcache.h b/apps/tagcache.h
index 118b4c4119..6b2df6b984 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -103,6 +103,10 @@ struct tagcache_stat {
int ramcache_used; /* How much ram has been really used */
int progress; /* Current progress of disk scan */
int processed_entries; /* Scanned disk entries so far */
+ volatile const char
+ *curentry; /* Path of the current entry being scanned. */
+ volatile bool syncscreen;/* Synchronous operation with debug screen? */
+ // const char *uimessage; /* Pending error message. Implement soon. */
};
struct tagcache_search_clause
@@ -184,6 +188,9 @@ int tagcache_get_commit_step(void);
bool tagcache_prepare_shutdown(void);
void tagcache_shutdown(void);
+void tagcache_screensync_event(void);
+void tagcache_screensync_enable(bool state);
+
#ifdef HAVE_TC_RAMCACHE
bool tagcache_is_ramcache(void);
bool tagcache_fill_tags(struct mp3entry *id3, const char *filename);