mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 18:28:52 +01:00
add quick usb commands, need to be improved to check return value
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
a5a611af19
commit
14ca315440
@ -547,7 +547,7 @@ void MenuMode::menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8
|
|||||||
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
|
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
|
||||||
|
|
||||||
if(menu_action){
|
if(menu_action){
|
||||||
sprintf(text_tmp, "%s in progress ...", usb_mounted?"Unmount":"Mount");
|
sprintf(text_tmp, "in progress ...");
|
||||||
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
|
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
|
||||||
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
|
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
|
||||||
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
|
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
|
||||||
@ -878,13 +878,20 @@ void MenuMode::launch( )
|
|||||||
MENU_DEBUG_PRINTF("USB %s\n", usb_mounted?"unmount":"mount");
|
MENU_DEBUG_PRINTF("USB %s\n", usb_mounted?"unmount":"mount");
|
||||||
if(menu_confirmation){
|
if(menu_confirmation){
|
||||||
MENU_DEBUG_PRINTF("%s USB - confirmed\n", usb_mounted?"Unmount":"Mount");
|
MENU_DEBUG_PRINTF("%s USB - confirmed\n", usb_mounted?"Unmount":"Mount");
|
||||||
/// ----- USB operation here ----
|
/// ----- Refresh screen ----
|
||||||
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
|
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
|
||||||
/// mounting/unmounting usb here (instead of this commentary)
|
|
||||||
usb_mounted = !usb_mounted;
|
/// ----- Shell cmd ----
|
||||||
menu_confirmation = 0;
|
fp = popen(usb_mounted?SHELL_CMD_USB_UNMOUNT:SHELL_CMD_USB_MOUNT, "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
usb_mounted = !usb_mounted;
|
||||||
|
}
|
||||||
|
|
||||||
/// ------ Refresh screen ------
|
/// ------ Refresh screen ------
|
||||||
|
menu_confirmation = 0;
|
||||||
screen_refresh = 1;
|
screen_refresh = 1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -39,6 +39,8 @@ typedef enum {ASPECT_RATIOS} ENUM_ASPECT_RATIOS_TYPES;
|
|||||||
#define SHELL_CMD_VOLUME_SET "/root/shell_cmds/volume_set.sh"
|
#define SHELL_CMD_VOLUME_SET "/root/shell_cmds/volume_set.sh"
|
||||||
#define SHELL_CMD_BRIGHTNESS_GET "/root/shell_cmds/brightness_get.sh"
|
#define SHELL_CMD_BRIGHTNESS_GET "/root/shell_cmds/brightness_get.sh"
|
||||||
#define SHELL_CMD_BRIGHTNESS_SET "/root/shell_cmds/brightness_set.sh"
|
#define SHELL_CMD_BRIGHTNESS_SET "/root/shell_cmds/brightness_set.sh"
|
||||||
|
#define SHELL_CMD_USB_MOUNT "share start"
|
||||||
|
#define SHELL_CMD_USB_UNMOUNT "share stop"
|
||||||
#define SHELL_CMD_POWERDOWN "shutdown -h now"
|
#define SHELL_CMD_POWERDOWN "shutdown -h now"
|
||||||
|
|
||||||
class MenuMode
|
class MenuMode
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user