Hi Leute,
ich suche ein einfaches Beispiel wie ich ein Plugin mit Namen aus einen anderen Plugin starten kann.
so in etwar wie im enigma_main Standartplugin "Erweiterungen" wo man plugins auswählen und starten kann.
wäre euch sehr dankbar.
Emanuel
Hi Leute,
ich suche ein einfaches Beispiel wie ich ein Plugin mit Namen aus einen anderen Plugin starten kann.
so in etwar wie im enigma_main Standartplugin "Erweiterungen" wo man plugins auswählen und starten kann.
wäre euch sehr dankbar.
Emanuel
Hi, sollte wie folgt funktionieren:
#!/bin/sh
/bin/sh /var/tuxbox/plugins/plugin2.sh
Wobei "plugin2.sh" eben der Name des aufgerufenen Plugins ist. Pfade gegebenfalls anpassen und Rechte bei beiden auf 755.
Gruss
Hi ZZMajor,
sorry aber so geht es nicht.
run_p.sh nr1
root@dreambox:~> /var/tuxbox/plugins/run_p.sh
/var/tuxbox/plugins/jukebox.so: 1: Syntax error: "(" unexpected
root@dreambox:~>
run_p.sh nr2
root@dreambox:~> /var/tuxbox/plugins/run_p.sh
root@dreambox:~> killall -9 jukebox.so
killall: jukebox.so: no process killed
root@dreambox:~>
CU Emanuel
Komisch, bei mir läuft es so mit einem Plugin.
Rechte hast Du alle ausreichend gesetzt?
Jukebox startet bei manuellem Aufruf?
Wobei ich gerade sehe. Bei mir wird vom Plugin aus ein *.sh, also ein weiteres Shell-Script aufgerufen. Bei Deinem Test mit Jukebox handelt es sich ja um eine ausführbare Datei. Da muss ich grad leider passen, da fehlt mir die nötige Erfahrung, um da den richtigen Aufruf zu setzen. Evtl. bringt ja der Aufruf mit exec anstatt /bin/sh/ den gewünschten Erfolg.
Gruss
meines wissens können nicht zwei plugins gleichzeitig laufen.
Danke für die Antworten,
Ich werde das laufend beenden müssen.
Soll ja ein Controlpanel werden, mal sehen was draus wird.
Cu Emanuel
Hi Leute,
kann mir bitte wer helfen? Was muß ich z.B in der Funktion MyMainWindow::execplug() (Zeile 29) ändern?
#include <plugin.h>
#include <stdio.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <src/enigma_main.h>
#include <src/enigma_plugins.h>
class MyMainWindow: public eWindow
{
eLabel *label1;
eButton *buton_ok;
eString *plug;
void execplug();
public:
MyMainWindow();
~MyMainWindow();
};
extern "C" int plugin_exec( PluginParam *par )
{
MyMainWindow dlg;
dlg.show();
int result=dlg.exec();
dlg.hide();
return result;
}
void MyMainWindow::execplug()
{
hide();
eZapPlugins plugins(eZapPlugins::StandardPlugin);
plugins.execPluginByName("tuxtxt.cfg");
}
MyMainWindow::MyMainWindow(): eWindow(1)
{
cmove(ePoint(100, 100));
cresize(eSize(520, 376));
setText("panel");
label1=new eLabel(this);
label1->move(ePoint(50, 50));
label1->resize(eSize(200, 100));
label1->setText("Bitte Knopf drücken !!");
buton_ok = new eButton(this);
buton_ok->setText("Exit");
buton_ok->move(ePoint((clientrect.width() - 90)/2, clientrect.height() - 60));
buton_ok->resize(eSize(90, 40));
buton_ok->setShortcut("green");
buton_ok->setShortcutPixmap("green");
buton_ok->loadDeco();
CONNECT(buton_ok->selected, MyMainWindow::execplug);
setFocus(buton_ok);
}
MyMainWindow::~MyMainWindow()
{
}
Alles anzeigen
Ich wäre dankbar für Hilfe
CU Emanuel
Hab noch nix!
Emanuel
Hi Leute,
Reine Enigma plugins kann ich schon starten,
aber kein tuxcom.so, tuxtxt.so, ...
#include <stdio.h>
#include <plugin.h>
#include <dlfcn.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <src/enigma.h>
#include <src/enigma_main.h>
//plugin funktions
int pl_exec(char *filename);
char * find_file (const char *file);
//find_file checking path to plugins
char * find_file (const char *file)
{
struct stat st;
static char filename[256];
printf ("FINDFILE: file=(%s)\n", file);
sprintf ( filename, "/usr/lib/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/var/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/lib/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/var/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/usr/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
//printf ("NOT FOUND\n");
strcpy (filename, file);
return filename;
}
//controlling handle of plugins
int pl_exec(char *so)
{
int ok = 0;
void *handle;
char filename[256];
char *error;
int (*do_plugin_exec) (PluginParam * par);
strcpy (filename, find_file (so) );
ok = 1;
if (ok == 1)
{
handle = dlopen (filename, RTLD_GLOBAL | RTLD_NOW);
if (!handle)
{
fprintf (stderr, "%s\n", dlerror ());
ok = 0;
}
dlerror (); /* Clear any existing error */
*(void **) (&do_plugin_exec) = dlsym (handle, "plugin_exec");
if ((error = dlerror ()) != NULL)
{
fprintf (stderr, "%s\n", error);
ok = 0;
}
if (ok == 1)
{
(*do_plugin_exec) (NULL);
dlclose (handle);
}
}
return ok;
}
// The Class declaration of our Main Window
class MyMainWindow: public eWindow
{
// the label1 to show the text
eLabel *label1;
// the button
eButton *button_ok;
eString *plug;
void MyMainWindow::exeplug();
public:
// the constructor.
MyMainWindow();
// the destructor.
~MyMainWindow();
};
// The plugin entry point, Here start the code execution
extern "C" int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
MyMainWindow dlg;
// show the dialog...
dlg.show();
// give control to dialog.. (the dialog is modal!)
int result=dlg.exec();
// and after it, hide it again.
dlg.hide();
return result;
}
void MyMainWindow::exeplug()
{ this->hide();
if ( !pl_exec("jukebox.so") )
{
eMessageBox msg (_("Cannot find the 'jukebox.so' plugin"), _("Cannot find plugin"), eMessageBox::btOK | eMessageBox::iconError);
msg.show ();
msg.exec ();
msg.hide ();
}
this->show ();
}
MyMainWindow::MyMainWindow(): eWindow(1)
{
// move our dialog to 100.100...
cmove(ePoint(100, 100));
// ...and give x and y dimensions.
cresize(eSize(520, 376));
// set a title.
setText("openpanel");
// create a label1 to show a text.
label1=new eLabel(this);
// give a position
label1->move(ePoint(50, 50));
// set the label1 dimensions
label1->resize(eSize(300, 100));
// set the label1 text
label1->setText("Press Button to launch jukebox!!");
// create the button
button_ok = new eButton(this);
// set the button text
button_ok->setText("start");
// set position
button_ok->move(ePoint((clientrect.width() - 90)/2, clientrect.height() - 60));
// set size
button_ok->resize(eSize(90, 40));
// set shortcut and pixmap
button_ok->setShortcut("green");
button_ok->setShortcutPixmap("green");
// decore with a frame
button_ok->loadDeco();
// function to call when buton is pressed
CONNECT(button_ok->selected, MyMainWindow::exeplug);
// set focus to the button
setFocus(button_ok);
}
MyMainWindow::~MyMainWindow()
{
}
Alles anzeigen
Vielleicht weiß ja wer was...
Emanuel
was geschieht denn, wenn du ein anderes plugin ausführen willst als jukebox?
übrigens:
ich würde zuerst den boxtyp auslesen, dann kannst du nur die verzeichnisse durchsuchen, die es auch gibt.
in den merlin-sourcen hab ich das z.b. in der swapmanager.cpp drin.
Hi dre,
Erst mal Danke für die Antwort,
klar das mit Boxtype ist dann schöner. Aber im Moment kämpfe ich mit dem Hauptproblem. Alle *.so sauber auszuführen. für *.sh ist ja dann ein Bsp. im cvs.
Also: wenn in der cfg steht:
1.
pluginversion=1
name=Dreambox Links Web Browser
desc=Internet-Browser
type=2
needfb=1
needrc=1
needoffsets=1
=nix tut sich [ohne this->hide() Totalabsturz]
2.
= enigma skinkiller
3.
= OK
4.
praktisch alle mit den Einträgen gehen *.so.
Die #include <dlfcn.h> geht ja nur auf die objects *.so los
ich glaube wenn ich das Plugin so ausführe wird die *.cfg nicht überprüft.
Bin immer noch ratlos.
CU Emanuel