diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-engine/Makefile.am | 4 | ||||
-rw-r--r-- | src/xine-utils/Makefile.am | 4 | ||||
-rw-r--r-- | src/xine-utils/xine_check.c | 265 | ||||
-rw-r--r-- | src/xine-utils/xine_check.h | 34 |
4 files changed, 304 insertions, 3 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 6eb07a850..8418d6910 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -2,7 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -AM_CFLAGS = $(THREAD_CFLAGS) $(X_CFLAGS) -DXINE_LOGO_FILE=\"file://@XINE_DATADIR@/xine_logo.mpv\" +AM_CFLAGS = $(THREAD_CFLAGS) $(X_CFLAGS) lib_LTLIBRARIES = libxine.la @@ -32,7 +32,7 @@ noinst_HEADERS = bswap.h nvtvd.h @INCLUDED_INTL_TRUE@ @cd $(top_builddir)/intl && $(MAKE) libintl.la debug: - @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) $(THREAD_CFLAGS) $(X_CFLAGS) -DXINE_LOGO_FILE=\\\"file://@XINE_DATADIR@/xine_logo.mpv\\\"" + @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) $(THREAD_CFLAGS) $(X_CFLAGS) install-debug: debug @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index 0b1bf4830..1cca7b514 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -19,9 +19,10 @@ libxineutils_la_SOURCES = $(pppc_files) \ memcpy.c \ monitor.c \ utils.c \ + xine_check.c \ xine_mutex.c \ xmllexer.c \ - xmlparser.c + xmlparser.c libxineutils_la_LIBADD = $(THREAD_LIBS) @@ -30,6 +31,7 @@ include_HEADERS = attributes.h \ compat.h \ ppcasm_string.h \ xineutils.h \ + xine_check.h \ xmllexer.h \ xmlparser.h diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c new file mode 100644 index 000000000..6fd65515d --- /dev/null +++ b/src/xine-utils/xine_check.c @@ -0,0 +1,265 @@ +#include "xine_check.h" +#include <stdio.h> +#include "xineutils.h" +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <sys/utsname.h> +#include <fcntl.h> +#include <stdlib.h> +#include <linux/major.h> +#include <linux/hdreg.h> +#include <errno.h> + +typedef struct { + FILE *fd; + char *filename; + char *ln; + char buf[256]; +} file_info_t; + +int xine_health_check() +{ + int retval = 0; + +#if 0 + if (xine_health_check_os() < 0) + { + retval = -1; + } +#endif + + if (xine_health_check_kernel() < 0) + { + retval = -1; + } + +#if ARCH_X86 + if (xine_health_check_mtrr() < 0) + { + retval = -1; + } +#endif /* ARCH_X86 */ + + if (xine_health_check_cdrom() < 0) + { + retval = -1; + } + + if (xine_health_check_dvdrom() < 0) + { + retval = -1; + } + +#if 0 + if (xine_health_check_dma() < 0) + { + retval = -1; + } +#endif + + if (xine_health_check_x() < 0) + { + retval = -1; + } + + if (xine_health_check_xv() < 0) + { + retval = -1; + } + + return retval; +} + +int xine_health_check_os(void) +{ + fprintf(stdout, "xine health_check (OS): "); + int retval = 0; + + return retval; +} + +int xine_health_check_kernel(void) +{ + fprintf(stdout, "xine health_check (Kernel):\n"); + + struct utsname kernel; + if (uname(&kernel) == 0) + { + fprintf(stdout," sysname: %s\n", kernel.sysname); + fprintf(stdout," release: %s\n", kernel.release); + fprintf(stdout," machine: %s\n", kernel.machine); + } + else + { + fprintf(stdout," FAILURE - Could not get kernel information.\n"); + return -1; + } + return 0; +} + +int xine_health_check_mtrr(void) +{ + fprintf(stdout, "xine health_check (MTRR):\n"); + + char *file = "/proc/mtrr"; + FILE *fd; + fd = fopen(file, "r"); + if (fd < 0) + { + fprintf(stdout, " FAILED: mtrr is not enabled.\n"); + return -1; + } + else { + fprintf(stdout, " SUCCESS: mtrr is enabled.\n"); + fclose(fd); + } + return 0; +} + +int xine_health_check_cdrom(void) +{ + fprintf(stdout, "xine health_check (CDROM):\n"); + char* cdrom_name = "/dev/cdrom"; + struct stat cdrom_st; + + if (stat(cdrom_name,&cdrom_st) < 0) + { + fprintf(stdout, " FAILED - could not cdrom: %s.\n", cdrom_name); + return -1; + } + else + { + fprintf(stdout, " SUCCESS - cdrom link %s is present.\n",cdrom_name); + } + + if ((cdrom_st.st_mode & S_IFMT) != S_IFBLK) + { + fprintf(stdout, " FAILED - %s is not a block device.\n", cdrom_name); + return -1; + } + else + { + fprintf(stdout, " SUCCESS - %s is a block device.\n", cdrom_name); + } + + if ((cdrom_st.st_mode & S_IFMT & S_IRWXU & S_IRWXG & S_IRWXO) != (S_IRUSR & S_IXUSR & S_IRGRP & S_IXGRP & S_IROTH & S_IXOTH)) + { + fprintf(stdout, " FAILED - %s permissions are not 'rwxrwxrx'.\n",cdrom_name); + } + else { + fprintf(stdout, " SUCCESS - %s does have proper permission.\n",cdrom_name); + } + + return 0; +} + +int xine_health_check_dvdrom(void) +{ + fprintf(stdout, "xine health_check (DVDROM):\n"); + char* dvdrom_name = "/dev/dvd"; + struct stat dvdrom_st; + + if (stat(dvdrom_name,&dvdrom_st) < 0) + { + fprintf(stdout, " FAILED - could not dvdrom: %s.\n", dvdrom_name); + return -1; + } + else + { + fprintf(stdout, " SUCCESS - dvdrom link %s is present.\n",dvdrom_name); + } + + if ((dvdrom_st.st_mode & S_IFMT) != S_IFBLK) + { + fprintf(stdout, " FAILED - %s is not a block device.\n", dvdrom_name); + return -1; + } + else + { + fprintf(stdout, " SUCCESS - %s is a block device.\n", dvdrom_name); + } + + if ((dvdrom_st.st_mode & S_IFMT & S_IRWXU & S_IRWXG & S_IRWXO) != (S_IRUSR & S_IXUSR & S_IRGRP & S_IXGRP & S_IROTH & S_IXOTH)) + { + fprintf(stdout, " FAILED - %s permissions are not 'rwxrwxrx'.\n",dvdrom_name); + } + else { + fprintf(stdout, " SUCCESS - %s does have proper permission.\n",dvdrom_name); + } + + return 0; +} + +int xine_health_check_dma(void) +{ + fprintf(stdout, "xine health_check (DMA):\n"); + int retval = 0; + int is_scsi_dev = 0; + int fd = 0; + static long param = 0; + + /* If /dev/dvd points to /dev/scd0 but the drive is IDE (e.g. /dev/hdc) and not scsi + * how do we detect the correct one */ + char* name = "/dev/hdc"; + struct stat st; + if (stat(name, &st)){ + perror(name); + exit(errno); + } + + if (major(st.st_rdev) == LVM_BLK_MAJOR){ + is_scsi_dev = 1; + fprintf(stdout, " SKIPPED - Operation not supported on SCSI disks.\n"); + } + + /* At this time due to the way my system is setup user 'root' must be runnning xine */ + fd = open(name, O_RDONLY | O_NONBLOCK); + if (fd < 0) + { + perror(name); + exit(errno); + } + + if (!is_scsi_dev){ + if(ioctl(fd, HDIO_GET_DMA, ¶m)) + { + fprintf(stdout, " FAILED - HDIO_GET_DMA failed. Ensure the permissions for %s are 0664.\n", name); + } + if (param != 1) + { + fprintf(stdout, " FAILED - DMA not turned on for %s.\n", name); + } + else + { + fprintf(stdout, " SUCCESS - DMA turned on for %s.\n", name); + close(fd); + } + } + + return retval; +} + +int xine_health_check_x(void) +{ + fprintf(stdout, "xine health_check (X):\n"); + char* env_display = getenv("DISPLAY"); + if (strlen(env_display) == 0) + { + fprintf(stdout, " FAILED - DISPLAY environment variable not set.\n"); + return -1; + } + else + { + fprintf(stdout, " SUCCESS - DISPLAY environment variable is set.\n"); + } + return 0; +} + +int xine_health_check_xv(void) +{ + fprintf(stdout, "xine health_check (XV):\n"); + int retval = 0; + + return retval; +} + diff --git a/src/xine-utils/xine_check.h b/src/xine-utils/xine_check.h new file mode 100644 index 000000000..836d2d3d4 --- /dev/null +++ b/src/xine-utils/xine_check.h @@ -0,0 +1,34 @@ +#ifndef XINE_CHECK_H +#define XINE_CHECK_H + +/* Start checking xine setup here */ +int xine_health_check(void); + +/* Get OS information */ +int xine_health_check_os(void); + +/* Get Kernel information */ +int xine_health_check_kernel(void); + +#if ARCH_X86 +/* health_check MTRR */ +int xine_health_check_mtrr(void); +#endif /* ARCH_X86 */ + +/* health_check CDROM */ +int xine_health_check_cdrom(void); + +/* health_check DVDROM */ +int xine_health_check_dvdrom(void); + +/* health_check DMA settings */ +int xine_health_check_dma(void); + +/* health_check X */ +int xine_health_check_x(void); + +/* health_check Xv extension */ +int xine_health_check_xv(void); + +#endif + |