Add a port of read-edid utility, a pair of tools for reading the EDID from

a monitor.  It is mostly useful to read LCD matrix manufacturer and model.

WWW: http://www.polypux.org/projects/read-edid/

NB: TIMESTAMP line in distinfo should read as follows, but has to stay in
its current form due to a bug in the hook script:
TIMESTAMP (read-edid-3.0.2.tar.gz) = 1430271430
This commit is contained in:
Alexey Dokuchaev
2016-08-20 18:43:29 +00:00
parent 95fbc921f8
commit 73966541c1
9 changed files with 128 additions and 0 deletions

View File

@@ -888,6 +888,7 @@
SUBDIR += rdiff-backup
SUBDIR += rdiff-backup-devel
SUBDIR += rdup
SUBDIR += read-edid
SUBDIR += realsync
SUBDIR += recoverdm
SUBDIR += reed

View File

@@ -0,0 +1,19 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
# $FreeBSD$
PORTNAME= read-edid
PORTVERSION= 3.0.2
CATEGORIES= sysutils
MASTER_SITES= http://www.polypux.org/projects/${PORTNAME}/
MAINTAINER= danfe@FreeBSD.org
COMMENT= Tools for reading the EDID from a monitor
LIB_DEPENDS= libx86.so:devel/libx86
USES= cmake localbase
PLIST_FILES= bin/get-edid bin/parse-edid man/man1/get-edid.1.gz
PORTDOCS= AUTHORS ChangeLog LICENSE README
.include <bsd.port.mk>

View File

@@ -0,0 +1,3 @@
TIMESTAMP = 1430271430
SHA256 (read-edid-3.0.2.tar.gz) = c7c6d8440f5b90f98e276829271ccea5b2ff5a3413df8a0f87ec09f834af186f
SIZE (read-edid-3.0.2.tar.gz) = 17508

View File

@@ -0,0 +1,11 @@
--- CMakeLists.txt.orig 2014-02-05 16:27:26 UTC
+++ CMakeLists.txt
@@ -12,6 +12,6 @@ if (I2CBUILD OR CLASSICBUILD)
endif ()
add_subdirectory (parse-edid)
-INSTALL(FILES get-edid.1 DESTINATION share/man/man1)
-INSTALL(FILES AUTHORS ChangeLog COPYING README DESTINATION
+INSTALL(FILES get-edid.1 DESTINATION man/man1)
+INSTALL(FILES AUTHORS ChangeLog LICENSE README DESTINATION
share/doc/read-edid)

View File

@@ -0,0 +1,34 @@
--- get-edid/classic.c.orig 2015-04-29 01:08:34 UTC
+++ get-edid/classic.c
@@ -1,12 +1,12 @@
/* (c) 2000,2001,2002 John Fremlin */
/* (c) 2010,2011 Matthew Kern */
#ifdef CLASSICBUILD
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/io.h>
#include <unistd.h>
#include <libx86.h>
@@ -135,8 +135,17 @@ classicmain( unsigned contr, int qit )
return 10;
}
+#if defined(__linux__)
ioperm(0, 0x400 , 1);
iopl(3);
+#elif defined(__FreeBSD__)
+#define DEV_IO_PATH "/dev/io"
+ if (open(DEV_IO_PATH, O_RDONLY) < 0) {
+ display("%s(): failed to open %s\n", __func__, DEV_IO_PATH);
+ return 11;
+ }
+#undef DEV_IO_PATH
+#endif
/*if ( argc == 1 )

View File

@@ -0,0 +1,21 @@
--- get-edid/i2c-dev.h.orig 2011-10-04 19:57:18 UTC
+++ get-edid/i2c-dev.h
@@ -25,9 +25,17 @@
#ifndef LIB_I2CDEV_H
#define LIB_I2CDEV_H
-#include <linux/types.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
+#if defined(__FreeBSD__)
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+#endif
/* -- i2c.h -- */

View File

@@ -0,0 +1,17 @@
--- get-edid/i2c.c.orig 2014-11-21 11:52:13 UTC
+++ get-edid/i2c.c
@@ -24,7 +24,13 @@ int open_i2c_dev(int i2cbus) {
char filename[16];
unsigned long funcs;
- sprintf(filename, "/dev/i2c-%d", i2cbus);
+ sprintf(filename,
+#if defined(__linux__)
+ "/dev/i2c-%d",
+#elif defined(__FreeBSD__)
+ "/dev/iic%d",
+#endif
+ i2cbus);
i2cfile = open(filename, O_RDWR);
if (i2cfile < 0 && errno == ENOENT) {

View File

@@ -0,0 +1,9 @@
read-edid is a pair of tools (originally by John Fremlin) for reading the
EDID from a monitor. It should work with most monitors made since 1996,
assuming the video card supports the standard read commands (most do).
Two tools are provided: get-edid, which gets the raw EDID information from
the monitor, and parse-edid, which turns the raw binary information into a
xorg.conf-compatible monitor section (or xrandr-compatible modelines).
WWW: http://www.polypux.org/projects/read-edid/

View File

@@ -0,0 +1,13 @@
FreeBSD has mapping at zero address feature turned off since 8.0-RC2:
http://security.freebsd.org/advisories/FreeBSD-EN-09:05.null.asc
This is required to read EDID data via classical VBE interface (to avoid
"mmap /dev/mem: Invalid argument" message from libx86). To temporarily
disable this protection, issue the following command:
# sysctl security.bsd.map_at_zero=1
To return to secure state:
# sysctl security.bsd.map_at_zero=0