diff options
author | Manuel Rüger <mrueg@gentoo.org> | 2013-07-10 09:46:21 +0000 |
---|---|---|
committer | Manuel Rüger <mrueg@gentoo.org> | 2013-07-10 09:46:21 +0000 |
commit | e530b9060879b85d215906afc85d2e066f08a860 (patch) | |
tree | 44b8f6ef2eedd957683af6242ca990b7c99e47c3 /app-misc/ddccontrol | |
parent | Remove bundled qbs (bug 476256). (diff) | |
download | historical-e530b9060879b85d215906afc85d2e066f08a860.tar.gz historical-e530b9060879b85d215906afc85d2e066f08a860.tar.bz2 historical-e530b9060879b85d215906afc85d2e066f08a860.zip |
Non-maintainer commit: Add support for fglrx (AMD ADL). Fix desktop file. See bug #475568
Package-Manager: portage-2.1.12.13/cvs/Linux x86_64
Diffstat (limited to 'app-misc/ddccontrol')
-rw-r--r-- | app-misc/ddccontrol/ChangeLog | 9 | ||||
-rw-r--r-- | app-misc/ddccontrol/Manifest | 14 | ||||
-rw-r--r-- | app-misc/ddccontrol/ddccontrol-0.4.2-r2.ebuild | 79 | ||||
-rw-r--r-- | app-misc/ddccontrol/files/ddccontrol-0.4.2-support-fglrx.patch | 606 |
4 files changed, 696 insertions, 12 deletions
diff --git a/app-misc/ddccontrol/ChangeLog b/app-misc/ddccontrol/ChangeLog index 8f5822fac674..c061a26c70f8 100644 --- a/app-misc/ddccontrol/ChangeLog +++ b/app-misc/ddccontrol/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-misc/ddccontrol # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-misc/ddccontrol/ChangeLog,v 1.31 2013/07/08 15:16:22 xmw Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-misc/ddccontrol/ChangeLog,v 1.32 2013/07/10 09:46:16 mrueg Exp $ + +*ddccontrol-0.4.2-r2 (10 Jul 2013) + + 10 Jul 2013; Manuel Rüger <mrueg@gentoo.org> +ddccontrol-0.4.2-r2.ebuild, + +files/ddccontrol-0.4.2-support-fglrx.patch: + Non-maintainer commit: Add support for fglrx (AMD ADL). Fix desktop file. + See bug #475568 08 Jul 2013; Michael Weber <xmw@gentoo.org> metadata.xml: remove errorneous herd proxy-maint. diff --git a/app-misc/ddccontrol/Manifest b/app-misc/ddccontrol/Manifest index abc85b0f4f9b..fbbd7db45106 100644 --- a/app-misc/ddccontrol/Manifest +++ b/app-misc/ddccontrol/Manifest @@ -1,11 +1,9 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - AUX ddccontrol-0.3-fix-libpanelapplet-dep.patch 690 SHA256 474770c3fb33a4ba29df7789de76fc1d8db0233abc098d50ca8373a9a7faf9cf SHA512 7a925cc801a779c7b2ed01e751053868224604dba5cde2eb30fa739bccf902a90c0b7b6952aa5e8f458b14ed5ea8dd73b0993acc8fb7170e6c0a8150162ce293 WHIRLPOOL 8c8063889d271498568786030028ad236e4fe83cef7afad9eb0371ee410461d727aa6fbd2544945e600d23d994b9eb8bbede6fb31684e2c3bda856a4ee21ac23 AUX ddccontrol-0.3-u64-conflicting-types.patch 488 SHA256 f460d99e18ebdaa053a7e962fe4bd121450649c10bba550653228bfad60eb3e4 SHA512 3e852c918c57a7fa8723637980e090857a8d9c4c74788151ed14372bdd1c7e2ac89c468c7f37abeeccd721ec1eaaaca1610bb3173dec7aaf9984311f30db4fe0 WHIRLPOOL b641816da042d612ec035259b4e99499b8291c22b826385cc3010f3c70e469cf6c8d11c8b6bec3e22aa3a36b0b0b2d401361770d0e9cba9ed71cf28e2a6c2a33 AUX ddccontrol-0.4.2-automake.patch 2149 SHA256 c31761783cfd9587fb68d94739794833a6f47789922017530de07fb1133f78b8 SHA512 93b731389bd8019aaae81201ce930d0b03fa80dde3a00970be804e90bff607d42746fe60d9162d99259e57f179e1e8e074b433d9877a7b6b41ce58aae2c47cbb WHIRLPOOL d408e442ddf4a10b2b8a7c3291b64cfdb718965f797c05a62a99aae4e614f74f109eb2580bd16147c95574536b17eddc698670ed0db66f232f2d5c8540266ae5 AUX ddccontrol-0.4.2-no-ddcpci.patch 289 SHA256 9f2d7dfa3446374bf06995096e8cb6812322a2144d4ce0b45a1df20553b72130 SHA512 a8e39707ed2c938e5a5a5f16cc43104289fb6d15d40e1acf15115c2685310132620a3d7e4e5ade0a5c32f253dc38497d9065ed6f6ac79ae42f8e47b100e0c7dd WHIRLPOOL d0df66ed7f87ceacd9faf710b859f518c9ba5d8298aa04f4a0cf40f3e0923716558a5985280f030ef7ee9b6e71b468d7b3c140607a017e2bbf83a57b3edf72a8 AUX ddccontrol-0.4.2-pciutils-libz.patch 1016 SHA256 014568b96f9450805e012d7dc5b0df0c4d3922694da4ad143bb96d429303fb9b SHA512 a3313aeca4ad4980aee656078d03c1755f390fe857c9dbcf890d951c52be6e6a9d7d17f82796da0ae329023ec69b5cc255d3f2455f4eb08eac4af5eb067e1708 WHIRLPOOL 1db877b4d05ec669dc42a1b10429efe69a851ff26594d809ae13452d97e7f513b7496e82d424948c5dcf2ebbda31d4333ed568cf87487184d8c7119496e7c5d3 +AUX ddccontrol-0.4.2-support-fglrx.patch 15900 SHA256 43db3565b8a2e8b527622436d8c6fd257053c93e2df9662c0e8f1a80526cf27f SHA512 4fc7321d28b7d17bcc0c3611e77d3fdcdbe46878ee757e84f2145668fceab4c5054b805b9d96a798ba4346b0b9936301e2ae7e1f7ab7e03d37a0f3dd00b18222 WHIRLPOOL 0639519b0708d1414b431661aa1cec9e8c90eca3ac9402a742af9b9509804465785461ce006c942e9c5073dc8778e090a15dcfc815c0063a1ed73a5e0cd25b46 AUX ddccontrol-asneeded.patch 582 SHA256 35e3abd8e73f9febb480ccb42a0c0fd1c404ee91a6d04713da3541901cc360bd SHA512 c0a99fea88ceaf88d4c59dd95541d7da594e4af75b52061aadca6b5a3f28c49c0d8118b208d55ad78c51d85df2f697ea37da88ac2297a31d793844b3428b957c WHIRLPOOL 0e9d3c66556b9628ed0ff03f32ed2a95ecef77c9c70f274440a643fdc34945b01cb87e154de1ab590217178cebb69924ad0c6b1461943b186c384a51ecee63df DIST ddccontrol-0.1.3.tar.gz 251097 SHA256 fb0a77be11c34dc44554315d90e56372e7c87f1fb78feb05f9228d205c4cfe9b SHA512 0455192f858594780bddbd85cc4e2e6e78677ef87768c8a34a4496b6ef6b72a94937eedd13d478c0310b7b66ea13f3e6e499798a4bb5e018ee0b5f0c307aa0c9 WHIRLPOOL f4aa4b033169baf1b96a1bb5bf8c0e19ef088d354eba9eecbda6038ffa3a8be1f1ee3c9cad345716fe615597243bc2fa344562fe83fe763946c7a7bacf9dccb4 DIST ddccontrol-0.2.tar.gz 275071 SHA256 affdbde179aa762c02eae66da14dac44e2ee93420ba9aa85cef1ba3c859cee5e SHA512 aa7840fddee880079584f70d543715d219d8fd0af5bf504ae8f33656fe901b1c382b2e0aba2eeb67dbdf078056c233caac96889e19be3cf76759f3d2c2372fde WHIRLPOOL 2d67e7f0d1fd543283b7929097fe8a8f0b58e01c3ab778a45fa09b3ab7924c75106ee47af2568c99a728a67297e2fa36a4511dcdbd4e63ba5e6e1c4cb8f5be02 @@ -19,13 +17,7 @@ EBUILD ddccontrol-0.3-r2.ebuild 1551 SHA256 907d04575e7cd5f4b7573770d149bed2f10d EBUILD ddccontrol-0.3.ebuild 1342 SHA256 b49987fb33a1d0dfcc12f623dc9367dba002f331fcc2c9246ec5b03504305850 SHA512 30a7a9efb4493f27ba71079eca68c5e79b8c9728471453085794259424d5cdf49a2e70d7dc87f9b4bbcfe644d3f142c2745651a45bc3867aae1304e445bb6887 WHIRLPOOL 5c8eb7e33212b95f2be79367955ccb5a8946ac7e60c143b5db099f9fab727c36f0deca43ca2d2d06d429ddbb2b0f11bf1217f1f8d41aa19bac24a596151ee70e EBUILD ddccontrol-0.4.1.ebuild 1429 SHA256 e2a81b1c60e17348136fbaaa955b37a5cfa8a1ab551024f3e3f5b85231ae8118 SHA512 e9bf8cd04df9c003051c0b329189ddc558166ac88e851f1b3c4fb415cfcb96150da965d349055b4cdc2e23a060ba89b43d17ff17cdb20cfdc1b8e6e5c0959733 WHIRLPOOL 5aea5437cc9b930363a94eae92f81aaf7adb9e0e580fbeac73e56d66b81853fe0c1c5e6378b585ba9b44337198fb3405fbb26ded82404214112985c331e27067 EBUILD ddccontrol-0.4.2-r1.ebuild 1892 SHA256 5ba45c7a3280e424159c9fa3ce653be4397b1bbe78f7a2bb06bc85d137c6eb50 SHA512 9774699b73458a9b57a562eae67a107f7aeedcfc3d1b706956a69a041ab104b4cc327681b14e54a841c62721f15168959c12cffb15e08f2f8644cf26c24f3870 WHIRLPOOL a57531236c2dfb7eab18b18325a9e215dd97bc1c6be8b0e3f1e618a2bd2f4676308154a0f69849def45b75973f7f5708b963f267b0f8050bf147d4b4cd260c47 +EBUILD ddccontrol-0.4.2-r2.ebuild 2120 SHA256 df533d2bda11edd7969258b66e64f4c8a8801d6d9c75a88a99b5bc97fcfebfd5 SHA512 aba2bc31fedb0e543887434048f23aa56dbfd961683d244cea956163bff2713788b4366c7d1cb97afa0b51bfddfd4c9ccf4796e0412cb1d52d9dee1d4bea04c4 WHIRLPOOL 4ef48251dbca395c5fae75c14636f2588576bc750a4505c6549d67ec1ba6e1685b728137733778ab3f2f4f349683084bad653eb7ea11ff10ed20e22f13686787 EBUILD ddccontrol-0.4.2.ebuild 2018 SHA256 a4bb0a0ef3cdb24e41affe12d24a5110c030a96dcd2445872b264af96cdfaffb SHA512 be0b4d8c23e43ed03d5299a595338f6f9af6ee70c842b5826cd6cd9e3883b54f3384074ff5a603b5eba95ae82c00f1a07b010b48e92a2f76fba1582026d6a29a WHIRLPOOL 83ea6a43c66a4d4fb6912583afa3f7b9f86eb464ed0cd21db5f7b2cd3b17dd9df2ed46bfb07297e68a27cb428b7afdaea3dbac6f201e99b56085944d9b43cff6 -MISC ChangeLog 4954 SHA256 240a12f1baa5e33ad0c83fbf6fd27cbf59149f4fd8fa1117309bb8b1485761ae SHA512 8c6ee455f3cf36547c4a077df212f9a2f013a48b984e0940535329b934658f4cf16d932eb919de4ef66cbf11d660a5e6fcbdfe2db1ac54cc857c269f79380e8b WHIRLPOOL a676d8d60be0ad2b4f12ae5328989a94ad25a97298398f5f073393a47c91184e847b614fa22cf59641205c6a9b7068c48186a14cdb0911adc47b24e0033e85a1 +MISC ChangeLog 5211 SHA256 c33ba91925a304f6a825dfcff32e79ff7544a55c1f516bc52449d803eecba061 SHA512 3ddf199a09318cd70a4828e11b5988b6c401a152602466fed8225ebe8e1a99ed02c105ddd124ca5f083f715a51001f5f75c33120e2544b11cb8307060ec7e122 WHIRLPOOL 821580b1ff85a8cee718f64eb1df069a1c971e6d9ef42e6ea91a106604ce5e5bae1e46364d2c0ca7b333d1db66b4e2a4de0bfa4d6527411a3ea941528b88124e MISC metadata.xml 479 SHA256 3cc5d472e421e987e7028da0aa8feb0a783ce08d4eef8dd98d88ccce1bff7324 SHA512 44ddb27f5272b20906f2654dac670fc16dde4fe61fec62cdae2f8dea860a7f7a0e07bfd463a80038cbc0e817238f6f0c9555eea07ecb0b9c477c82c2753c5b7c WHIRLPOOL 283281bebd738af8dd774811d775d65cdf34be5dbd3167cb3a7d825065609f85618770694a505394f4162107d96b75caa1a569f9839038f37b9dbea09d20b5a7 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.20 (GNU/Linux) - -iF4EAREIAAYFAlHa18kACgkQknrdDGLu8JCMpwD/dBwi6T1YtzhyG0P7Pxt7kbcC -DJWGukedpprVxlJ8sRYA/ibPfVzEwAKUqYkrLxnCHkofF/sfTKI8eSIo0R4yg7Wg -=lLfs ------END PGP SIGNATURE----- diff --git a/app-misc/ddccontrol/ddccontrol-0.4.2-r2.ebuild b/app-misc/ddccontrol/ddccontrol-0.4.2-r2.ebuild new file mode 100644 index 000000000000..ba607650aefb --- /dev/null +++ b/app-misc/ddccontrol/ddccontrol-0.4.2-r2.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/ddccontrol/ddccontrol-0.4.2-r2.ebuild,v 1.1 2013/07/10 09:46:16 mrueg Exp $ + +EAPI=5 + +inherit eutils autotools + +DESCRIPTION="DDCControl allows control of monitor parameters via DDC" +HOMEPAGE="http://ddccontrol.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="+ddcpci doc gnome gtk nls static-libs video_cards_fglrx" + +RDEPEND=">=app-misc/ddccontrol-db-20060730 + dev-libs/libxml2:2 + sys-apps/pciutils + gtk? ( >=x11-libs/gtk+-2.4:2 ) + gnome? ( >=gnome-base/gnome-panel-2.10 ) + nls? ( sys-devel/gettext ) + video_cards_fglrx? ( x11-libs/amd-adl-sdk )" +DEPEND="${RDEPEND} + dev-perl/XML-Parser + dev-util/intltool + sys-kernel/linux-headers + doc? ( >=app-text/docbook-xsl-stylesheets-1.65.1 + >=dev-libs/libxslt-1.1.6 + app-text/htmltidy )" + +src_prepare() { + epatch "${FILESDIR}"/${P}-pciutils-libz.patch \ + "${FILESDIR}"/${P}-automake.patch \ + "${FILESDIR}"/${P}-no-ddcpci.patch \ + "${FILESDIR}"/${P}-support-fglrx.patch + + sed -i '/^htmldir/d' doc/Makefile.am || die + + sed -i '/;Application/d' src/gddccontrol/gddccontrol.desktop.in || die + + # ppc/ppc64 do not have inb/outb/ioperm + # they also do not have (sys|asm)/io.h + if ! use amd64 && ! use x86 ; then + local card + for card in sis intel810 ; do + sed -r -i \ + -e "/${card}.Po/d" \ + -e "s~${card}[^[:space:]]*~ ~g" \ + src/ddcpci/Makefile.{am,ini} || die + done + sed -i \ + -e '/sis_/d' \ + -e '/i810_/d' \ + src/ddcpci/main.c || die + fi + + ## Save for a rainy day or future patching + eautoreconf + intltoolize --force || die "intltoolize failed" +} + +src_configure() { + econf \ + --htmldir='$(datarootdir)'/doc/${PF}/html \ + $(use_enable ddcpci) \ + $(use_enable doc) \ + $(use_enable gnome gnome-applet) \ + $(use_enable gtk gnome) \ + $(use_enable nls) \ + $(use_enable static-libs static) \ + $(use_enable video_cards_fglrx amdadl) +} + +src_install() { + default + use static-libs || find "${ED}" -name '*.la' -delete +} diff --git a/app-misc/ddccontrol/files/ddccontrol-0.4.2-support-fglrx.patch b/app-misc/ddccontrol/files/ddccontrol-0.4.2-support-fglrx.patch new file mode 100644 index 000000000000..565d1928fdd7 --- /dev/null +++ b/app-misc/ddccontrol/files/ddccontrol-0.4.2-support-fglrx.patch @@ -0,0 +1,606 @@ +Source: http://sourceforge.net/mailarchive/message.php?msg_id=30201548 +Author: Vitaly V. BUrsov (vitaly@bursov.com) +Date: 2013-01-16 + +diff --git a/src/lib/amd_adl.c b/src/lib/amd_adl.c +new file mode 100644 +index 0000000..40ca909 +--- /dev/null ++++ b/src/lib/amd_adl.c +@@ -0,0 +1,306 @@ ++/* ++ ddc/ci interface functions header ++ Copyright(c) 2012 Vitaly V. Bursov (vitaly@bursov.com) ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++*/ ++ ++#include "config.h" ++ ++#ifdef HAVE_AMDADL ++#include <errno.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <fcntl.h> ++#include <string.h> ++#include <unistd.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <stdint.h> ++#include <dlfcn.h> ++ ++#define MAX_DISPLAYS (64) ++ ++#ifndef LINUX ++#define LINUX /* not Windows */ ++#endif ++#include <ADL/adl_sdk.h> ++ ++#include "amd_adl.h" ++#include "ddcci.h" ++ ++#if 1 ++# define D(x) ++#else ++# define D(x) x ++#endif ++ ++struct adl_state { ++ int initialized; ++ ++ void *lib; ++ ++ int (*ADL_Main_Control_Create)(ADL_MAIN_MALLOC_CALLBACK, int ); ++ int (*ADL_Main_Control_Destroy)(); ++ ++ int (*ADL_Adapter_NumberOfAdapters_Get)(int *lpNumAdapters); ++ int (*ADL_Adapter_AdapterInfo_Get)(LPAdapterInfo lpInfo, int iInputSize); ++ int (*ADL_Display_NumberOfDisplays_Get)(int iAdapterIndex, int *lpNumDisplays); ++ int (*ADL_Display_DisplayInfo_Get)(int iAdapterIndex, int *lpNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect); ++ int (*ADL_Display_DDCBlockAccess_Get)(int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex, int iSendMsgLen, char *lpucSendMsgBuf, int *lpulRecvMsgLen, char *lpucRecvMsgBuf); ++ ++ struct _displays { ++ int adapter_index; ++ int display_index; ++ } displays[MAX_DISPLAYS]; ++ int displays_count; ++}; ++ ++static struct adl_state *adl; ++ ++static void* __stdcall adl_malloc (int size) ++{ ++ void* buffer = malloc (size); ++ if (buffer) ++ memset(buffer, 0, size); ++ return buffer; ++} ++ ++static void __stdcall adl_free ( void **buffer ) ++{ ++ if (*buffer != NULL) { ++ free (*buffer); ++ *buffer = NULL; ++ } ++} ++ ++int amd_adl_get_displays_count() ++{ ++ if (!adl->initialized) ++ return -1; ++ ++ return adl->displays_count; ++} ++ ++int amd_adl_get_display(int idx, int *adapter, int *display) ++{ ++ if (!adl->initialized) ++ return -1; ++ ++ if (idx < 0 || idx >= adl->displays_count) ++ return -1; ++ ++ if (adapter) ++ *adapter = adl->displays[idx].adapter_index; ++ if (display) ++ *display = adl->displays[idx].display_index; ++ ++ return 0; ++} ++ ++int amd_adl_check_display(int adapter, int display) ++{ ++ int i; ++ ++ if (!adl->initialized) ++ return -1; ++ ++ for (i=0;i<adl->displays_count;i++){ ++ if (adl->displays[i].adapter_index == adapter && ++ adl->displays[i].display_index == display) ++ return 0; ++ } ++ return -1; ++} ++ ++int amd_adl_i2c_read(int adapter, int display, unsigned int addr, unsigned char *buf, unsigned int len) ++{ ++ int res; ++ char wbuf = addr << 1 | 1; ++ ++ res = adl->ADL_Display_DDCBlockAccess_Get(adapter, display, 0, 0, 1, &wbuf, (int*)&len, (char*)buf); ++ ++ D(fprintf(stderr, " >>>>>>>> adl i2c r on %d:%d a %x l %d err %d\n", adapter, display, addr, len, res)); ++ ++ if (res != ADL_OK){ ++ return -1; ++ } ++ ++ return len; ++} ++ ++int amd_adl_i2c_write(int adapter, int display, unsigned int addr, unsigned char *buf, unsigned int len) ++{ ++ int res, rlen; ++ char *wbuf = alloca(len+1); ++ ++ wbuf[0] = addr << 1; ++ memcpy(&wbuf[1], buf, len); ++ ++ rlen = 0; ++ res = adl->ADL_Display_DDCBlockAccess_Get(adapter, display, 0, 0, len+1, wbuf, &rlen, NULL); ++ ++ D(fprintf(stderr, " >>>>>>>> adl i2c w on %d:%d a %x l %d err %d\n", adapter, display, addr, len, res)); ++ ++ if (res != ADL_OK){ ++ return -1; ++ } ++ ++ return len; ++} ++ ++ ++int amd_adl_init() ++{ ++ int i; ++ int res; ++ int adapters_count; ++ AdapterInfo *adapter_info; ++ ++ adl = adl_malloc(sizeof(struct adl_state)); ++ ++ if (!adl){ ++ fprintf(stderr, "ADL error: malloc failed\n"); ++ return 0; ++ } ++ ++ adl->lib = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL); ++ if (!adl->lib){ ++ if (get_verbosity()) ++ perror("ADL error: dlopen() failed\n"); ++ return 0; ++ } ++#define LOADFUNC(_n_) \ ++ do { \ ++ adl->_n_ = dlsym(adl->lib, #_n_); \ ++ if (!adl->_n_) { \ ++ fprintf(stderr, "ADL error: loading symbol %s\n", #_n_); \ ++ return 0; \ ++ } \ ++ } while (0) ++ ++ LOADFUNC(ADL_Main_Control_Create); ++ LOADFUNC(ADL_Main_Control_Destroy); ++ ++ LOADFUNC(ADL_Adapter_NumberOfAdapters_Get); ++ LOADFUNC(ADL_Adapter_AdapterInfo_Get); ++ LOADFUNC(ADL_Display_NumberOfDisplays_Get); ++ LOADFUNC(ADL_Display_DisplayInfo_Get); ++ LOADFUNC(ADL_Display_DDCBlockAccess_Get); ++ ++#undef LOADFUNC ++ ++ res = adl->ADL_Main_Control_Create(adl_malloc, 1); // retrieve adapter information only for adapters that are physically present and enabled ++ ++ if (res != ADL_OK){ ++ if (get_verbosity()) ++ fprintf(stderr, "Failed to initialize ADL: %d\n", res); ++ return 0; ++ } ++ ++ res = adl->ADL_Adapter_NumberOfAdapters_Get(&adapters_count); ++ if (res != ADL_OK){ ++ if (get_verbosity()) ++ fprintf(stderr, "Failed to get number of ADL adapters: %d\n", res); ++ return 0; ++ } ++ ++ if (adapters_count < 1){ ++ if (get_verbosity()) ++ fprintf(stderr, "No ADL adapters found.\n"); ++ return 0; ++ } ++ ++ adapter_info = adl_malloc(sizeof(AdapterInfo) * adapters_count); ++ if (!adapter_info){ ++ fprintf(stderr, "ADL error: malloc failed\n"); ++ return 0; ++ } ++ ++ res = adl->ADL_Adapter_AdapterInfo_Get(adapter_info, sizeof(AdapterInfo) * adapters_count); ++ if (res != ADL_OK){ ++ fprintf(stderr, "Failed to get ADL adapters info: %d\n", res); ++ return 0; ++ } ++ ++ for (i=0;i<adapters_count;i++){ ++ int aidx = adapter_info[i].iAdapterIndex; ++ int numdisplays; ++ int j; ++ ADLDisplayInfo *display_info; ++ ++ if (adl->ADL_Display_DisplayInfo_Get(aidx, &numdisplays, &display_info, 0) != ADL_OK) ++ continue; ++ ++ D(printf("\t ================================\n")); ++ D(printf("\t %d: %s - %s %d %x:%x.%x %s\n", adapter_info[i].iAdapterIndex, adapter_info[i].strAdapterName, adapter_info[i].strDisplayName, ++ adapter_info[i].iPresent, ++ adapter_info[i].iBusNumber, ++ adapter_info[i].iDeviceNumber, ++ adapter_info[i].iFunctionNumber, ++ adapter_info[i].strUDID)); ++ ++ for (j=0;j<numdisplays;j++){ ++ int didx; ++ ++ if ((display_info[j].iDisplayInfoValue & ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED) && ++ (display_info[j].iDisplayInfoValue & ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED)){ ++ ++ didx = display_info[j].displayID.iDisplayLogicalIndex; ++ ++ D(printf("\t\t found display %s at %d:%d\n", ++ display_info[j].strDisplayName, aidx, didx)); ++ ++ adl->displays[adl->displays_count].adapter_index = aidx; ++ adl->displays[adl->displays_count].display_index = didx; ++ adl->displays_count++; ++ if (adl->displays_count >= MAX_DISPLAYS){ ++ break; ++ } ++ } ++ } ++ ++ adl_free((void**)&display_info); ++ ++ if (adl->displays_count >= MAX_DISPLAYS){ ++ break; ++ } ++ } ++ ++ adl_free((void**)&adapter_info); ++ ++ D(fprintf(stderr, "adl initialized, %d displays\n", adl->displays_count)); ++ ++ adl->initialized = 1; ++ return 1; ++} ++ ++void amd_adl_free() ++{ ++ if (!adl) ++ return; ++ ++ adl->ADL_Main_Control_Destroy(); ++ ++ if (adl->lib){ ++ dlclose(adl->lib); ++ adl->lib = NULL; ++ } ++ ++ adl_free((void**)&adl); ++} ++ ++#endif /* HAVE_AMDADL */ ++ +diff --git a/src/lib/amd_adl.h b/src/lib/amd_adl.h +new file mode 100644 +index 0000000..d6c7bc1 +--- /dev/null ++++ b/src/lib/amd_adl.h +@@ -0,0 +1,33 @@ ++/* ++ ddc/ci interface functions header ++ Copyright(c) 2012 Vitaly V. Bursov (vitaly@bursov.com) ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++*/ ++ ++#ifndef AMD_ADL_H ++#define AMD_ADL_H ++ ++int amd_adl_init(); ++void amd_adl_free(); ++ ++int amd_adl_get_displays_count(); ++int amd_adl_get_display(int idx, int *adapter, int *display); ++int amd_adl_check_display(int adapter, int display); ++ ++int amd_adl_i2c_read(int adapter, int display, unsigned int addr, unsigned char *buf, unsigned int len); ++int amd_adl_i2c_write(int adapter, int display, unsigned int addr, unsigned char *buf, unsigned int len); ++ ++#endif /* AMD_ADL_H */ +diff --git a/src/lib/ddcci.c b/src/lib/ddcci.c +index 4492df5..186d597 100644 +--- a/src/lib/ddcci.c ++++ b/src/lib/ddcci.c +@@ -38,6 +38,7 @@ + #include <sys/stat.h> + + #include "ddcci.h" ++#include "amd_adl.h" + + #include "conf.h" + +@@ -239,12 +240,22 @@ int ddcci_init(char* usedatadir) + printf(_("Failed to initialize ddccontrol database...\n")); + return 0; + } ++#ifdef HAVE_AMDADL ++ if (!amd_adl_init()){ ++ if (verbosity) { ++ printf(_("Failed to initialize ADL...\n")); ++ } ++ } ++#endif + return ddcpci_init(); + } + + void ddcci_release() { + ddcpci_release(); + ddcci_release_db(); ++#ifdef HAVE_AMDADL ++ amd_adl_free(); ++#endif + } + + /* write len bytes (stored in buf) to i2c address addr */ +@@ -318,6 +329,12 @@ static int i2c_write(struct monitor* mon, unsigned int addr, unsigned char *buf, + return adata.status; + } + #endif ++#ifdef HAVE_AMDADL ++ case type_adl: ++ { ++ return amd_adl_i2c_write(mon->adl_adapter, mon->adl_display, addr, buf, len); ++ } ++#endif + default: + return -1; + } +@@ -396,6 +413,12 @@ static int i2c_read(struct monitor* mon, unsigned int addr, unsigned char *buf, + return ret - ANSWER_SIZE; + } + #endif ++#ifdef HAVE_AMDADL ++ case type_adl: ++ { ++ return amd_adl_i2c_read(mon->adl_adapter, mon->adl_display, addr, buf, len); ++ } ++#endif + default: + return -1; + } +@@ -929,6 +952,23 @@ static int ddcci_open_with_addr(struct monitor* mon, const char* filename, int a + mon->type = pci; + } + #endif ++#ifdef HAVE_AMDADL ++ else if (strncmp(filename, "adl:", 4) == 0) { ++ mon->adl_adapter = -1; ++ mon->adl_display = -1; ++ if (sscanf(filename, "adl:%d:%d", &mon->adl_adapter, &mon->adl_display) != 2){ ++ fprintf(stderr, _("Invalid filename (%s).\n"), filename); ++ return -3; ++ } ++ ++ if (amd_adl_check_display(mon->adl_adapter, mon->adl_display)){ ++ fprintf(stderr, _("ADL display not found (%s).\n"), filename); ++ return -3; ++ } ++ ++ mon->type = type_adl; ++ } ++#endif + else { + fprintf(stderr, _("Invalid filename (%s).\n"), filename); + return -3; +@@ -1167,6 +1207,28 @@ struct monitorlist* ddcci_probe() { + + closedir(dirp); + ++#ifdef HAVE_AMDADL ++ /* ADL probe */ ++ int adl_disp; ++ ++ for (adl_disp=0; adl_disp<amd_adl_get_displays_count(); adl_disp++){ ++ int adapter, display; ++ if (amd_adl_get_display(adl_disp, &adapter, &display)) ++ break; ++ ++ filename = malloc(64); ++ snprintf(filename, 64, "adl:%d:%d", adapter, display); ++ if (verbosity) { ++ printf(_("Found ADL display (%s)\n"), filename); ++ } ++ ddcci_probe_device(filename, ¤t, &last); ++ if (!verbosity) { ++ printf("."); ++ fflush(stdout); ++ } ++ } ++#endif ++ + if (!verbosity) + printf("\n"); + +diff --git a/src/lib/ddcci.h b/src/lib/ddcci.h +index c058051..cac907b 100644 +--- a/src/lib/ddcci.h ++++ b/src/lib/ddcci.h +@@ -63,6 +63,9 @@ struct caps { + struct monitor { + int fd; + unsigned int addr; ++#ifdef HAVE_AMDADL ++ int adl_adapter, adl_display; ++#endif + char pnpid[8]; + unsigned char digital; /* 0 - digital, 1 - analog */ + struct timeval last; +@@ -76,6 +79,9 @@ struct monitor { + #ifdef HAVE_DDCPCI + ,pci + #endif ++#ifdef HAVE_AMDADL ++ ,type_adl ++#endif + } type; + int probing; /* are we probing? */ + diff --git a/configure.ac b/configure.ac +index 8ee47f3..79e831e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -112,6 +112,39 @@ fi + + AC_SUBST([DDCPCI]) + ++# AMD ADL support check ++support_amdadl= ++AC_ARG_ENABLE(amdadl, ++ [ --enable-amdadl enable AMD Display Library support (autodetect) ], ++ [if test x$enableval = xno; then ++ support_amdadl=no ++ else ++ support_amdadl=yes ++ fi]) ++ ++AMDADL= ++if test x$support_amdadl = xyes; then ++ AC_CHECK_HEADERS([ADL/adl_sdk.h], [], [AC_MSG_ERROR([ADL headers not found, but ADL support requested.], [1])], ++ [#ifndef __stdcall ++ #define __stdcall ++ #endif ++ ]) ++ AMDADL=amdadl ++elif test x$support_amdadl = x; then ++ AC_CHECK_HEADERS([ADL/adl_sdk.h], [ ++ AMDADL=amdadl ++ ], [], [#ifndef __stdcall ++ #define __stdcall ++ #endif ++ ]) ++fi ++ ++if test x$AMDADL = xamdadl; then ++ AC_DEFINE_UNQUOTED(HAVE_AMDADL, 1, [Define if ddccontrol is built with ADL support.]) ++fi ++ ++AC_SUBST([AMDADL]) ++ + # Gnome check + support_gnome=yes + AC_ARG_ENABLE(gnome, +diff --git a/src/config.h.in b/src/config.h.in +index 971ec71..e0f31c6 100644 +--- a/src/config.h.in ++++ b/src/config.h.in +@@ -4,6 +4,12 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to 1 if you have the <ADL/adl_sdk.h> header file. */ ++#undef HAVE_ADL_ADL_SDK_H ++ ++/* Define if ddccontrol is built with ADL support. */ ++#undef HAVE_AMDADL ++ + /* Define if linux/i2c-dev.h is buggy on your system, so defaults constants + and structures must be used */ + #undef HAVE_BUGGY_I2C_DEV +@@ -41,7 +47,7 @@ + /* Define if ddccontrol is built with /dev/i2c-* support. */ + #undef HAVE_I2C_DEV + +-/* Define if you have the iconv() function. */ ++/* Define if you have the iconv() function and it works. */ + #undef HAVE_ICONV + + /* Define to 1 if you have the <inttypes.h> header file. */ +@@ -50,6 +56,9 @@ + /* Define to 1 if you have the `pci' library (-lpci). */ + #undef HAVE_LIBPCI + ++/* Define to 1 if you have the `z' library (-lz). */ ++#undef HAVE_LIBZ ++ + /* Define to 1 if you have the <linux/types.h> header file. */ + #undef HAVE_LINUX_TYPES_H + +@@ -89,6 +98,10 @@ + /* Define to 1 if you have the <unistd.h> header file. */ + #undef HAVE_UNISTD_H + ++/* Define to the sub-directory in which libtool stores uninstalled libraries. ++ */ ++#undef LT_OBJDIR ++ + /* Name of package */ + #undef PACKAGE + +@@ -104,6 +117,9 @@ + /* Define to the one symbol short name of this package. */ + #undef PACKAGE_TARNAME + ++/* Define to the home page for this package. */ ++#undef PACKAGE_URL ++ + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + +diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am +index ce18dcf..775629e 100644 +--- a/src/lib/Makefile.am ++++ b/src/lib/Makefile.am +@@ -11,6 +11,7 @@ $(pkgconfig_DATA): $(srcdir)/ddccontrol.pc.in $(top_builddir)/config.status + lib_LTLIBRARIES = libddccontrol.la + + libddccontrol_la_SOURCES = ddcci.c ddcci.h monitor_db.c monitor_db.h \ +- ddcpci-ipc.h i2c-dev.h conf.c conf.h ++ ddcpci-ipc.h i2c-dev.h conf.c conf.h amd_adl.c amd_adl.h ++ + libddccontrol_la_LIBADD = $(LIBXML2_LDFLAGS) + AM_CFLAGS = $(LIBXML2_CFLAGS) |