From 276fbc764b2a574a7a85f8deffb49e1763da4b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 15 Dec 2004 16:09:45 +0000 Subject: ppc & ppc64 fixes --- tools/ddcprobe/Makefile | 3 +++ tools/ddcprobe/ddcxinfos.c | 2 +- tools/ddcprobe/of.c | 3 +++ tools/ddcprobe/vbe.h | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/ddcprobe/Makefile b/tools/ddcprobe/Makefile index c558212f3..468d3464e 100644 --- a/tools/ddcprobe/Makefile +++ b/tools/ddcprobe/Makefile @@ -25,6 +25,9 @@ endif ifeq (ppc,$(ARCH)) #OBJS = ddcxinfos.o of.o minifind.o vbe.o vesamode.o endif +ifeq (ppc64,$(ARCH)) +OBJS = ddcxinfos.o of.o minifind.o vbe.o vesamode.o +endif ifeq (,$(OBJS)) OBJS = not_handled.o endif diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c index ebfa32df9..e595d549c 100644 --- a/tools/ddcprobe/ddcxinfos.c +++ b/tools/ddcprobe/ddcxinfos.c @@ -63,8 +63,8 @@ int main(void) known_vesa_modes[i].x, known_vesa_modes[i].y ); - printf("\n"); #endif + printf("\n"); /* Get EDID information */ if (vbe_get_edid_info(edid) == 0) { diff --git a/tools/ddcprobe/of.c b/tools/ddcprobe/of.c index aab0632f1..f8fdc30dd 100644 --- a/tools/ddcprobe/of.c +++ b/tools/ddcprobe/of.c @@ -138,6 +138,9 @@ int vbe_get_edid_info(struct vbe_edid1_info * ret) man = ntohs(man); memcpy(&ret->manufacturer_name, &man, 2); + /* byteswap to match the contents of MonitorsDB */ + ret->product_code = ((ret->product_code >> 8) & 0xff) | ((ret->product_code & 0xff) << 8); + free(mem); return 1; } diff --git a/tools/ddcprobe/vbe.h b/tools/ddcprobe/vbe.h index 4dd7e70c5..ac555c011 100644 --- a/tools/ddcprobe/vbe.h +++ b/tools/ddcprobe/vbe.h @@ -120,11 +120,18 @@ struct vbe_edid1_info { unsigned char header[8]; union { u_int16_t p; - struct { + struct __attribute__ ((packed)) { +#if __BYTE_ORDER == __LITTLE_ENDIAN u_int16_t char3: 5; u_int16_t char2: 5; u_int16_t char1: 5; u_int16_t zero: 1; +#else /* __BIG_ENDIAN */ + u_int16_t zero: 1; + u_int16_t char1: 5; + u_int16_t char2: 5; + u_int16_t char3: 5; +#endif } u; } manufacturer_name; u_int16_t product_code; @@ -176,9 +183,15 @@ struct vbe_edid1_info { unsigned char reserved: 7; } manufacturer_timings __attribute__ ((packed)); struct { +#if __BYTE_ORDER == __LITTLE_ENDIAN u_int16_t xresolution: 8; u_int16_t vfreq: 6; u_int16_t aspect: 2; +#else /* __BIG_ENDIAN */ + u_int16_t aspect: 2; + u_int16_t vfreq: 6; + u_int16_t xresolution: 8; +#endif } standard_timing[8] __attribute__ ((packed)); union { struct vbe_edid_detailed_timing detailed_timing[4]; -- cgit v1.2.1