2006-01-25 18:35:36 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Alexander Spyridakis, Hristo Kovachev
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-01-25 18:35:36 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2008-09-22 19:59:00 +00:00
|
|
|
#include "version.h"
|
2006-01-25 18:35:36 +00:00
|
|
|
#include "plugin.h"
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2011-12-25 20:11:18 +00:00
|
|
|
#define BATTERY_LOG HOME_DIR"/battery_bench.txt"
|
2006-01-25 18:35:36 +00:00
|
|
|
#define BUF_SIZE 16000
|
|
|
|
|
|
|
|
#define EV_EXIT 1337
|
|
|
|
|
2006-02-07 14:46:03 +00:00
|
|
|
/* seems to work with 1300, but who knows... */
|
2010-02-17 16:12:21 +00:00
|
|
|
#define THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2006-05-13 07:41:12 +00:00
|
|
|
|
2006-02-07 14:46:03 +00:00
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
2006-01-25 18:35:36 +00:00
|
|
|
#define BATTERY_OFF BUTTON_OFF
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "OFF"
|
2006-11-27 02:16:32 +00:00
|
|
|
|
2007-10-05 13:25:35 +00:00
|
|
|
#if BUTTON_REMOTE != 0
|
2006-11-27 02:16:32 +00:00
|
|
|
#define BATTERY_RC_ON BUTTON_RC_PLAY
|
2006-05-13 07:41:12 +00:00
|
|
|
#define BATTERY_RC_OFF BUTTON_RC_STOP
|
2007-10-05 13:25:35 +00:00
|
|
|
#endif
|
2006-01-25 18:35:36 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
2006-05-13 07:41:12 +00:00
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
#define BATTERY_ON BUTTON_RIGHT
|
|
|
|
#define BATTERY_OFF BUTTON_OFF
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "RIGHT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "OFF"
|
2006-01-25 18:35:36 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
2006-05-13 07:41:12 +00:00
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
2006-01-25 18:35:36 +00:00
|
|
|
#define BATTERY_OFF BUTTON_STOP
|
2008-10-03 14:35:07 +00:00
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF_TXT "STOP"
|
2007-10-05 11:51:34 +00:00
|
|
|
|
|
|
|
#define BATTERY_RC_ON BUTTON_RC_PLAY
|
2006-05-13 07:41:12 +00:00
|
|
|
#define BATTERY_RC_OFF BUTTON_RC_STOP
|
2006-01-25 18:35:36 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_ON
|
|
|
|
#define BATTERY_RC_ON BUTTON_RC_ON
|
|
|
|
|
|
|
|
#define BATTERY_OFF BUTTON_OFF
|
|
|
|
#define BATTERY_RC_OFF BUTTON_RC_STOP
|
2006-01-25 20:57:13 +00:00
|
|
|
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "STOP"
|
2007-10-05 11:51:34 +00:00
|
|
|
|
2006-02-24 20:54:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
2007-07-27 09:57:27 +00:00
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-01-25 20:57:13 +00:00
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_MENU
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "MENU"
|
2006-01-25 20:57:13 +00:00
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-03-30 21:17:19 +00:00
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2006-03-30 21:17:19 +00:00
|
|
|
|
2006-02-03 23:16:24 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_PLAY
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "PLAY"
|
2006-02-03 23:16:24 +00:00
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
2009-01-04 23:33:15 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
2009-04-10 17:28:26 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
2006-10-26 13:38:09 +00:00
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
2009-06-06 09:08:11 +00:00
|
|
|
#define BATTERY_OFF BUTTON_HOME
|
2009-04-10 17:28:26 +00:00
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2009-06-06 09:08:11 +00:00
|
|
|
#define BATTERY_OFF_TXT "HOME"
|
2009-04-10 17:28:26 +00:00
|
|
|
|
2006-08-20 23:05:47 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
2006-12-05 10:09:07 +00:00
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2006-12-05 10:09:07 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
2006-08-20 23:05:47 +00:00
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2007-10-05 11:51:34 +00:00
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2006-08-20 23:05:47 +00:00
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD \
|
2014-07-17 08:40:17 +00:00
|
|
|
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD \
|
|
|
|
|| CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
2008-02-17 12:23:02 +00:00
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_BACK
|
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "BACK"
|
2008-02-17 12:23:02 +00:00
|
|
|
|
2007-10-23 15:40:51 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2007-10-23 15:40:51 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE100_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2008-03-01 22:55:09 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_REC
|
|
|
|
#define BATTERY_RC_ON BUTTON_RC_PLAY
|
|
|
|
#define BATTERY_RC_OFF BUTTON_RC_REC
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "REC"
|
2008-03-22 10:24:28 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2008-03-22 22:03:34 +00:00
|
|
|
|
2008-09-06 17:50:59 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2008-09-06 17:50:59 +00:00
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2008-12-04 21:28:56 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF BUTTON_BACK
|
|
|
|
#define BATTERY_OFF_TXT "BACK"
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_MENU
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "MENU - start"
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2010-11-02 03:29:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_MENU
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "MENU - start"
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2009-12-02 01:56:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_MENU
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "MENU - start"
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2009-08-04 03:08:32 +00:00
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_LEFT
|
|
|
|
#define BATTERY_OFF BUTTON_RIGHT
|
|
|
|
#define BATTERY_ON_TXT "LEFT"
|
|
|
|
#define BATTERY_OFF_TXT "RIGHT"
|
|
|
|
|
2010-02-11 22:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_REC
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF_TXT "REC"
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_REC
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF_TXT "REC"
|
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_REC
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF_TXT "REC"
|
|
|
|
|
2011-10-02 15:51:10 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAYPAUSE
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "PLAYPAUSE - start"
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2012-05-19 14:09:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
2012-05-20 15:06:14 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
2012-05-19 14:09:46 +00:00
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD) || (CONFIG_KEYPAD == HM801_PAD)
|
2012-03-23 18:32:50 +00:00
|
|
|
#define BATTERY_ON BUTTON_SELECT
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "SELECT - start"
|
2012-05-19 14:09:46 +00:00
|
|
|
|
2012-03-23 18:32:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "POWER"
|
|
|
|
|
2013-11-14 16:43:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_POWER
|
|
|
|
#define BATTERY_ON_TXT "PLAY - start"
|
|
|
|
#define BATTERY_OFF_TXT "Power"
|
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == DX50_PAD
|
iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization
- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
hosted targets. Most device specific code is in the
firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.
Code cleanup
- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
(see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.
Misc
- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.
Includes
- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/
Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.
Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/
The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.
Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.
Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-02-02 20:44:29 +00:00
|
|
|
#define BATTERY_ON BUTTON_PLAY
|
|
|
|
#define BATTERY_OFF BUTTON_POWER_LONG
|
|
|
|
#define BATTERY_OFF_TXT "Power Long"
|
|
|
|
#define BATTERY_ON_TXT "Play - start"
|
2014-08-30 11:15:53 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2006-01-25 18:35:36 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef BATTERY_ON
|
|
|
|
#define BATTERY_ON BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#ifndef BATTERY_OFF
|
|
|
|
#define BATTERY_OFF BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef BATTERY_ON_TXT
|
|
|
|
#define BATTERY_ON_TXT "CENTRE - start"
|
|
|
|
#endif
|
|
|
|
#ifndef BATTERY_OFF_TXT
|
2008-10-03 11:51:50 +00:00
|
|
|
#define BATTERY_OFF_TXT "TOPLEFT"
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2006-02-07 14:46:03 +00:00
|
|
|
/****************************** Plugin Entry Point ****************************/
|
2010-09-02 02:26:26 +00:00
|
|
|
static long start_tick;
|
2010-07-07 18:17:37 +00:00
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
/* Struct for battery information */
|
2010-09-02 02:26:26 +00:00
|
|
|
static struct batt_info
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2007-09-09 20:46:45 +00:00
|
|
|
/* the size of the struct elements is optimised to make the struct size
|
|
|
|
* a power of 2 */
|
2010-07-07 18:17:37 +00:00
|
|
|
unsigned secs;
|
2007-09-09 20:46:45 +00:00
|
|
|
int eta;
|
2006-01-25 18:35:36 +00:00
|
|
|
unsigned int voltage;
|
2007-09-09 20:46:45 +00:00
|
|
|
short level;
|
|
|
|
unsigned short flags;
|
2006-02-07 14:46:03 +00:00
|
|
|
} bat[BUF_SIZE/sizeof(struct batt_info)];
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
#define BUF_ELEMENTS (sizeof(bat)/sizeof(struct batt_info))
|
|
|
|
|
2008-12-10 08:57:10 +00:00
|
|
|
static unsigned int thread_id;
|
2011-02-14 11:27:45 +00:00
|
|
|
static struct event_queue thread_q SHAREDBSS_ATTR;
|
2008-08-14 22:35:00 +00:00
|
|
|
static bool in_usb_mode;
|
|
|
|
static unsigned int buf_idx;
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2010-09-02 02:26:26 +00:00
|
|
|
static bool exit_tsr(bool reenter)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2009-01-03 13:27:19 +00:00
|
|
|
long button;
|
2006-10-31 11:17:00 +00:00
|
|
|
(void)reenter;
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_puts_scroll(0, 0, "Batt.Bench is currently running.");
|
2008-10-03 11:51:50 +00:00
|
|
|
rb->lcd_puts_scroll(0, 1, "Press " BATTERY_OFF_TXT " to cancel the test");
|
2006-10-31 11:34:46 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-04-06 22:55:00 +00:00
|
|
|
rb->lcd_puts_scroll(0, 2, "Anything else will resume");
|
2006-10-31 11:34:46 +00:00
|
|
|
#endif
|
2007-04-06 22:55:00 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
2009-01-03 13:27:19 +00:00
|
|
|
while (1)
|
2006-10-31 11:17:00 +00:00
|
|
|
{
|
2009-01-03 13:27:19 +00:00
|
|
|
button = rb->button_get(true);
|
|
|
|
if (IS_SYSEVENT(button))
|
|
|
|
continue;
|
|
|
|
if (button == BATTERY_OFF)
|
|
|
|
{
|
|
|
|
rb->queue_post(&thread_q, EV_EXIT, 0);
|
|
|
|
rb->thread_wait(thread_id);
|
|
|
|
/* remove the thread's queue from the broadcast list */
|
|
|
|
rb->queue_delete(&thread_q);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else return false;
|
2006-10-31 11:17:00 +00:00
|
|
|
}
|
2006-01-25 18:35:36 +00:00
|
|
|
}
|
|
|
|
|
2007-09-09 20:46:45 +00:00
|
|
|
#define BIT_CHARGER 0x1
|
|
|
|
#define BIT_CHARGING 0x2
|
|
|
|
#define BIT_USB_POWER 0x4
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
#define HMS(x) (x)/3600,((x)%3600)/60,((x)%3600)%60
|
2006-02-07 14:46:03 +00:00
|
|
|
|
|
|
|
/* use long for aligning */
|
2010-09-02 02:26:26 +00:00
|
|
|
static unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)];
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|
2008-08-14 22:35:00 +00:00
|
|
|
static unsigned int charge_state(void)
|
2006-02-07 14:46:03 +00:00
|
|
|
{
|
|
|
|
unsigned int ret = 0;
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-08-14 22:35:00 +00:00
|
|
|
if (rb->charger_inserted())
|
2006-02-07 14:46:03 +00:00
|
|
|
ret = BIT_CHARGER;
|
2009-03-24 21:59:44 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
2008-08-14 22:35:00 +00:00
|
|
|
if (rb->charging_state())
|
2006-02-07 14:46:03 +00:00
|
|
|
ret |= BIT_CHARGING;
|
|
|
|
#endif
|
|
|
|
#endif
|
2015-01-02 21:15:31 +00:00
|
|
|
/* USB insertion means nothing if USB cannot power the device */
|
2006-02-07 14:46:03 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
2015-01-02 21:15:31 +00:00
|
|
|
if (rb->usb_inserted())
|
2006-02-07 14:46:03 +00:00
|
|
|
ret |= BIT_USB_POWER;
|
|
|
|
#endif
|
2015-01-02 21:15:31 +00:00
|
|
|
return ret;
|
2006-02-07 14:46:03 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
|
2014-03-14 22:15:16 +00:00
|
|
|
static void flush_buffer(void)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2010-07-07 18:17:37 +00:00
|
|
|
int fd;
|
2008-08-14 22:35:00 +00:00
|
|
|
unsigned int i;
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
/* don't access the disk when in usb mode, or when no data is available */
|
|
|
|
if (in_usb_mode || (buf_idx == 0))
|
2009-10-20 21:54:44 +00:00
|
|
|
return;
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2010-05-06 17:35:13 +00:00
|
|
|
fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND, 0666);
|
2008-08-14 22:35:00 +00:00
|
|
|
if (fd < 0)
|
2009-10-20 21:54:44 +00:00
|
|
|
return;
|
2007-08-01 08:50:44 +00:00
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
for (i = 0; i < buf_idx; i++)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2008-08-14 22:35:00 +00:00
|
|
|
rb->fdprintf(fd,
|
|
|
|
"%02d:%02d:%02d, %05d, %03d%%, "
|
|
|
|
"%02d:%02d, %04d, "
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-08-14 22:35:00 +00:00
|
|
|
" %c"
|
2009-03-24 21:59:44 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
2008-08-14 22:35:00 +00:00
|
|
|
", %c"
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_USB_POWER
|
2008-08-14 22:35:00 +00:00
|
|
|
", %c"
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
2008-08-14 22:35:00 +00:00
|
|
|
"\n",
|
|
|
|
|
2010-07-07 18:17:37 +00:00
|
|
|
HMS(bat[i].secs), bat[i].secs, bat[i].level,
|
2008-08-14 22:35:00 +00:00
|
|
|
bat[i].eta / 60, bat[i].eta % 60,
|
|
|
|
bat[i].voltage
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-08-14 22:35:00 +00:00
|
|
|
, (bat[i].flags & BIT_CHARGER) ? 'A' : '-'
|
2009-03-24 21:59:44 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
2008-08-14 22:35:00 +00:00
|
|
|
, (bat[i].flags & BIT_CHARGING) ? 'C' : '-'
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_USB_POWER
|
2008-08-14 22:35:00 +00:00
|
|
|
, (bat[i].flags & BIT_USB_POWER) ? 'U' : '-'
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
2008-08-14 22:35:00 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
rb->close(fd);
|
|
|
|
|
|
|
|
buf_idx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-02 02:26:26 +00:00
|
|
|
static void thread(void)
|
2008-08-14 22:35:00 +00:00
|
|
|
{
|
|
|
|
bool exit = false;
|
|
|
|
char *exit_reason = "unknown";
|
|
|
|
long sleep_time = 60 * HZ;
|
|
|
|
struct queue_event ev;
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
in_usb_mode = false;
|
|
|
|
buf_idx = 0;
|
|
|
|
|
|
|
|
while (!exit)
|
|
|
|
{
|
|
|
|
/* add data to buffer */
|
|
|
|
if (buf_idx < BUF_ELEMENTS)
|
|
|
|
{
|
2010-07-07 18:17:37 +00:00
|
|
|
bat[buf_idx].secs = (*rb->current_tick - start_tick) / HZ;
|
2008-08-14 22:35:00 +00:00
|
|
|
bat[buf_idx].level = rb->battery_level();
|
|
|
|
bat[buf_idx].eta = rb->battery_time();
|
|
|
|
bat[buf_idx].voltage = rb->battery_voltage();
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|
2008-08-14 22:35:00 +00:00
|
|
|
bat[buf_idx].flags = charge_state();
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
2008-08-14 22:35:00 +00:00
|
|
|
buf_idx++;
|
2011-12-31 13:35:19 +00:00
|
|
|
#if USING_STORAGE_CALLBACK
|
2008-11-01 16:14:28 +00:00
|
|
|
rb->register_storage_idle_func(flush_buffer);
|
2011-12-31 13:35:19 +00:00
|
|
|
#endif
|
2008-08-14 22:35:00 +00:00
|
|
|
}
|
2006-01-25 18:35:36 +00:00
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
/* What to do when the measurement buffer is full:
|
|
|
|
1) save our measurements to disk but waste some power doing so?
|
|
|
|
2) throw away measurements to save some power?
|
|
|
|
The choice made here is to save the measurements. It is quite unusual
|
|
|
|
for this to occur because it requires > 16 hours of no disk activity.
|
|
|
|
*/
|
|
|
|
if (buf_idx == BUF_ELEMENTS) {
|
2014-03-14 22:15:16 +00:00
|
|
|
flush_buffer();
|
2006-01-25 18:35:36 +00:00
|
|
|
}
|
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
/* sleep some time until next measurement */
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->queue_wait_w_tmo(&thread_q, &ev, sleep_time);
|
|
|
|
switch (ev.id)
|
|
|
|
{
|
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
in_usb_mode = true;
|
|
|
|
rb->usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
|
|
|
break;
|
|
|
|
case SYS_USB_DISCONNECTED:
|
|
|
|
in_usb_mode = false;
|
|
|
|
break;
|
|
|
|
case SYS_POWEROFF:
|
2008-08-14 22:35:00 +00:00
|
|
|
exit_reason = "power off";
|
|
|
|
exit = true;
|
2006-01-25 18:35:36 +00:00
|
|
|
break;
|
|
|
|
case EV_EXIT:
|
2008-08-14 22:35:00 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
rb->splash(HZ, "Exiting battery_bench...");
|
|
|
|
#else
|
|
|
|
rb->splash(HZ, "bench exit");
|
|
|
|
#endif
|
|
|
|
exit_reason = "plugin exit";
|
|
|
|
exit = true;
|
2006-01-25 18:35:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-08-14 22:35:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-31 13:35:19 +00:00
|
|
|
#if USING_STORAGE_CALLBACK
|
2008-08-14 22:35:00 +00:00
|
|
|
/* unregister flush callback and flush to disk */
|
2008-11-01 16:14:28 +00:00
|
|
|
rb->unregister_storage_idle_func(flush_buffer, true);
|
2011-12-31 13:35:19 +00:00
|
|
|
#else
|
2014-03-14 22:15:16 +00:00
|
|
|
flush_buffer();
|
2011-12-31 13:35:19 +00:00
|
|
|
#endif
|
2008-08-14 22:35:00 +00:00
|
|
|
|
|
|
|
/* log end of bench and exit reason */
|
2010-05-06 17:35:13 +00:00
|
|
|
fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND, 0666);
|
2008-08-14 22:35:00 +00:00
|
|
|
if (fd >= 0)
|
|
|
|
{
|
|
|
|
rb->fdprintf(fd, "--Battery bench ended, reason: %s--\n", exit_reason);
|
|
|
|
rb->close(fd);
|
|
|
|
}
|
2006-01-25 18:35:36 +00:00
|
|
|
}
|
|
|
|
|
2006-02-07 14:46:03 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
typedef void (*plcdfunc)(int x, int y, const unsigned char *str);
|
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
static void put_centered_str(const char* str, plcdfunc putsxy, int lcd_width, int line)
|
2006-02-07 14:46:03 +00:00
|
|
|
{
|
|
|
|
int strwdt, strhgt;
|
|
|
|
rb->lcd_getstringsize(str, &strwdt, &strhgt);
|
|
|
|
putsxy((lcd_width - strwdt)/2, line*(strhgt), str);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-09-02 02:26:26 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2010-09-02 02:26:26 +00:00
|
|
|
(void)parameter;
|
2006-02-07 14:46:03 +00:00
|
|
|
int button, fd;
|
2006-01-25 18:35:36 +00:00
|
|
|
bool on = false;
|
2010-07-07 18:17:37 +00:00
|
|
|
start_tick = *rb->current_tick;
|
2006-02-07 16:41:29 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-04-06 22:55:00 +00:00
|
|
|
int i;
|
2006-02-07 14:46:03 +00:00
|
|
|
const char *msgs[] = { "Battery Benchmark","Check file", BATTERY_LOG,
|
2008-10-03 11:51:50 +00:00
|
|
|
"for more info", BATTERY_ON_TXT, BATTERY_OFF_TXT " - quit" };
|
2006-02-07 16:41:29 +00:00
|
|
|
#endif
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-02-07 14:46:03 +00:00
|
|
|
rb->lcd_clear_display();
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2008-08-14 22:35:00 +00:00
|
|
|
for (i = 0; i<(int)(sizeof(msgs)/sizeof(char *)); i++)
|
2006-02-07 14:46:03 +00:00
|
|
|
put_centered_str(msgs[i],rb->lcd_putsxy,LCD_WIDTH,i+1);
|
2007-04-06 22:55:00 +00:00
|
|
|
#else
|
|
|
|
rb->lcd_puts_scroll(0, 0, "Batt.Bench.");
|
|
|
|
rb->lcd_puts_scroll(0, 1, "PLAY/STOP");
|
|
|
|
#endif
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->lcd_update();
|
2007-04-06 22:55:00 +00:00
|
|
|
|
2006-02-07 14:46:03 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
rb->lcd_remote_clear_display();
|
|
|
|
put_centered_str(msgs[0],rb->lcd_remote_putsxy,LCD_REMOTE_WIDTH,0);
|
|
|
|
put_centered_str(msgs[sizeof(msgs)/sizeof(char*)-2],
|
|
|
|
rb->lcd_remote_putsxy,LCD_REMOTE_WIDTH,1);
|
|
|
|
put_centered_str(msgs[sizeof(msgs)/sizeof(char*)-1],
|
|
|
|
rb->lcd_remote_putsxy,LCD_REMOTE_WIDTH,2);
|
|
|
|
rb->lcd_remote_update();
|
|
|
|
#endif
|
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
button = rb->button_get(true);
|
2008-08-14 22:35:00 +00:00
|
|
|
switch (button)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
|
|
|
case BATTERY_ON:
|
|
|
|
#ifdef BATTERY_RC_ON
|
|
|
|
case BATTERY_RC_ON:
|
|
|
|
#endif
|
|
|
|
on = true;
|
|
|
|
break;
|
|
|
|
case BATTERY_OFF:
|
|
|
|
#ifdef BATTERY_RC_OFF
|
|
|
|
case BATTERY_RC_OFF:
|
2008-08-14 22:35:00 +00:00
|
|
|
#endif
|
2006-01-25 18:35:36 +00:00
|
|
|
return PLUGIN_OK;
|
2008-08-14 22:35:00 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
2006-01-25 18:35:36 +00:00
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
}
|
|
|
|
}while(!on);
|
|
|
|
|
|
|
|
fd = rb->open(BATTERY_LOG, O_RDONLY);
|
2008-08-14 22:35:00 +00:00
|
|
|
if (fd < 0)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
2010-05-06 17:35:13 +00:00
|
|
|
fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT, 0666);
|
2008-08-14 22:35:00 +00:00
|
|
|
if (fd >= 0)
|
2006-01-25 18:35:36 +00:00
|
|
|
{
|
|
|
|
rb->fdprintf(fd,
|
2010-05-31 12:37:29 +00:00
|
|
|
"# This plugin will log your battery performance in a\n"
|
|
|
|
"# file (%s) every minute.\n"
|
|
|
|
"# To properly test your battery:\n"
|
|
|
|
"# 1) Select and playback an album. "
|
2011-07-25 18:52:09 +00:00
|
|
|
"(Be sure to be more than the player's buffer)\n"
|
2010-05-31 12:37:29 +00:00
|
|
|
"# 2) Set to repeat.\n"
|
|
|
|
"# 3) Let the player run completely out of battery.\n"
|
|
|
|
"# 4) Recharge and copy (or whatever you want) the txt file to "
|
2011-07-25 18:52:09 +00:00
|
|
|
"your computer.\n"
|
2010-05-31 12:37:29 +00:00
|
|
|
"# Now you can make graphs with the data of the battery log.\n"
|
|
|
|
"# Do not enter another plugin during the test or else the \n"
|
|
|
|
"# logging activity will end.\n\n"
|
|
|
|
"# P.S: You can decide how you will make your tests.\n"
|
|
|
|
"# Just don't open another plugin to be sure that your log "
|
2008-09-22 19:59:00 +00:00
|
|
|
"will continue.\n\n",BATTERY_LOG);
|
|
|
|
rb->fdprintf(fd,
|
2010-05-31 12:37:29 +00:00
|
|
|
"# Battery bench run for %s version %s\n\n"
|
2010-05-27 09:41:46 +00:00
|
|
|
,MODEL_NAME,rb->rbversion);
|
2008-09-22 19:59:00 +00:00
|
|
|
|
2010-07-07 18:17:37 +00:00
|
|
|
rb->fdprintf(fd, "# Battery type: %d mAh Buffer Entries: %d\n",
|
|
|
|
rb->global_settings->battery_capacity, (int)BUF_ELEMENTS);
|
|
|
|
|
|
|
|
rb->fdprintf(fd, "# Rockbox has been running for %02d:%02d:%02d\n",
|
|
|
|
HMS((unsigned)start_tick/HZ));
|
|
|
|
|
2008-09-22 19:59:00 +00:00
|
|
|
rb->fdprintf(fd,
|
2010-05-31 12:37:29 +00:00
|
|
|
"# Time:, Seconds:, Level:, Time Left:, Voltage[mV]:"
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-02-07 14:46:03 +00:00
|
|
|
", C:"
|
|
|
|
#endif
|
2009-03-24 21:59:44 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
2006-02-07 14:46:03 +00:00
|
|
|
", S:"
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
", U:"
|
|
|
|
#endif
|
2010-07-07 18:17:37 +00:00
|
|
|
"\n");
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->close(fd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ / 2, "Cannot create file!");
|
2006-01-25 18:35:36 +00:00
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rb->close(fd);
|
|
|
|
fd = rb->open(BATTERY_LOG, O_RDWR | O_APPEND);
|
2010-07-07 18:17:37 +00:00
|
|
|
rb->fdprintf(fd, "\n# --File already present. Resuming Benchmark--\n");
|
2008-09-22 19:59:00 +00:00
|
|
|
rb->fdprintf(fd,
|
2010-07-07 18:17:37 +00:00
|
|
|
"# Battery bench run for %s version %s\n\n"
|
2010-05-27 09:41:46 +00:00
|
|
|
,MODEL_NAME,rb->rbversion);
|
2010-07-07 18:17:37 +00:00
|
|
|
rb->fdprintf(fd, "# Rockbox has been running for %02d:%02d:%02d\n",
|
|
|
|
HMS((unsigned)start_tick/HZ));
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->close(fd);
|
|
|
|
}
|
|
|
|
|
2006-09-16 16:18:11 +00:00
|
|
|
rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */
|
2008-08-14 22:35:00 +00:00
|
|
|
if ((thread_id = rb->create_thread(thread, thread_stack,
|
2007-10-16 01:25:17 +00:00
|
|
|
sizeof(thread_stack), 0, "Battery Benchmark"
|
2007-03-04 20:06:41 +00:00
|
|
|
IF_PRIO(, PRIORITY_BACKGROUND)
|
2008-12-10 08:57:10 +00:00
|
|
|
IF_COP(, CPU))) == 0)
|
2006-04-05 08:33:20 +00:00
|
|
|
{
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ, "Cannot create thread!");
|
2006-04-05 08:33:20 +00:00
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-01-25 18:35:36 +00:00
|
|
|
rb->plugin_tsr(exit_tsr);
|
|
|
|
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|