rbutil: path suffix support for devices with non-standard paths

Only for themes, fonts and voice files, includes rgnano implementation to test (can be in its own commit if needed, with the required manual updates and changes to install rockbox itself with rbutil).

Change-Id: I2481e6a3224912a298cf4c86011226e466490e08
This commit is contained in:
Hairo R. Carela 2025-12-30 21:56:31 -04:00 committed by Solomon Peachy
parent 7418e65138
commit 64e0ced696
10 changed files with 61 additions and 6 deletions

View file

@ -68,6 +68,7 @@ const static struct {
{ PlayerBuildInfo::Brand, ":target:/brand" },
{ PlayerBuildInfo::PlayerPicture, ":target:/playerpic" },
{ PlayerBuildInfo::ThemeName, ":target:/themename" },
{ PlayerBuildInfo::PathSuffix, ":target:/pathsuffix" },
{ PlayerBuildInfo::TargetNamesAll, "_targets/all" },
{ PlayerBuildInfo::TargetNamesEnabled, "_targets/enabled" },
{ PlayerBuildInfo::LanguageInfo, "languages/:target:" },

View file

@ -70,6 +70,7 @@ public:
Brand,
PlayerPicture,
ThemeName,
PathSuffix,
TargetNamesAll,
TargetNamesEnabled,

View file

@ -35,6 +35,7 @@ const static struct {
{ RbSettings::ShowChangelog, "show_changelog", "false" },
{ RbSettings::CurrentPlatform, "platform", "" },
{ RbSettings::Mountpoint, "mountpoint", "" },
{ RbSettings::Suffix, "suffix", "" },
{ RbSettings::CachePath, "cachepath", "" },
{ RbSettings::Build, "build", "" },
{ RbSettings::ProxyType, "proxytype", "" },

View file

@ -34,6 +34,7 @@ class RbSettings : public QObject
ShowChangelog,
CurrentPlatform,
Mountpoint,
Suffix,
CachePath,
Build,
ProxyType,

View file

@ -188,9 +188,8 @@ void Config::accept()
}
// platform
QString nplat;
QString nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
if(ui.treeDevices->selectedItems().size() != 0) {
nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
RbSettings::setValue(RbSettings::Platform, nplat);
}
else {
@ -198,6 +197,12 @@ void Config::accept()
error = true;
}
// path suffix
QString suffix = PlayerBuildInfo::instance()->value(PlayerBuildInfo::DeviceInfo::PathSuffix, nplat).toString();
if (!suffix.isEmpty()) {
RbSettings::setValue(RbSettings::Suffix, suffix);
}
// cache settings
if(QFileInfo(ui.cachePath->text()).isDir()) {
if(!QFileInfo(ui.cachePath->text()).isWritable()) {

View file

@ -51,6 +51,7 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent
m_logger = nullptr;
m_zipinstaller = nullptr;
m_suffix = RbSettings::value(RbSettings::Suffix).toString();
m_themesinstaller = new ThemesInstallWindow(this);
connect(m_themesinstaller, &ThemesInstallWindow::selected,
[this](int count) {ui.themesCheckbox->setChecked(count > 0);});
@ -494,7 +495,14 @@ void SelectiveInstallWidget::installFonts(void)
m_zipinstaller->setUrl(fontsurl);
m_zipinstaller->setLogSection("Fonts");
m_zipinstaller->setLogVersion(logversion);
m_zipinstaller->setMountPoint(m_mountpoint);
if (!m_suffix.isEmpty()) {
QString fullpath = m_mountpoint + m_suffix;
m_zipinstaller->setMountPoint(fullpath);
} else {
m_zipinstaller->setMountPoint(m_mountpoint);
}
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
m_zipinstaller->setCache(true);
@ -533,7 +541,14 @@ void SelectiveInstallWidget::installVoicefile(void)
m_zipinstaller->setUrl(voiceurl);
m_zipinstaller->setLogSection("Prerendered Voice (" + lang + ")");
m_zipinstaller->setLogVersion(logversion);
m_zipinstaller->setMountPoint(m_mountpoint);
if (!m_suffix.isEmpty()) {
QString fullpath = m_mountpoint + m_suffix;
m_zipinstaller->setMountPoint(fullpath);
} else {
m_zipinstaller->setMountPoint(m_mountpoint);
}
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
m_zipinstaller->setCache(true);
@ -664,7 +679,14 @@ void SelectiveInstallWidget::installPluginData(void)
m_zipinstaller->setUrl(dataUrls);
m_zipinstaller->setLogSection(dataName);
m_zipinstaller->setLogVersion();
m_zipinstaller->setMountPoint(m_mountpoint);
if (!m_suffix.isEmpty()) {
QString fullpath = m_mountpoint + m_suffix;
m_zipinstaller->setMountPoint(fullpath);
} else {
m_zipinstaller->setMountPoint(m_mountpoint);
}
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
m_zipinstaller->setCache(true);
connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall);

View file

@ -63,6 +63,7 @@ class SelectiveInstallWidget : public QWidget
QString m_target;
QString m_blmethod;
QString m_mountpoint;
QString m_suffix;
ProgressLoggerGui *m_logger;
int m_installStage;
ZipInstaller *m_zipinstaller;

View file

@ -90,6 +90,7 @@ platform145=erosqnative.hw1hw2
platform146=erosqnative.hw1hw2.hifiwalkerh2
platform147=erosqnative.hw1hw2.hifiwalkerh2.v13
platform148=erosqnative.hw1hw2.surfansf20
platform149=rgnano
; devices sections
;
@ -115,6 +116,8 @@ platform148=erosqnative.hw1hw2.surfansf20
; and the user has to manually choose.
; usberror: VID / PID value for detecting the player in an incompatible mode
; (MTP vs MSC). Can be a list.
; pathsuffix: For devices that don't use the root of the filesystem for the
; rockbox folder.
; status: allows hiding the target from the list of devices.
;
[archosplayer]
@ -1007,6 +1010,17 @@ usberror=
playerpic=aigoerosk
encoder=rbspeex
[rgnano]
name="RG Nano"
bootloadermethod=none
bootloadername=
manualname=
brand=Anbernic
usbid=0x1d6b0104
playerpic=rgnano
encoder=lame
pathsuffix=/FunKey
; incompatible devices sections
; each section uses a USB VID / PID string as section name.
; name: human readable string to show the user when this device is detected.

View file

@ -165,6 +165,7 @@ struct {
{ "archosfmrecorder", PlayerBuildInfo::BootloaderFile, "" },
{ "archosfmrecorder", PlayerBuildInfo::BootloaderFilter, "" },
{ "archosfmrecorder", PlayerBuildInfo::Encoder, "lame" },
{ "archosfmrecorder", PlayerBuildInfo::PathSuffix, "" },
{ "archosfmrecorder", PlayerBuildInfo::Brand, "Archos" },
{ "archosfmrecorder", PlayerBuildInfo::PlayerPicture, "archosfmrecorder"},
{ "iriverh100", PlayerBuildInfo::BuildStatus, "2" },

View file

@ -353,6 +353,7 @@ void ThemesInstallWindow::install()
logger = new ProgressLoggerGui(this);
logger->show();
QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
QString m_suffix = RbSettings::value(RbSettings::Suffix).toString();
LOG_INFO() << "mountpoint:" << mountPoint;
// show dialog with error if mount point is wrong
if(!QFileInfo(mountPoint).isDir()) {
@ -365,7 +366,14 @@ void ThemesInstallWindow::install()
installer->setUrl(themes);
installer->setLogSection(names);
installer->setLogVersion(version);
installer->setMountPoint(mountPoint);
if (!m_suffix.isEmpty()) {
QString fullpath = mountPoint + m_suffix;
installer->setMountPoint(fullpath);
} else {
installer->setMountPoint(mountPoint);
}
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);