From 29f84e2b8785585885e0658bdf9938967547460f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 29 Apr 2021 11:03:38 +0200 Subject: Remove Monitor / EDID code that was used for the swaroop variant. --- src/lib/config.h | 1 - src/lib/edid.cc | 134 ------------------------------------------------------- src/lib/edid.h | 50 --------------------- src/lib/wscript | 1 - 4 files changed, 186 deletions(-) delete mode 100644 src/lib/edid.cc delete mode 100644 src/lib/edid.h (limited to 'src/lib') diff --git a/src/lib/config.h b/src/lib/config.h index da29a8955..166267124 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -27,7 +27,6 @@ #include "types.h" #include "state.h" -#include "edid.h" #include "audio_mapping.h" #include #include diff --git a/src/lib/edid.cc b/src/lib/edid.cc deleted file mode 100644 index a530b8e38..000000000 --- a/src/lib/edid.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic 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. - - DCP-o-matic 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 DCP-o-matic. If not, see . - -*/ - -#include "compose.hpp" -#include "edid.h" -#include "warnings.h" -#include -DCPOMATIC_DISABLE_WARNINGS -#include -DCPOMATIC_ENABLE_WARNINGS -#include -#include -#include - -#define EDID_SYS_PATH "/sys/class/drm" -static uint8_t const edid_header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; - -using std::vector; -using std::string; -using std::cout; - -vector -get_monitors() -{ - using namespace boost::filesystem; - using namespace boost::algorithm; - - vector monitors; - - int card = 0; - while (true) { - path card_dir = String::compose("%1/card%2", EDID_SYS_PATH, card); - if (!is_directory(card_dir)) { - break; - } - - for (directory_iterator i = directory_iterator(card_dir); i != directory_iterator(); ++i) { - if (!starts_with(i->path().filename().string(), String::compose("card%1", card))) { - continue; - } - - FILE* edid_file = fopen(path(i->path() / "edid").string().c_str(), "r"); - if (!edid_file) { - continue; - } - - uint8_t edid[128]; - int const N = fread(edid, 1, sizeof(edid), edid_file); - fclose(edid_file); - if (N != 128) { - continue; - } - - if (memcmp(edid, edid_header, 8) != 0) { - continue; - } - - Monitor mon; - - uint16_t mid = (edid[8] << 8) | edid[9]; - mon.manufacturer_id += char(((mid >> 10) & 0x1f) + 'A' - 1); - mon.manufacturer_id += char(((mid >> 5) & 0x1f) + 'A' - 1); - mon.manufacturer_id += char(((mid >> 0) & 0x1f) + 'A' - 1); - - mon.manufacturer_product_code = (edid[11] << 8) | edid[10]; - - mon.serial_number = (edid[15] << 24) | (edid[14] << 16) | (edid[13] << 8) | edid[12]; - mon.week_of_manufacture = edid[16]; - mon.year_of_manufacture = edid[17]; - monitors.push_back (mon); - } - - ++card; - } - - return monitors; -} - -Monitor::Monitor () - : manufacturer_product_code (0) - , serial_number (0) - , week_of_manufacture (0) - , year_of_manufacture (0) -{ - -} - -Monitor::Monitor (cxml::ConstNodePtr node) - : manufacturer_id(node->string_child("ManufacturerId")) - , manufacturer_product_code(node->number_child("ManufacturerProductCode")) - , serial_number(node->number_child("SerialNumber")) - , week_of_manufacture(node->number_child("WeekOfManufacture")) - , year_of_manufacture(node->number_child("YearOfManufacture")) - -{ - -} - -void -Monitor::as_xml (xmlpp::Node* parent) const -{ - parent->add_child("ManufacturerId")->add_child_text(manufacturer_id); - parent->add_child("ManufacturerProductCode")->add_child_text(dcp::raw_convert(manufacturer_product_code)); - parent->add_child("SerialNumber")->add_child_text(dcp::raw_convert(serial_number)); - parent->add_child("WeekOfManufacture")->add_child_text(dcp::raw_convert(week_of_manufacture)); - parent->add_child("YearOfManufacture")->add_child_text(dcp::raw_convert(year_of_manufacture)); -} - -bool -operator== (Monitor const & a, Monitor const & b) -{ - return a.manufacturer_id == b.manufacturer_id && - a.manufacturer_product_code == b.manufacturer_product_code && - a.serial_number == b.serial_number && - a.week_of_manufacture == b.week_of_manufacture && - a.year_of_manufacture == b.year_of_manufacture; -} diff --git a/src/lib/edid.h b/src/lib/edid.h deleted file mode 100644 index e29c77cdc..000000000 --- a/src/lib/edid.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic 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. - - DCP-o-matic 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 DCP-o-matic. If not, see . - -*/ - -#ifndef DCPOMATIC_EDID_H -#define DCPOMATIC_EDID_H - -#include -#include -#include - -namespace xmlpp { - class Node; -} - -class Monitor -{ -public: - Monitor (); - Monitor (cxml::ConstNodePtr node); - void as_xml (xmlpp::Node* parent) const; - - std::string manufacturer_id; - uint16_t manufacturer_product_code; - uint32_t serial_number; - uint8_t week_of_manufacture; - uint8_t year_of_manufacture; -}; - -bool operator== (Monitor const & a, Monitor const & b); - -extern std::vector get_monitors(); - -#endif diff --git a/src/lib/wscript b/src/lib/wscript index 2965111ad..fcd33cec1 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -83,7 +83,6 @@ sources = """ dkdm_recipient.cc dkdm_wrapper.cc dolby_cp750.cc - edid.cc emailer.cc empty.cc encoder.cc -- cgit v1.2.3