ibasso: Implement proper PIVOT_ROOT filesystem access
Including direct use of the external SD card mount Known issue: If SD card is inserted at startup, it must be ejected and reinserted to be registered. Change-Id: I5f420160bda32135cbb088c1e8b04b6e3a73018e
This commit is contained in:
parent
e4345f2db8
commit
b6fce99046
5 changed files with 75 additions and 5 deletions
|
@ -140,9 +140,14 @@
|
|||
/* Define this if a programmable hotkey is mapped */
|
||||
#define HAVE_HOTKEY
|
||||
|
||||
/* No special storage */
|
||||
#define CONFIG_STORAGE STORAGE_HOSTFS
|
||||
/* Supports internal and microSD storage */
|
||||
#define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD)
|
||||
#define HOSTFS_VOL_DEC "Internal"
|
||||
#define HAVE_STORAGE_FLUSH
|
||||
#define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */
|
||||
#define NUM_DRIVES 2
|
||||
#define HAVE_HOTSWAP
|
||||
#define MULTIDRIVE_DIR "/mnt/external_sd"
|
||||
|
||||
/* More common stuff */
|
||||
#define BATTERY_DEV_NAME "battery"
|
||||
|
|
|
@ -137,9 +137,14 @@
|
|||
/* Define this if a programmable hotkey is mapped */
|
||||
#define HAVE_HOTKEY
|
||||
|
||||
/* No special storage */
|
||||
#define CONFIG_STORAGE STORAGE_HOSTFS
|
||||
/* Supports internal and microSD storage */
|
||||
#define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD)
|
||||
#define HOSTFS_VOL_DEC "Internal"
|
||||
#define HAVE_STORAGE_FLUSH
|
||||
#define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */
|
||||
#define NUM_DRIVES 2
|
||||
#define HAVE_HOTSWAP
|
||||
#define MULTIDRIVE_DIR "/mnt/external_sd"
|
||||
|
||||
/* More common stuff */
|
||||
#define BATTERY_DEV_NAME "battery"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "mv.h"
|
||||
|
||||
#include "button-ibasso.h"
|
||||
#include "debug-ibasso.h"
|
||||
|
@ -39,6 +40,8 @@
|
|||
uintptr_t* stackbegin;
|
||||
uintptr_t* stackend;
|
||||
|
||||
/* forward-declare */
|
||||
bool os_file_exists(const char *ospath);
|
||||
|
||||
void system_init(void)
|
||||
{
|
||||
|
@ -95,3 +98,55 @@ void system_exception_wait(void)
|
|||
|
||||
while(1) {};
|
||||
}
|
||||
|
||||
bool hostfs_removable(IF_MD_NONVOID(int drive))
|
||||
{
|
||||
#ifdef HAVE_MULTIDRIVE
|
||||
if (drive > 0)
|
||||
return true;
|
||||
else
|
||||
#endif
|
||||
return false; /* internal: always present */
|
||||
}
|
||||
|
||||
#ifdef HAVE_MULTIDRIVE
|
||||
int volume_drive(int drive)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
#endif /* HAVE_MULTIDRIVE */
|
||||
|
||||
#ifdef CONFIG_STORAGE_MULTI
|
||||
int hostfs_driver_type(int drive)
|
||||
{
|
||||
return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
|
||||
}
|
||||
#endif /* CONFIG_STORAGE_MULTI */
|
||||
|
||||
bool hostfs_present(IF_MD_NONVOID(int drive))
|
||||
{
|
||||
#ifdef HAVE_MULTIDRIVE
|
||||
if (drive > 0)
|
||||
#if defined(MULTIDRIVE_DEV)
|
||||
return os_file_exists(MULTIDRIVE_DEV);
|
||||
#else
|
||||
return extsd_present;
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
return true; /* internal: always present */
|
||||
}
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
bool volume_removable(int volume)
|
||||
{
|
||||
/* don't support more than one partition yet, so volume == drive */
|
||||
return hostfs_removable(volume);
|
||||
}
|
||||
|
||||
bool volume_present(int volume)
|
||||
{
|
||||
/* don't support more than one partition yet, so volume == drive */
|
||||
return hostfs_present(volume);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
static const char VOLD_MONITOR_SOCKET_NAME[] = "UNIX_domain";
|
||||
static int _vold_monitor_socket_fd = -1;
|
||||
|
||||
|
||||
static void vold_monitor_open_socket(void)
|
||||
{
|
||||
TRACE;
|
||||
|
@ -82,6 +81,8 @@ static void vold_monitor_open_socket(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Track state of external SD */
|
||||
bool extsd_present = false;
|
||||
|
||||
/*
|
||||
bionic does not have pthread_cancel.
|
||||
|
@ -161,10 +162,12 @@ static void* vold_monitor_run(void* nothing)
|
|||
else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 4 (Mounted) to 5 (Unmounting)") == 0)
|
||||
{
|
||||
/* We are loosing the external sdcard, inform Rockbox. */
|
||||
extsd_present = false;
|
||||
}
|
||||
else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 3 (Checking) to 4 (Mounted)") == 0)
|
||||
{
|
||||
/* The external sdcard is back, inform Rockbox. */
|
||||
extsd_present = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,5 +38,7 @@ void vold_monitor_start(void);
|
|||
*/
|
||||
bool vold_monitor_forced_close_imminent(void);
|
||||
|
||||
/* Track the state of the SD card */
|
||||
extern bool extsd_present;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue