diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2007-10-21 11:06:30 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2007-10-21 11:06:30 +0000 |
commit | caff835d78449d92166a78abd7b0c2d2559e38f2 (patch) | |
tree | 80f01783ab8fa45826f5008a047341c088360dac | |
parent | 47cdc8955271f7c2bd0e73c8b5ed0436c9003a8a (diff) | |
download | rockbox-caff835d78449d92166a78abd7b0c2d2559e38f2.tar.gz rockbox-caff835d78449d92166a78abd7b0c2d2559e38f2.zip |
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
-rw-r--r-- | apps/debug_menu.c | 38 | ||||
-rw-r--r-- | apps/gui/list.c | 6 | ||||
-rw-r--r-- | apps/tagcache.c | 31 | ||||
-rw-r--r-- | apps/tagcache.h | 7 |
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) | |||
1833 | #ifdef HAVE_TAGCACHE | 1833 | #ifdef HAVE_TAGCACHE |
1834 | static int database_callback(int btn, struct gui_synclist *lists) | 1834 | static int database_callback(int btn, struct gui_synclist *lists) |
1835 | { | 1835 | { |
1836 | (void)btn; (void)lists; | 1836 | (void)lists; |
1837 | struct tagcache_stat *stat = tagcache_get_stat(); | 1837 | struct tagcache_stat *stat = tagcache_get_stat(); |
1838 | static bool synced = false; | ||
1839 | |||
1838 | simplelist_set_line_count(0); | 1840 | simplelist_set_line_count(0); |
1841 | |||
1839 | simplelist_addline(SIMPLELIST_ADD_LINE, "Initialized: %s", | 1842 | simplelist_addline(SIMPLELIST_ADD_LINE, "Initialized: %s", |
1840 | stat->initialized ? "Yes" : "No"); | 1843 | stat->initialized ? "Yes" : "No"); |
1841 | simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s", | 1844 | simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s", |
@@ -1846,18 +1849,38 @@ static int database_callback(int btn, struct gui_synclist *lists) | |||
1846 | stat->ramcache_used, stat->ramcache_allocated); | 1849 | stat->ramcache_used, stat->ramcache_allocated); |
1847 | simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)", | 1850 | simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)", |
1848 | stat->progress, stat->processed_entries); | 1851 | stat->progress, stat->processed_entries); |
1852 | simplelist_addline(SIMPLELIST_ADD_LINE, "Curfile: %s", | ||
1853 | stat->curentry ? stat->curentry : "---"); | ||
1849 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d", | 1854 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d", |
1850 | stat->commit_step); | 1855 | stat->commit_step); |
1851 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s", | 1856 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s", |
1852 | stat->commit_delayed ? "Yes" : "No"); | 1857 | stat->commit_delayed ? "Yes" : "No"); |
1858 | |||
1859 | |||
1860 | if (synced) | ||
1861 | { | ||
1862 | synced = false; | ||
1863 | tagcache_screensync_event(); | ||
1864 | } | ||
1865 | |||
1866 | if (!btn && stat->curentry) | ||
1867 | { | ||
1868 | synced = true; | ||
1869 | return ACTION_REDRAW; | ||
1870 | } | ||
1871 | |||
1872 | if (btn == ACTION_STD_CANCEL) | ||
1873 | tagcache_screensync_enable(false); | ||
1874 | |||
1853 | return btn; | 1875 | return btn; |
1854 | } | 1876 | } |
1855 | static bool dbg_tagcache_info(void) | 1877 | static bool dbg_tagcache_info(void) |
1856 | { | 1878 | { |
1857 | struct simplelist_info info; | 1879 | struct simplelist_info info; |
1858 | simplelist_info_init(&info, "Database Info", 7, NULL); | 1880 | simplelist_info_init(&info, "Database Info", 8, NULL); |
1859 | info.action_callback = database_callback; | 1881 | info.action_callback = database_callback; |
1860 | info.hide_selection = true; | 1882 | info.hide_selection = true; |
1883 | tagcache_screensync_enable(true); | ||
1861 | return simplelist_show_list(&info); | 1884 | return simplelist_show_list(&info); |
1862 | } | 1885 | } |
1863 | #endif | 1886 | #endif |
@@ -2257,15 +2280,10 @@ static char* dbg_menu_getname(int item, void * data, char *buffer) | |||
2257 | bool debug_menu(void) | 2280 | bool debug_menu(void) |
2258 | { | 2281 | { |
2259 | struct simplelist_info info; | 2282 | struct simplelist_info info; |
2260 | info.title = "Debug Menu"; | 2283 | |
2261 | info.selection_size = 1; | 2284 | simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL); |
2262 | info.count = ARRAYLEN(menuitems); | ||
2263 | info.selection_size = 1; | ||
2264 | info.action_callback = menu_action_callback; | 2285 | info.action_callback = menu_action_callback; |
2265 | info.hide_selection = false; | ||
2266 | info.scroll_all = false; | ||
2267 | info.get_icon = NULL; | ||
2268 | info.get_name = dbg_menu_getname; | 2286 | info.get_name = dbg_menu_getname; |
2269 | info.callback_data = NULL; | 2287 | |
2270 | return simplelist_show_list(&info); | 2288 | return simplelist_show_list(&info); |
2271 | } | 2289 | } |
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) | |||
1185 | while(1) | 1185 | while(1) |
1186 | { | 1186 | { |
1187 | gui_syncstatusbar_draw(&statusbars, true); | 1187 | gui_syncstatusbar_draw(&statusbars, true); |
1188 | action = get_action(CONTEXT_STD, HZ/5); | 1188 | action = get_action(CONTEXT_STD, HZ/100); |
1189 | if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD)) | 1189 | if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD)) |
1190 | continue; | 1190 | continue; |
1191 | if (info->action_callback) | 1191 | if (info->action_callback) |
@@ -1196,14 +1196,16 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
1196 | } | 1196 | } |
1197 | if (action == ACTION_STD_CANCEL) | 1197 | if (action == ACTION_STD_CANCEL) |
1198 | break; | 1198 | break; |
1199 | else if ((action == ACTION_REDRAW) || (old_line_count == simplelist_line_count)) | 1199 | else if ((action == ACTION_REDRAW) || (old_line_count != simplelist_line_count)) |
1200 | { | 1200 | { |
1201 | if (info->get_name == NULL) | 1201 | if (info->get_name == NULL) |
1202 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); | 1202 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); |
1203 | gui_synclist_draw(&lists); | 1203 | gui_synclist_draw(&lists); |
1204 | old_line_count = simplelist_line_count; | ||
1204 | } | 1205 | } |
1205 | else if(default_event_handler(action) == SYS_USB_CONNECTED) | 1206 | else if(default_event_handler(action) == SYS_USB_CONNECTED) |
1206 | return true; | 1207 | return true; |
1208 | |||
1207 | } | 1209 | } |
1208 | return false; | 1210 | return false; |
1209 | } | 1211 | } |
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) | |||
3673 | # endif | 3673 | # endif |
3674 | { | 3674 | { |
3675 | 3675 | ||
3676 | # if 0 /* Maybe we could enable this for flash players. Too slow otherwise. */ | 3676 | /* Enabled for flash based targets. Too slow otherwise. */ |
3677 | # ifdef HAVE_FLASH_STORAGE | ||
3677 | /* Check if entry has been removed. */ | 3678 | /* Check if entry has been removed. */ |
3678 | if (global_settings.tagcache_autoupdate) | 3679 | if (global_settings.tagcache_autoupdate) |
3679 | { | 3680 | { |
@@ -3834,11 +3835,20 @@ static bool check_dir(const char *dirname) | |||
3834 | if (entry->attribute & ATTR_DIRECTORY) | 3835 | if (entry->attribute & ATTR_DIRECTORY) |
3835 | check_dir(curpath); | 3836 | check_dir(curpath); |
3836 | else | 3837 | else |
3838 | { | ||
3839 | tc_stat.curentry = curpath; | ||
3837 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 3840 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
3838 | add_tagcache(curpath, dir->internal_entry); | 3841 | add_tagcache(curpath, dir->internal_entry); |
3839 | #else | 3842 | #else |
3840 | add_tagcache(curpath); | 3843 | add_tagcache(curpath); |
3841 | #endif | 3844 | #endif |
3845 | |||
3846 | /* Wait until current path for debug screen is read and unset. */ | ||
3847 | while (tc_stat.syncscreen && tc_stat.curentry != NULL) | ||
3848 | yield(); | ||
3849 | |||
3850 | tc_stat.curentry = NULL; | ||
3851 | } | ||
3842 | 3852 | ||
3843 | curpath[len] = '\0'; | 3853 | curpath[len] = '\0'; |
3844 | } | 3854 | } |
@@ -3848,6 +3858,16 @@ static bool check_dir(const char *dirname) | |||
3848 | return success; | 3858 | return success; |
3849 | } | 3859 | } |
3850 | 3860 | ||
3861 | void tagcache_screensync_event(void) | ||
3862 | { | ||
3863 | tc_stat.curentry = NULL; | ||
3864 | } | ||
3865 | |||
3866 | void tagcache_screensync_enable(bool state) | ||
3867 | { | ||
3868 | tc_stat.syncscreen = state; | ||
3869 | } | ||
3870 | |||
3851 | void build_tagcache(const char *path) | 3871 | void build_tagcache(const char *path) |
3852 | { | 3872 | { |
3853 | struct tagcache_header header; | 3873 | struct tagcache_header header; |
@@ -4046,10 +4066,15 @@ static void tagcache_thread(void) | |||
4046 | if (global_settings.tagcache_autoupdate) | 4066 | if (global_settings.tagcache_autoupdate) |
4047 | { | 4067 | { |
4048 | build_tagcache("/"); | 4068 | build_tagcache("/"); |
4049 | /* Don't do auto removal without dircache (very slow). */ | 4069 | /* Don't do auto removal without dircache or flash |
4050 | #ifdef HAVE_DIRCACHE | 4070 | * storage (very slow). */ |
4071 | #ifdef HAVE_FLASH_STORAGE | ||
4072 | check_deleted_files(); | ||
4073 | #else | ||
4074 | # ifdef HAVE_DIRCACHE | ||
4051 | if (dircache_is_enabled()) | 4075 | if (dircache_is_enabled()) |
4052 | check_deleted_files(); | 4076 | check_deleted_files(); |
4077 | # endif | ||
4053 | #endif | 4078 | #endif |
4054 | } | 4079 | } |
4055 | 4080 | ||
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 { | |||
103 | int ramcache_used; /* How much ram has been really used */ | 103 | int ramcache_used; /* How much ram has been really used */ |
104 | int progress; /* Current progress of disk scan */ | 104 | int progress; /* Current progress of disk scan */ |
105 | int processed_entries; /* Scanned disk entries so far */ | 105 | int processed_entries; /* Scanned disk entries so far */ |
106 | volatile const char | ||
107 | *curentry; /* Path of the current entry being scanned. */ | ||
108 | volatile bool syncscreen;/* Synchronous operation with debug screen? */ | ||
109 | // const char *uimessage; /* Pending error message. Implement soon. */ | ||
106 | }; | 110 | }; |
107 | 111 | ||
108 | struct tagcache_search_clause | 112 | struct tagcache_search_clause |
@@ -184,6 +188,9 @@ int tagcache_get_commit_step(void); | |||
184 | bool tagcache_prepare_shutdown(void); | 188 | bool tagcache_prepare_shutdown(void); |
185 | void tagcache_shutdown(void); | 189 | void tagcache_shutdown(void); |
186 | 190 | ||
191 | void tagcache_screensync_event(void); | ||
192 | void tagcache_screensync_enable(bool state); | ||
193 | |||
187 | #ifdef HAVE_TC_RAMCACHE | 194 | #ifdef HAVE_TC_RAMCACHE |
188 | bool tagcache_is_ramcache(void); | 195 | bool tagcache_is_ramcache(void); |
189 | bool tagcache_fill_tags(struct mp3entry *id3, const char *filename); | 196 | bool tagcache_fill_tags(struct mp3entry *id3, const char *filename); |