summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2010-01-06 12:06:59 +0100
committerChristian Gmeiner <christian.gmeiner@gmail.com>2010-01-06 12:06:59 +0100
commit30f72a524e31b425bd2397c9dddea25bec14d1e5 (patch)
tree79c050aa1b2b1c19b0c8f05108c481d776b709c0
parentdbab37dc8ea0dd7de03f76b919bed557d851e7f8 (diff)
downloadvdr-plugin-dxr3-30f72a524e31b425bd2397c9dddea25bec14d1e5.tar.gz
vdr-plugin-dxr3-30f72a524e31b425bd2397c9dddea25bec14d1e5.tar.bz2
fix bug #223 by adding a command line option to enable automatic fw loading
By default the vdr-dxr3-plugin does not load the fw automatically any more, as on recent linux systems the fw gets loaded when the em8300 driver module gets loaded. So we dont need to load the fw. But for older systems there is the command option -f/--firmware-loading to tell the plugin to load the firmware at startup.
-rw-r--r--HISTORY3
-rw-r--r--Makefile2
-rw-r--r--dxr3.c13
-rw-r--r--dxr3interface.c5
-rw-r--r--settings.c51
-rw-r--r--settings.h5
6 files changed, 77 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 95fe71b..aa45ab9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -361,3 +361,6 @@ NOTE: I havent found time to include all of the languages, will be done in pre2
- Code cleanups (Christian Gmeiner)
- Add Ukrainian translation (#131, Yarema aka Knedlyk).
- New SpuEncoder (Christian Gmeiner)
+- Fix bug #223 by adding a command line argument to enable automatic
+ firmware loading:
+ '-f --firmware-loading Enable automatic firmware loading' (Christian Gmeiner)
diff --git a/Makefile b/Makefile
index 0eec9a8..220b85a 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,7 @@ DEFINES += -DMICROCODE=\"/lib/firmware/em8300.bin\"
OBJS = $(PLUGIN).o dxr3multichannelaudio.o \
dxr3syncbuffer.o dxr3audiodecoder.o dxr3blackframe.o dxr3audio.o \
- dxr3pesframe.o dxr3demuxdevice.o \
+ dxr3pesframe.o dxr3demuxdevice.o settings.o \
dxr3interface.o dxr3device.o \
dxr3output.o dxr3output-video.o dxr3output-audio.o dxr3osd.o dxr3spudecoder.o \
dxr3audio-oss.o dxr3audio-alsa.o spuencoder.o spuregion.o scaler.o
diff --git a/dxr3.c b/dxr3.c
index 8494f6d..9d3ee96 100644
--- a/dxr3.c
+++ b/dxr3.c
@@ -127,6 +127,9 @@ public:
const char* MainMenuEntry();
cOsdObject* MainMenuAction();
+ virtual const char *CommandLineHelp();
+ virtual bool ProcessArgs(int argc, char *argv[]);
+
virtual const char **SVDRPHelpPages(void);
virtual cString SVDRPCommand(const char *Command, const char *Option,
int &ReplyCode);
@@ -225,6 +228,16 @@ cOsdObject* cPluginDxr3::MainMenuAction()
return new cDxr3OsdMenu;
}
+const char *cPluginDxr3::CommandLineHelp()
+{
+ return " -f --firmware-loading Enable automatic firmware loading\n"
+}
+
+bool cPluginDxr3::ProcessArgs(int argc, char *argv[])
+{
+ return cSettings::instance()->processArgs(argc, argv);
+}
+
// ==================================
// TODO: localize command descriptions?
const char **cPluginDxr3::SVDRPHelpPages(void)
diff --git a/dxr3interface.c b/dxr3interface.c
index f5563cb..8f8f77f 100644
--- a/dxr3interface.c
+++ b/dxr3interface.c
@@ -431,6 +431,11 @@ void cDxr3Interface::PlayBlackFrame()
//! uploadroutine for microcode
void cDxr3Interface::UploadMicroCode()
{
+ if (!cSettings::instance()->loadFirmware()) {
+ return;
+ }
+
+ dsyslog("[dxr3-interface] loading firmware");
em8300_microcode_t em8300_microcode;
struct stat s;
diff --git a/settings.c b/settings.c
new file mode 100644
index 0000000..9aa9e6a
--- /dev/null
+++ b/settings.c
@@ -0,0 +1,51 @@
+/*
+ * _ _ _ _ _____
+ * __ ____| |_ __ _ __ | |_ _ __ _(_)_ __ __| |_ ___ _|___ /
+ * \ \ / / _` | '__|____| '_ \| | | | |/ _` | | '_ \ _____ / _` \ \/ / '__||_ \
+ * \ V / (_| | | |_____| |_) | | |_| | (_| | | | | |_____| (_| |> <| | ___) |
+ * \_/ \__,_|_| | .__/|_|\__,_|\__, |_|_| |_| \__,_/_/\_\_| |____/
+ * |_| |___/
+ *
+ * Copyright (C) 2010 Christian Gmeiner
+ *
+ * This file is part of vdr-plugin-dxr3.
+ *
+ * vdr-plugin-dxr3 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2.
+ *
+ * vdr-plugin-dxr3 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with dxr3-plugin. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <getopt.h>
+#include <vdr/tools.h>
+#include "settings.h"
+
+bool cSettings::processArgs(int argc, char *argv[])
+{
+ static struct option long_options[] = {
+ { "firmware-loading", no_argument, NULL, 'f' },
+ { NULL }
+ };
+
+ int c;
+ while ((c = getopt_long(argc, argv, "f", long_options, NULL)) != -1) {
+ switch (c) {
+ case 'f':
+ dsyslog("[dxr3-settings] enableing automatic firmware loading");
+ loadFirmware(true);
+ break;
+
+ default:
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/settings.h b/settings.h
index db3d4fb..62b2110 100644
--- a/settings.h
+++ b/settings.h
@@ -50,7 +50,9 @@ class cSettings : public Singleton<cSettings>
public:
cSettings() : useDigitalOut(0), card(0), forceLetterBox(0), videoMode(PAL),
brightness(500), contrast(500), saturation(500),
- hideMenu(0), useWss(0) {}
+ hideMenu(0), useWss(0), loadFirmware(false) {}
+
+ bool processArgs(int argc, char *argv[]);
Accessors<int> useDigitalOut;
Accessors<int> card;
@@ -63,6 +65,7 @@ public:
Accessors<int> hideMenu;
Accessors<int> useWss;
+ Accessors<bool> loadFirmware;
};
#endif /*SETTINGS_H*/