Rockbox Development > Starting Development and Compiling
Hold button handiling - A nudge in the right direction? :)
(1/1)
motionman95:
I'm trying to add some extra lines of code to what the hold button does (I'm not making a plugin) - but I can't seem to find the RockBox file that handles that. I looked at this thread:
http://forums.rockbox.org/index.php?topic=12900.0
But that file seems like the improper place to put my code, if I'm right.
What file does RockBox use to handle the Hold button?
saratoga:
--- Quote from: motionman95 on March 11, 2009, 10:30:30 AM ---What file does RockBox use to handle the Hold button?
--- End quote ---
Its handled by the button driver for each target. The file in that thread is for the e200.
motionman95:
I found the proper file, (button-c200) and added this:
--- Quote ---/*At the top of the file I included plugin.h*/
if(button_hold){
static const char filename[] = PLUGIN_APPS_DIR "/RockLock.rock";
plugin_load((char*)filename, NULL);
}
--- End quote ---
Instead of launching the plugin when I move the hold button, it splashes the message "Loading..." then freezes. What's wrong?
mcuelenaere:
--- Quote from: motionman95 on March 11, 2009, 05:27:13 PM ---I found the proper file, (button-c200) and added this:
--- Quote ---/*At the top of the file I included plugin.h*/
if(button_hold){
static const char filename[] = PLUGIN_APPS_DIR "/RockLock.rock";
plugin_load((char*)filename, NULL);
}
--- End quote ---
Instead of launching the plugin when I move the hold button, it splashes the message "Loading..." then freezes. What's wrong?
--- End quote ---
If you've added this code to 'firmware/target/arm/sandisk/sansa-c200/button-c200.c' (you don't clearly state which file): that's totally incorrect.
At first you should understand the separation between firmware/ and apps/: firmware/ code should *never* call any apps/ code, only the opposite is allowed.
If I would be you, I would try adding this code to apps/main.c or apps/root_menu.c (and replace button_hold with button_hold(), button_hold isn't declared globally).
edit:
apps/main.c already has something you want: AUTOROCK.
motionman95:
In that case, what function in main.c should I put my code? I don't want to use AUTOROCK because I don't need I to start every time I start my player, only when I switch on the hold button.
Navigation
[0] Message Index
Go to full version