diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 78 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 20 | ||||
-rw-r--r-- | apps/misc.c | 13 | ||||
-rw-r--r-- | apps/misc.h | 21 | ||||
-rw-r--r-- | apps/plugin.h | 2 |
5 files changed, 91 insertions, 43 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 4a863e7484..2328784c96 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -557,14 +557,16 @@ static const char* dbg_partitions_getname(int selected_item, void *data, | |||
557 | if (!disk_partinfo(partition, &p)) | 557 | if (!disk_partinfo(partition, &p)) |
558 | return buffer; | 558 | return buffer; |
559 | 559 | ||
560 | // XXX fix this up to use logical sector size | ||
561 | // XXX and if mounted, show free info... | ||
560 | if (selected_item%2) | 562 | if (selected_item%2) |
561 | { | 563 | { |
562 | snprintf(buffer, buffer_len, " T:%x %ld MB", p.type, | 564 | snprintf(buffer, buffer_len, " T:%x %llu MB", p.type, |
563 | p.size / ( 2048 / ( SECTOR_SIZE / 512 ))); | 565 | (uint64_t)(p.size / ( 2048 / ( SECTOR_SIZE / 512 )))); |
564 | } | 566 | } |
565 | else | 567 | else |
566 | { | 568 | { |
567 | snprintf(buffer, buffer_len, "P%d: S:%lx", partition, p.start); | 569 | snprintf(buffer, buffer_len, "P%d: S:%llx", partition, (uint64_t)p.start); |
568 | } | 570 | } |
569 | return buffer; | 571 | return buffer; |
570 | } | 572 | } |
@@ -572,7 +574,7 @@ static const char* dbg_partitions_getname(int selected_item, void *data, | |||
572 | static bool dbg_partitions(void) | 574 | static bool dbg_partitions(void) |
573 | { | 575 | { |
574 | struct simplelist_info info; | 576 | struct simplelist_info info; |
575 | simplelist_info_init(&info, "Partition Info", NUM_DRIVES * 4, NULL); | 577 | simplelist_info_init(&info, "Partition Info", NUM_DRIVES * MAX_PARTITIONS_PER_DRIVE, NULL); |
576 | info.selection_size = 2; | 578 | info.selection_size = 2; |
577 | info.scroll_all = true; | 579 | info.scroll_all = true; |
578 | info.get_name = dbg_partitions_getname; | 580 | info.get_name = dbg_partitions_getname; |
@@ -1343,6 +1345,22 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1343 | "R2W: *%d", card->r2w_factor); | 1345 | "R2W: *%d", card->r2w_factor); |
1344 | #if (CONFIG_STORAGE & STORAGE_SD) | 1346 | #if (CONFIG_STORAGE & STORAGE_SD) |
1345 | int csd_structure = card_extract_bits(card->csd, 127, 2); | 1347 | int csd_structure = card_extract_bits(card->csd, 127, 2); |
1348 | const char *ver; | ||
1349 | switch(csd_structure) { | ||
1350 | case 0: | ||
1351 | ver = "1 (SD)"; | ||
1352 | break; | ||
1353 | case 1: | ||
1354 | ver = "2 (SDHC/SDXC)"; | ||
1355 | break; | ||
1356 | case 2: | ||
1357 | ver = "3 (SDUC)"; | ||
1358 | break; | ||
1359 | default: | ||
1360 | ver = "Unknown"; | ||
1361 | break; | ||
1362 | } | ||
1363 | simplelist_addline("SDVer: %s\n", ver); | ||
1346 | if (csd_structure == 0) /* CSD version 1.0 */ | 1364 | if (csd_structure == 0) /* CSD version 1.0 */ |
1347 | #endif | 1365 | #endif |
1348 | { | 1366 | { |
@@ -1407,15 +1425,41 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1407 | buf[8]=0; | 1425 | buf[8]=0; |
1408 | simplelist_addline( | 1426 | simplelist_addline( |
1409 | "Firmware: %s", buf); | 1427 | "Firmware: %s", buf); |
1410 | snprintf(buf, sizeof buf, "%ld MB", | 1428 | |
1411 | ((unsigned long)identify_info[61] << 16 | | 1429 | uint64_t total_sectors = identify_info[60] | (identify_info[61] << 16); |
1412 | (unsigned long)identify_info[60]) / 2048 ); | 1430 | #ifdef HAVE_LBA48 |
1431 | if (identify_info[83] & 0x0400 | ||
1432 | && total_sectors == 0x0FFFFFFF) | ||
1433 | total_sectors = identify_info[100] | (identify_info[101] << 16) | ((uint64_t)identify_info[102] << 32) | ((uint64_t)identify_info[103] << 48); | ||
1434 | #endif | ||
1435 | |||
1436 | uint32_t sector_size; | ||
1437 | |||
1438 | /* Logical sector size > 512B ? */ | ||
1439 | if ((identify_info[106] & 0xd000) == 0x5000) | ||
1440 | sector_size = identify_info[117] | (identify_info[118] << 16); | ||
1441 | else | ||
1442 | sector_size = SECTOR_SIZE; | ||
1443 | |||
1444 | total_sectors *= sector_size; /* Convert to bytes */ | ||
1445 | total_sectors /= (1024 * 1024); /* Convert to MB */ | ||
1446 | |||
1447 | simplelist_addline("Size: %llu MB", total_sectors); | ||
1448 | simplelist_addline("Logical sector size: %u B", sector_size); | ||
1449 | |||
1450 | if((identify_info[106] & 0xe000) == 0x6000) | ||
1451 | sector_size *= BIT_N(identify_info[106] & 0x000f); | ||
1413 | simplelist_addline( | 1452 | simplelist_addline( |
1414 | "Size: %s", buf); | 1453 | "Physical sector size: %d B", sector_size); |
1415 | unsigned long free; | 1454 | |
1455 | #ifndef HAVE_MULTIVOLUME | ||
1456 | // XXX this needs to be fixed for multi-volume setups | ||
1457 | sector_t free; | ||
1416 | volume_size( IF_MV(0,) NULL, &free ); | 1458 | volume_size( IF_MV(0,) NULL, &free ); |
1417 | simplelist_addline( | 1459 | simplelist_addline( |
1418 | "Free: %ld MB", free / 1024); | 1460 | "Free: %llu MB", free / 1024); |
1461 | #endif | ||
1462 | |||
1419 | simplelist_addline("SSD detected: %s", ata_disk_isssd() ? "yes" : "no"); | 1463 | simplelist_addline("SSD detected: %s", ata_disk_isssd() ? "yes" : "no"); |
1420 | simplelist_addline( | 1464 | simplelist_addline( |
1421 | "Spinup time: %d ms", storage_spinup_time() * (1000/HZ)); | 1465 | "Spinup time: %d ms", storage_spinup_time() * (1000/HZ)); |
@@ -1452,11 +1496,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1452 | simplelist_addline( | 1496 | simplelist_addline( |
1453 | "No timing info"); | 1497 | "No timing info"); |
1454 | } | 1498 | } |
1455 | int sector_size = 512; | 1499 | |
1456 | if((identify_info[106] & 0xe000) == 0x6000) | ||
1457 | sector_size *= BIT_N(identify_info[106] & 0x000f); | ||
1458 | simplelist_addline( | ||
1459 | "Physical sector size: %d", sector_size); | ||
1460 | #ifdef HAVE_ATA_DMA | 1500 | #ifdef HAVE_ATA_DMA |
1461 | if (identify_info[63] & (1<<0)) { | 1501 | if (identify_info[63] & (1<<0)) { |
1462 | simplelist_addline( | 1502 | simplelist_addline( |
@@ -1751,8 +1791,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1751 | simplelist_addline("Model: %s", info.product); | 1791 | simplelist_addline("Model: %s", info.product); |
1752 | simplelist_addline("Firmware: %s", info.revision); | 1792 | simplelist_addline("Firmware: %s", info.revision); |
1753 | simplelist_addline( | 1793 | simplelist_addline( |
1754 | "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024); | 1794 | "Size: %lld MB", (uint64_t)(info.num_sectors*(info.sector_size/512)/2048)); |
1755 | unsigned long free; | 1795 | storage_t free; |
1756 | volume_size( IF_MV(0,) NULL, &free ); | 1796 | volume_size( IF_MV(0,) NULL, &free ); |
1757 | simplelist_addline( | 1797 | simplelist_addline( |
1758 | "Free: %ld MB", free / 1024); | 1798 | "Free: %ld MB", free / 1024); |
@@ -1771,13 +1811,13 @@ static bool dbg_identify_info(void) | |||
1771 | const unsigned short *identify_info = ata_get_identify(); | 1811 | const unsigned short *identify_info = ata_get_identify(); |
1772 | #ifdef ROCKBOX_LITTLE_ENDIAN | 1812 | #ifdef ROCKBOX_LITTLE_ENDIAN |
1773 | /* this is a pointer to a driver buffer so we can't modify it */ | 1813 | /* this is a pointer to a driver buffer so we can't modify it */ |
1774 | for (int i = 0; i < SECTOR_SIZE/2; ++i) | 1814 | for (int i = 0; i < ATA_IDENTIFY_WORDS; ++i) |
1775 | { | 1815 | { |
1776 | unsigned short word = swap16(identify_info[i]); | 1816 | unsigned short word = swap16(identify_info[i]); |
1777 | write(fd, &word, 2); | 1817 | write(fd, &word, 2); |
1778 | } | 1818 | } |
1779 | #else | 1819 | #else |
1780 | write(fd, identify_info, SECTOR_SIZE); | 1820 | write(fd, identify_info, ATA_IDENTIFY_WORDS*2); |
1781 | #endif | 1821 | #endif |
1782 | close(fd); | 1822 | close(fd); |
1783 | } | 1823 | } |
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index a483a72eb0..bcaeee9089 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -134,8 +134,8 @@ static int show_legal(void) | |||
134 | struct info_data | 134 | struct info_data |
135 | 135 | ||
136 | { | 136 | { |
137 | unsigned long size[NUM_VOLUMES]; | 137 | sector_t size[NUM_VOLUMES]; |
138 | unsigned long free[NUM_VOLUMES]; | 138 | sector_t free[NUM_VOLUMES]; |
139 | unsigned long name[NUM_VOLUMES]; | 139 | unsigned long name[NUM_VOLUMES]; |
140 | bool new_data; | 140 | bool new_data; |
141 | }; | 141 | }; |
@@ -162,16 +162,19 @@ enum infoscreenorder | |||
162 | */ | 162 | */ |
163 | static int refresh_data(struct info_data *info) | 163 | static int refresh_data(struct info_data *info) |
164 | { | 164 | { |
165 | int i = 0; | 165 | #ifdef HAVE_MULTIVOLUME |
166 | #ifdef HAVE_MULTIDRIVE | 166 | #ifdef HAVE_MULTIDRIVE |
167 | int drive; | ||
168 | int max = -1; | 167 | int max = -1; |
169 | 168 | #endif | |
169 | int drive = 0; | ||
170 | int i = 0; | ||
170 | for (i = 0 ; CHECK_VOL(i) ; i++) { | 171 | for (i = 0 ; CHECK_VOL(i) ; i++) { |
171 | #endif | 172 | #endif |
172 | volume_size(IF_MV(i,) &info->size[i], &info->free[i]); | 173 | volume_size(IF_MV(i,) &info->size[i], &info->free[i]); |
174 | #ifdef HAVE_MULTIVOLUME | ||
173 | #ifdef HAVE_MULTIDRIVE | 175 | #ifdef HAVE_MULTIDRIVE |
174 | drive = volume_drive(i); | 176 | drive = volume_drive(i); |
177 | #endif | ||
175 | if (drive > 0 || info->size[i] == 0) | 178 | if (drive > 0 || info->size[i] == 0) |
176 | info->name[i] = LANG_DISK_NAME_MMC; | 179 | info->name[i] = LANG_DISK_NAME_MMC; |
177 | else | 180 | else |
@@ -182,9 +185,12 @@ static int refresh_data(struct info_data *info) | |||
182 | max = drive; | 185 | max = drive; |
183 | else if (drive < max) | 186 | else if (drive < max) |
184 | break; | 187 | break; |
188 | #elif defined(HAVE_MULTIVOLUME) | ||
189 | if (volume_partition(i) == -1) | ||
190 | break; | ||
191 | #endif | ||
192 | #ifdef HAVE_MULTIVOLUME | ||
185 | } | 193 | } |
186 | #else | ||
187 | i++; | ||
188 | #endif | 194 | #endif |
189 | 195 | ||
190 | info->new_data = false; | 196 | info->new_data = false; |
diff --git a/apps/misc.c b/apps/misc.c index bd7aa9485b..0bbaba965b 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -139,7 +139,7 @@ const unsigned char * const unit_strings_core[] = | |||
139 | * voiced.*/ | 139 | * voiced.*/ |
140 | char *output_dyn_value(char *buf, | 140 | char *output_dyn_value(char *buf, |
141 | int buf_size, | 141 | int buf_size, |
142 | int value, | 142 | int64_t value, |
143 | const unsigned char * const *units, | 143 | const unsigned char * const *units, |
144 | unsigned int unit_count, | 144 | unsigned int unit_count, |
145 | bool binary_scale) | 145 | bool binary_scale) |
@@ -147,8 +147,9 @@ char *output_dyn_value(char *buf, | |||
147 | unsigned int scale = binary_scale ? 1024 : 1000; | 147 | unsigned int scale = binary_scale ? 1024 : 1000; |
148 | unsigned int fraction = 0; | 148 | unsigned int fraction = 0; |
149 | unsigned int unit_no = 0; | 149 | unsigned int unit_no = 0; |
150 | unsigned int value_abs = (value < 0) ? -value : value; | 150 | uint64_t value_abs = (value < 0) ? -value : value; |
151 | char tbuf[5]; | 151 | char tbuf[5]; |
152 | int value2; | ||
152 | 153 | ||
153 | while (value_abs >= scale && unit_no < (unit_count - 1)) | 154 | while (value_abs >= scale && unit_no < (unit_count - 1)) |
154 | { | 155 | { |
@@ -157,7 +158,7 @@ char *output_dyn_value(char *buf, | |||
157 | unit_no++; | 158 | unit_no++; |
158 | } | 159 | } |
159 | 160 | ||
160 | value = (value < 0) ? -value_abs : value_abs; /* preserve sign */ | 161 | value2 = (value < 0) ? -value_abs : value_abs; /* preserve sign */ |
161 | fraction = (fraction * 1000 / scale) / 10; | 162 | fraction = (fraction * 1000 / scale) / 10; |
162 | 163 | ||
163 | if (value_abs >= 100 || fraction >= 100 || !unit_no) | 164 | if (value_abs >= 100 || fraction >= 100 || !unit_no) |
@@ -170,10 +171,10 @@ char *output_dyn_value(char *buf, | |||
170 | if (buf) | 171 | if (buf) |
171 | { | 172 | { |
172 | if (*tbuf) | 173 | if (*tbuf) |
173 | snprintf(buf, buf_size, "%d%s%s%s", value, str(LANG_POINT), | 174 | snprintf(buf, buf_size, "%d%s%s%s", value2, str(LANG_POINT), |
174 | tbuf, P2STR(units[unit_no])); | 175 | tbuf, P2STR(units[unit_no])); |
175 | else | 176 | else |
176 | snprintf(buf, buf_size, "%d%s", value, P2STR(units[unit_no])); | 177 | snprintf(buf, buf_size, "%d%s", value2, P2STR(units[unit_no])); |
177 | } | 178 | } |
178 | else | 179 | else |
179 | { | 180 | { |
@@ -1851,7 +1852,7 @@ enum current_activity get_current_activity(void) | |||
1851 | * ** Extended error info truth table ** | 1852 | * ** Extended error info truth table ** |
1852 | * [ Handle ][buf_reqd] | 1853 | * [ Handle ][buf_reqd] |
1853 | * [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used | 1854 | * [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used |
1854 | * [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed | 1855 | * [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed |
1855 | * [ALOC_ERR][READ_ERR] there was an error reading the file or it is empty | 1856 | * [ALOC_ERR][READ_ERR] there was an error reading the file or it is empty |
1856 | */ | 1857 | */ |
1857 | int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat, | 1858 | int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat, |
diff --git a/apps/misc.h b/apps/misc.h index 3b7ce89d22..87765b28b1 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Daniel Stenberg | 10 | * Copyright (C) 2002 by Daniel Stenberg |
@@ -22,6 +22,7 @@ | |||
22 | #define MISC_H | 22 | #define MISC_H |
23 | 23 | ||
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include <stdint.h> | ||
25 | #include <inttypes.h> | 26 | #include <inttypes.h> |
26 | #include "config.h" | 27 | #include "config.h" |
27 | #include "screen_access.h" | 28 | #include "screen_access.h" |
@@ -36,7 +37,7 @@ extern const unsigned char * const unit_strings_core[]; | |||
36 | * voiced.*/ | 37 | * voiced.*/ |
37 | char *output_dyn_value(char *buf, | 38 | char *output_dyn_value(char *buf, |
38 | int buf_size, | 39 | int buf_size, |
39 | int value, | 40 | int64_t value, |
40 | const unsigned char * const *units, | 41 | const unsigned char * const *units, |
41 | unsigned int unit_count, | 42 | unsigned int unit_count, |
42 | bool binary_scale); | 43 | bool binary_scale); |
@@ -113,9 +114,9 @@ bool warn_on_pl_erase(void); | |||
113 | bool show_search_progress(bool init, int count, int current, int total); | 114 | bool show_search_progress(bool init, int count, int current, int total); |
114 | 115 | ||
115 | /* Read (up to) a line of text from fd into buffer and return number of bytes | 116 | /* Read (up to) a line of text from fd into buffer and return number of bytes |
116 | * read (which may be larger than the number of bytes stored in buffer). If | 117 | * read (which may be larger than the number of bytes stored in buffer). If |
117 | * an error occurs, -1 is returned (and buffer contains whatever could be | 118 | * an error occurs, -1 is returned (and buffer contains whatever could be |
118 | * read). A line is terminated by a LF char. Neither LF nor CR chars are | 119 | * read). A line is terminated by a LF char. Neither LF nor CR chars are |
119 | * stored in buffer. | 120 | * stored in buffer. |
120 | */ | 121 | */ |
121 | int read_line(int fd, char* buffer, int buffer_size); | 122 | int read_line(int fd, char* buffer, int buffer_size); |
diff --git a/apps/plugin.h b/apps/plugin.h index af8a65c5de..31e1c77cb7 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -649,7 +649,7 @@ struct plugin_api { | |||
649 | int (*memcmp)(const void *s1, const void *s2, size_t n); | 649 | int (*memcmp)(const void *s1, const void *s2, size_t n); |
650 | char *(*strcasestr) (const char* phaystack, const char* pneedle); | 650 | char *(*strcasestr) (const char* phaystack, const char* pneedle); |
651 | char* (*strtok_r)(char *ptr, const char *sep, char **end); | 651 | char* (*strtok_r)(char *ptr, const char *sep, char **end); |
652 | char* (*output_dyn_value)(char *buf, int buf_size, int value, | 652 | char* (*output_dyn_value)(char *buf, int buf_size, int64_t value, |
653 | const unsigned char * const *units, | 653 | const unsigned char * const *units, |
654 | unsigned int unit_count, bool binary_scale); | 654 | unsigned int unit_count, bool binary_scale); |
655 | /* unicode stuff */ | 655 | /* unicode stuff */ |