#include #include #include #include #include #include #include #include #include #include #include #include #include "get-edid.h" #include "minifind.h" int get_edid(char *edid) { struct pathNode *n; struct findNode *list; FILE* edid_file = NULL; char *path = NULL; list = (struct findNode *) malloc(sizeof(struct findNode)); list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); list->result->path = NULL; list->result->next = list->result; minifind("/proc/device-tree", "EDID", list); for (n = list->result->next; n != list->result; n = n->next) { path = n->path; break; } if (path) edid_file = fopen(path, "rb"); if (edid_file) { int size = fread(edid, sizeof(unsigned char), 0x80, edid_file); fclose(edid_file); return size == 0x80 ? 0x80 : 0; } else return 0; #if 0 memcpy(&man, &ret->manufacturer_name, 2); 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); #endif }