From 2c527c297d7ef43456f6729dee9654e3e4fb4813 Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Mon, 7 Mar 2005 21:56:02 +0000 Subject: XBox support --- vbe.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'vbe.c') diff --git a/vbe.c b/vbe.c index 47d0170..bfd48bb 100644 --- a/vbe.c +++ b/vbe.c @@ -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; +} -- cgit v1.2.1