summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/bitmaps/UI-fiiom3k.bmpbin676310 -> 913878 bytes
-rw-r--r--uisimulator/buttonmap/fiio-m3k.c22
-rw-r--r--uisimulator/common/filesystem-sim.c7
-rw-r--r--uisimulator/common/powermgmt-sim.c56
-rw-r--r--uisimulator/common/sim_tasks.c4
5 files changed, 60 insertions, 29 deletions
diff --git a/uisimulator/bitmaps/UI-fiiom3k.bmp b/uisimulator/bitmaps/UI-fiiom3k.bmp
index 118424ef5f..54438ea06f 100644
--- a/uisimulator/bitmaps/UI-fiiom3k.bmp
+++ b/uisimulator/bitmaps/UI-fiiom3k.bmp
Binary files differ
diff --git a/uisimulator/buttonmap/fiio-m3k.c b/uisimulator/buttonmap/fiio-m3k.c
index 82a2ab0bb5..ff7a95e82c 100644
--- a/uisimulator/buttonmap/fiio-m3k.c
+++ b/uisimulator/buttonmap/fiio-m3k.c
@@ -84,16 +84,16 @@ int key_to_button(int keyboard_button)
}
struct button_map bm[] = {
- { SDLK_ESCAPE, 12, 55, 15, "Power" },
- { SDLK_KP_MINUS, 12, 188, 15, "Volume -" },
- { SDLK_KP_PLUS, 12, 125, 15, "Volume +" },
- { SDLK_SPACE, 12, 255, 15, "Play" },
- { SDLK_UP, 146, 394, 20, "Up" },
- { SDLK_RETURN, 146, 438, 20, "Select" },
- { SDLK_DOWN, 146, 510, 20, "Down" },
- { SDLK_INSERT, 68, 368, 20, "Menu" },
- { SDLK_LEFT, 68, 532, 20, "Left" },
- { SDLK_RIGHT, 224, 532, 20, "Right" },
- { SDLK_BACKSPACE, 224, 368, 20, "Back" },
+ { SDLK_ESCAPE, 14, 63, 15, "Power" },
+ { SDLK_KP_MINUS, 14, 219, 15, "Volume -" },
+ { SDLK_KP_PLUS, 14, 139, 15, "Volume +" },
+ { SDLK_SPACE, 14, 299, 15, "Play" },
+ { SDLK_UP, 170, 444, 25, "Up" },
+ { SDLK_RETURN, 170, 519, 25, "Select" },
+ { SDLK_DOWN, 170, 599, 25, "Down" },
+ { SDLK_INSERT, 79, 427, 25, "Menu" },
+ { SDLK_LEFT, 79, 620, 25, "Left" },
+ { SDLK_RIGHT, 260, 620, 25, "Right" },
+ { SDLK_BACKSPACE, 260, 427, 25, "Back" },
{ 0, 0, 0, 0, "None" }
};
diff --git a/uisimulator/common/filesystem-sim.c b/uisimulator/common/filesystem-sim.c
index 8d7fb14931..f4f6321b7d 100644
--- a/uisimulator/common/filesystem-sim.c
+++ b/uisimulator/common/filesystem-sim.c
@@ -309,6 +309,8 @@ int sim_get_os_path(char *buffer, const char *path, size_t bufsize)
const char *next;
volume = path_strip_volume(p, &next, true);
+ if (volume == ROOT_VOLUME)
+ volume = 0; /* FIXME: root no longer implies volume 0 */
if (next > p)
{
@@ -841,3 +843,8 @@ int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize)
return sim_get_os_path(buffer, tmpbuf, bufsize);
}
+
+const char* sim_root_realpath(void)
+{
+ return PATH_ROOTSTR;
+}
diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c
index 511648bc9d..1535971e29 100644
--- a/uisimulator/common/powermgmt-sim.c
+++ b/uisimulator/common/powermgmt-sim.c
@@ -39,9 +39,11 @@
#define POWER_AFTER_CHARGE_TICKS (8 * HZ)
#endif
-extern int battery_percent;
static bool charging = false;
-static unsigned int battery_millivolts = BATT_MAXMVOLT;
+static unsigned int batt_millivolts = BATT_MAXMVOLT;
+static unsigned int batt_percent = 100;
+static unsigned int batt_runtime = BATT_MAXRUNTIME;
+static unsigned int batt_current = 0;
void powermgmt_init_target(void) {}
@@ -54,7 +56,7 @@ static void battery_status_update(void)
static unsigned int ext_power_until_tick = 0;
#endif
- if TIME_BEFORE(current_tick, update_after_tick)
+ if(TIME_BEFORE(current_tick, update_after_tick))
return;
update_after_tick = current_tick + HZ;
@@ -72,10 +74,9 @@ static void battery_status_update(void)
#endif
if (charging) {
- battery_millivolts += BATT_CHARGE_STEP;
- if (battery_millivolts >= BATT_MAXMVOLT) {
+ batt_millivolts += BATT_CHARGE_STEP;
+ if (batt_millivolts >= BATT_MAXMVOLT) {
charging = false;
- battery_percent = 100;
#if CONFIG_CHARGING >= CHARGING_MONITOR
/* Keep external power until tick */
ext_power_until_tick = current_tick + POWER_AFTER_CHARGE_TICKS;
@@ -83,23 +84,22 @@ static void battery_status_update(void)
/* Pretend the charger was disconnected */
charger_input_state = CHARGER_UNPLUGGED;
#endif
- return;
}
} else {
- battery_millivolts -= BATT_DISCHARGE_STEP;
- if (battery_millivolts <= BATT_MINMVOLT) {
+ batt_millivolts -= BATT_DISCHARGE_STEP;
+ if (batt_millivolts <= BATT_MINMVOLT) {
charging = true;
- battery_percent = 0;
#if CONFIG_CHARGING
/* Pretend the charger was connected */
charger_input_state = CHARGER_PLUGGED;
#endif
- return;
}
}
- battery_percent = 100 * (battery_millivolts - BATT_MINMVOLT) /
- (BATT_MAXMVOLT - BATT_MINMVOLT);
+ batt_percent = (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT);
+ batt_runtime = batt_percent * BATT_MAXRUNTIME;
+ /* current is completely bogus... */
+ batt_current = charging ? BATT_CHARGE_STEP : BATT_DISCHARGE_STEP;
}
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { 3200 };
@@ -111,15 +111,36 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
const unsigned short percent_to_volt_charge[11] =
{ 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300 };
+#if CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE
int _battery_voltage(void)
{
battery_status_update();
- return battery_millivolts;
+ return batt_millivolts;
}
+#endif
+
+#if CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE
+int _battery_level(void)
+{
+ battery_status_update();
+ return batt_percent;
+}
+#endif
#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE)
-static int powermgmt_est_runningtime_min;
-int _battery_time(void) { return powermgmt_est_runningtime_min; }
+int _battery_time(void)
+{
+ battery_status_update();
+ return batt_runtime;
+}
+#endif
+
+#if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)
+int _battery_current(void)
+{
+ battery_status_update();
+ return batt_current;
+}
#endif
#if CONFIG_CHARGING
@@ -169,6 +190,7 @@ unsigned int input_millivolts(void)
/* Just return a safe value if battery isn't connected */
return 4050;
}
- return battery_voltage();;
+
+ return battery_voltage();
}
#endif
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c
index 8c1f193080..c53b9990fd 100644
--- a/uisimulator/common/sim_tasks.c
+++ b/uisimulator/common/sim_tasks.c
@@ -92,7 +92,9 @@ void sim_thread(void)
last_broadcast_tick = current_tick;
}
- num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0) - 1;
+ /* NOTE: Unlike the USB code, we do not subtract one here
+ * because the sim_queue is not registered for broadcasts! */
+ num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0);
DEBUGF("USB inserted. Waiting for %d acks...\n",
num_acks_to_expect);
break;