diff options
-rw-r--r-- | vbe.c | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -158,11 +158,11 @@ int get_edid(char *edid) int ok; /* Initialize Int10 */ - ok = InitInt10(pci_config_type) == 0; - + ok = box_is_xbox() || InitInt10(pci_config_type) == 0; + if (ok) { ok = - vbe_check_vbe_info() && + (box_is_xbox() || vbe_check_vbe_info()) && vbe_get_edid_info(edid); FreeInt10(); @@ -171,3 +171,26 @@ int get_edid(char *edid) return ok ? 128 : 0; } + +int box_is_xbox() { + int is_xbox = 0; + int result = -1; + int fd; + size_t rd; + char *xbox_id = "0000\t10de02a5"; + char id[13]; + + if (!(fd = open("/proc/bus/pci/devices", O_RDONLY))) { + printf("Unable to open /proc/bus/pci/devices\n"); + } + if (!(rd = read(fd, id, sizeof(id)))) { + printf("Unable to read /proc/bus/pci/devices\n"); + } + + if (fd > 0) + close(fd); + result = strncmp(id, xbox_id, 13); + if (result == 0) + is_xbox = 1; + return is_xbox; +} |