summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-08-26 02:33:06 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-08-26 02:33:06 +0000
commit3fd5a86333bc1d358fe3de3db8b406c5bd2dce52 (patch)
treeaf75a79270d3b54ad0ed7994b51f1e51f0f4d8c4 /tools
parent6e888e8de1d951f0aecedca5d3a0d17c54635b1a (diff)
downloaddrakx-3fd5a86333bc1d358fe3de3db8b406c5bd2dce52.tar
drakx-3fd5a86333bc1d358fe3de3db8b406c5bd2dce52.tar.gz
drakx-3fd5a86333bc1d358fe3de3db8b406c5bd2dce52.tar.bz2
drakx-3fd5a86333bc1d358fe3de3db8b406c5bd2dce52.tar.xz
drakx-3fd5a86333bc1d358fe3de3db8b406c5bd2dce52.zip
PowerPC arrangements from Christiaan Welvaart
Diffstat (limited to 'tools')
-rw-r--r--tools/ddcprobe/Makefile2
-rw-r--r--tools/ddcprobe/of.c51
-rw-r--r--tools/ddcprobe/vbe.c6
3 files changed, 32 insertions, 27 deletions
diff --git a/tools/ddcprobe/Makefile b/tools/ddcprobe/Makefile
index 6f2f3f4e9..73f601c7e 100644
--- a/tools/ddcprobe/Makefile
+++ b/tools/ddcprobe/Makefile
@@ -19,7 +19,7 @@ OBJS = ddcxinfos.o vesamode.o vbe.o
LIBS = libint10.a libx86emu.a
endif
ifeq (ppc,$(ARCH))
-OBJS = ddcxinfos.o of.o minifind.o
+OBJS = ddcxinfos.o of.o minifind.o vbe.o vesamode.o
endif
ifeq (,$(OBJS))
OBJS = not_handled.o
diff --git a/tools/ddcprobe/of.c b/tools/ddcprobe/of.c
index 5e8aefa3f..aab0632f1 100644
--- a/tools/ddcprobe/of.c
+++ b/tools/ddcprobe/of.c
@@ -16,13 +16,17 @@
#include "minifind.h"
/* misnomer */
-struct vbe_info *vbe_get_vbe_info()
+int vbe_get_vbe_info(struct vbe_info *ret)
{
- struct vbe_info *ret = NULL;
struct fb_fix_screeninfo fix;
unsigned char *mem;
int rc = 0;
- int fd, i;
+ int fd = -1;
+ int i;
+
+ if (ret == NULL)
+ return 0;
+
if (!rc && !(fd = open("/dev/fb0", O_RDONLY)))
{
@@ -36,27 +40,27 @@ struct vbe_info *vbe_get_vbe_info()
fprintf(stderr, "Framebuffer ioctl failed. Exiting.\n");
}
- close(fd);
+ if (fd > 0)
+ close(fd);
if (!rc)
{
// Note: if OFfb, vram info is unreliable!
if (strcmp(fix.id, "OFfb"))
{
- ret = malloc(sizeof(struct vbe_info));
mem = strdup(fix.id);
while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) {
mem[i - 1] = '\0';
}
- ret->oem_name.string = mem;
- ret->product_name.string = NULL;
- ret->vendor_name.string = NULL;
- ret->product_revision.string = NULL;
- ret->memory_size = fix.smem_len/1024;
+ ret->oem_name = strdup(mem);
+ ret->product_name = NULL;
+ ret->vendor_name = NULL;
+ ret->product_revision = NULL;
+ ret->memory_size = fix.smem_len;
}
}
- return ret;
+ return !rc;
}
int get_edid_supported()
@@ -81,10 +85,9 @@ int get_edid_supported()
}
/* Get EDID info. */
-struct edid1_info *get_edid_info()
+int vbe_get_edid_info(struct vbe_edid1_info * ret)
{
unsigned char *mem;
- struct edid1_info *ret = NULL;
struct pathNode *n;
struct findNode *list;
u_int16_t man;
@@ -92,6 +95,9 @@ struct edid1_info *get_edid_info()
FILE* edid_file = NULL;
char *path = NULL;
+ if (ret == NULL)
+ return 0;
+
list = (struct findNode *) malloc(sizeof(struct findNode));
list->result = (struct pathNode *) malloc(sizeof(struct pathNode));
list->result->path = NULL;
@@ -110,37 +116,30 @@ struct edid1_info *get_edid_info()
if (!edid_file)
- return NULL;
+ return 0;
if (fread(edid, sizeof(unsigned char), 0x80, edid_file) != 0x80)
- return NULL;
+ return 0;
fclose(edid_file);
- mem = malloc(sizeof(struct edid1_info));
+ mem = malloc(sizeof(struct vbe_edid1_info));
if(mem == NULL) {
- return NULL;
+ return 0;
}
memcpy(mem, edid, 0x80);
- /* Get memory for return. */
- ret = malloc(sizeof(struct edid1_info));
- if(ret == NULL) {
- free(mem);
- return NULL;
- }
-
/* Copy the buffer for return. */
- memcpy(ret, mem, sizeof(struct edid1_info));
+ memcpy(ret, mem, sizeof(struct vbe_edid1_info));
memcpy(&man, &ret->manufacturer_name, 2);
man = ntohs(man);
memcpy(&ret->manufacturer_name, &man, 2);
free(mem);
- return ret;
+ return 1;
}
#endif /* __powerpc__ */
diff --git a/tools/ddcprobe/vbe.c b/tools/ddcprobe/vbe.c
index 7b061f213..8d16f7472 100644
--- a/tools/ddcprobe/vbe.c
+++ b/tools/ddcprobe/vbe.c
@@ -1,5 +1,7 @@
#include <sys/types.h>
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
#include <sys/io.h>
+#endif
#include <sys/mman.h>
#include <netinet/in.h>
#include <stdlib.h>
@@ -12,7 +14,9 @@
#include <unistd.h>
#include "vesamode.h"
#include "vbe.h"
+#if defined(__i386__) || defined(__x86_64__)
#include "int10/vbios.h"
+#endif
#define DEBUG 0
#if DEBUG
@@ -28,6 +32,7 @@
#define cpuemu 0
#endif
+#if defined(__i386__) || defined(__x86_64__)
/*
* Create a 'canonical' version, i.e. no spaces at start and end.
*
@@ -171,6 +176,7 @@ int vbe_get_edid_info(struct vbe_edid1_info *edid)
edid->manufacturer_name.p = ntohs(edid->manufacturer_name.p);
return 1;
}
+#endif
/* Just read ranges from the EDID. */
void vbe_get_edid_ranges(struct vbe_edid1_info *edid,