Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
[CST] Focus
2012-09-13 11:24:13 +04:00
91 changed files with 295 additions and 315 deletions

View File

@@ -25,8 +25,8 @@
#include <string.h>
#include <unistd.h>
#include "configure_network.h"
#include "libnet.h" /* netGetNameserver, netSetNameserver */
#include "network_interfaces.h" /* getInetAttributes, setInetAttributes */
#include <lib/libnet/libnet.h> /* netGetNameserver, netSetNameserver */
#include <lib/libnet/network_interfaces.h> /* getInetAttributes, setInetAttributes */
#include <stdlib.h> /* system */
#include <iostream>
#include <iomanip>

View File

@@ -28,9 +28,37 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/vfs.h> /* or <sys/statfs.h> */
#include <string.h>
#include <fcntl.h>
#include <system/helpers.h>
bool file_exists(const char *filename)
{
struct stat stat_buf;
if(::stat(filename, &stat_buf) == 0)
{
return true;
} else
{
return false;
}
}
void wakeup_hdd(const char *hdd_dir)
{
if(!check_dir(hdd_dir)){
std::string wakeup_file = hdd_dir;
wakeup_file += "/.wakeup";
remove(wakeup_file.c_str());
creat(wakeup_file.c_str(),S_IREAD|S_IWRITE);
sync();
}
}
int my_system(const char * cmd, const char * arg1, const char * arg2)
{
int i;
@@ -102,3 +130,44 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
}
return(fp);
}
int safe_mkdir(char * path)
{
struct statfs s;
int ret = 0;
if(!strncmp(path, "/hdd", 4)) {
ret = statfs("/hdd", &s);
if((ret != 0) || (s.f_type == 0x72b6))
ret = -1;
else
mkdir(path, 0755);
} else
mkdir(path, 0755);
return ret;
}
int check_dir(const char * newdir)
{
struct statfs s;
if (::statfs(newdir, &s) == 0) {
switch (s.f_type) /* f_type is long */
{
case 0xEF53L: /*EXT2 & EXT3*/
case 0x6969L: /*NFS*/
case 0xFF534D42L: /*CIFS*/
case 0x517BL: /*SMB*/
case 0x52654973L: /*REISERFS*/
case 0x65735546L: /*fuse for ntfs*/
case 0x58465342L: /*xfs*/
case 0x4d44L: /*msdos*/
case 0x0187: /* AUTOFS_SUPER_MAGIC */
case 0x858458f6: /*ramfs*/
return 0;//ok
default:
fprintf( stderr,"%s Unknow File system type: %i\n",newdir ,s.f_type);
break;
}
}
return 1; // error
}

View File

@@ -24,5 +24,9 @@
int my_system(const char * cmd, const char * arg1, const char * arg2);
FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type);
int safe_mkdir(char * path);
int check_dir(const char * newdir);
bool file_exists(const char *filename);
void wakeup_hdd(const char *hdd_dir);
#endif

View File

@@ -24,7 +24,7 @@
#include <curl/curl.h>
#include <curl/easy.h>
#ifndef NEW_LIBCURL
#if LIBCURL_VERSION_NUM < 0x071507
#include <curl/types.h>
#endif

View File

@@ -33,7 +33,6 @@
#include "configure_network.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <unistd.h>
#include <iostream>
#include <iomanip>
@@ -44,12 +43,9 @@
#include <libnet.h>
#include <linux/if.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#if HAVE_COOL_HARDWARE
#include <coolstream/control.h>
@@ -76,8 +72,8 @@
#include <dmx.h>
#include <cs_api.h>
#include <pwrmngr.h>
#include "libdvbsub/dvbsub.h"
#include "libtuxtxt/teletext.h"
#include <libdvbsub/dvbsub.h>
#include <libtuxtxt/teletext.h>
#include <zapit/satconfig.h>
#include <zapit/zapit.h>
@@ -566,44 +562,3 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi
videoDecoder->SetAutoModes(modes);
return false;
}
int safe_mkdir(char * path)
{
struct statfs s;
int ret = 0;
if(!strncmp(path, "/hdd", 4)) {
ret = statfs("/hdd", &s);
if((ret != 0) || (s.f_type == 0x72b6))
ret = -1;
else
mkdir(path, 0755);
} else
mkdir(path, 0755);
return ret;
}
int check_dir(const char * newdir)
{
struct statfs s;
if (::statfs(newdir, &s) == 0) {
switch (s.f_type) /* f_type is long */
{
case 0xEF53L: /*EXT2 & EXT3*/
case 0x6969L: /*NFS*/
case 0xFF534D42L: /*CIFS*/
case 0x517BL: /*SMB*/
case 0x52654973L: /*REISERFS*/
case 0x65735546L: /*fuse for ntfs*/
case 0x58465342L: /*xfs*/
case 0x4d44L: /*msdos*/
case 0x0187: /* AUTOFS_SUPER_MAGIC */
case 0x858458f6: /*ramfs*/
return 0;//ok
default:
fprintf( stderr,"%s Unknow File system type: %i\n",newdir ,s.f_type);
break;
}
}
return 1; // error
}

View File

@@ -144,9 +144,6 @@ class COnekeyPluginChangeExec : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey);
};
int safe_mkdir(char * path);
int check_dir(const char * newdir);
class CTZChangeNotifier : public CChangeObserver
{
public: