summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--softhddevice.cpp25
2 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index c6b1e2b..0695782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
User johns
Date:
+ Support switching the primary device with svdrp.
Disable and reenable screen saver and DPMS.
Video source code cleanup.
Fix fast backward with some h264 streams.
diff --git a/softhddevice.cpp b/softhddevice.cpp
index ca0a036..9d498a8 100644
--- a/softhddevice.cpp
+++ b/softhddevice.cpp
@@ -101,7 +101,7 @@ static int ConfigAutoCropTolerance; ///< auto crop detection tolerance
static char ConfigSuspendClose; ///< suspend should close devices
static char ConfigSuspendX11; ///< suspend should stop x11
-static volatile char DoMakePrimary; ///< flag switch primary
+static volatile int DoMakePrimary; ///< switch primary device to this
#define SUSPEND_EXTERNAL -1 ///< play external suspend mode
#define SUSPEND_NORMAL 0 ///< normal suspend mode
@@ -1421,7 +1421,7 @@ bool cPluginSoftHdDevice::Start(void)
// Must be done in the main thread
dsyslog("[softhddev] makeing softhddevice %d the primary device!",
MyDevice->DeviceNumber());
- DoMakePrimary = 1;
+ DoMakePrimary = MyDevice->DeviceNumber() + 1;
} else {
isyslog("[softhddev] softhddevice %d is not the primary device!",
MyDevice->DeviceNumber());
@@ -1501,9 +1501,10 @@ void cPluginSoftHdDevice::MainThreadHook(void)
{
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
- if (DoMakePrimary && MyDevice) {
- dsyslog("[softhddev]%s: switching primary device\n", __FUNCTION__);
- cDevice::SetPrimaryDevice(MyDevice->DeviceNumber() + 1);
+ if (DoMakePrimary) {
+ dsyslog("[softhddev]%s: switching primary device to %d\n",
+ __FUNCTION__, DoMakePrimary);
+ cDevice::SetPrimaryDevice(DoMakePrimary);
DoMakePrimary = 0;
}
// check if user is inactive, automatic enter suspend mode
@@ -1679,7 +1680,8 @@ const char **cPluginSoftHdDevice::SVDRPHelpPages(void)
"RESU\n" " Resume plugin.\n",
"DETA\n" " Detach plugin.\n",
"ATTA\n" " Attach plugin.\n",
- "HOTK key\n" " Execute hotkey.\n",
+ "PRIM\n" " Make primary device.\n" "HOTK key\n"
+ " Execute hotkey.\n",
NULL
};
@@ -1756,6 +1758,17 @@ cString cPluginSoftHdDevice::SVDRPCommand(const char *command,
HandleHotkey(hotk);
return "hot-key executed";
}
+ if (!strcasecmp(command, "PRIM")) {
+ int primary;
+
+ primary = strtol(option, NULL, 0);
+ if (!primary && MyDevice) {
+ primary = MyDevice->DeviceNumber() + 1;
+ }
+ dsyslog("[softhddev] switching primary device to %d\n", primary);
+ DoMakePrimary = primary;
+ return "switching primary device requested";
+ }
return NULL;
}