spark: improve hardware_caps detection

This commit is contained in:
Stefan Seyfried
2012-09-16 22:53:35 +02:00
parent 8a6f1dea9d
commit f0a9b76ef1

View File

@@ -13,8 +13,12 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/ioctl.h>
#include <aotom_main.h>
#include <hardware_caps.h> #include <hardware_caps.h>
#define FP_DEV "/dev/vfd"
static int initialized = 0; static int initialized = 0;
static hw_caps_t caps; static hw_caps_t caps;
@@ -33,7 +37,7 @@ hw_caps_t *get_hwcaps(void)
strcpy(caps.boxvendor, "SPARK"); strcpy(caps.boxvendor, "SPARK");
const char *tmp; const char *tmp;
char buf[1024]; char buf[1024];
int len = -1; int len = -1, ret, val;
int fd = open("/proc/cmdline", O_RDONLY); int fd = open("/proc/cmdline", O_RDONLY);
if (fd != -1) { if (fd != -1) {
len = read(fd, buf, sizeof(buf) - 1); len = read(fd, buf, sizeof(buf) - 1);
@@ -72,5 +76,16 @@ hw_caps_t *get_hwcaps(void)
tmp = "(NO STB_ID FOUND)"; tmp = "(NO STB_ID FOUND)";
strcpy(caps.boxname, tmp); strcpy(caps.boxname, tmp);
} }
fd = open (FP_DEV, O_RDWR);
if (fd != -1) {
ret = ioctl(fd, VFDGETVERSION, &val);
if (ret < 0)
fprintf(stderr, "[hardware_caps] %s: VFDGETVERSION %m\n", __func__);
else if (val == 1) { /* VFD, others not yet seen in the wild */
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.display_xres = 8;
}
close(fd);
}
return &caps; return &caps;
} }