summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-07-24 16:21:40 +0100
committerRichard Hughes <richard@hughsie.com>2017-07-24 16:25:10 +0100
commit0957e6538a6d62f3d7b5a11e549360c34e5d82e8 (patch)
treeefdf7453e5ae25cd2577973f36f026ef8a439de3
parent27bcd57dd02a99d28ade55b71a19ada3d7ba2014 (diff)
downloadcolord-0957e6538a6d62f3d7b5a11e549360c34e5d82e8.tar.gz
Remove the reverse-eningeering tools
This are (were?) only useful for me, for specific hardware.
-rw-r--r--configure.ac8
-rw-r--r--src/sensors/Makefile.am63
-rw-r--r--src/sensors/cd-parse-beagle.c335
-rw-r--r--src/sensors/cd-sensor-dump.c114
4 files changed, 0 insertions, 520 deletions
diff --git a/configure.ac b/configure.ac
index 660aace..a21cc93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,13 +279,6 @@ if test x$enable_argyllcms_sensor = xyes; then
fi
fi
-dnl ---------------------------------------------------------------------------
-dnl - Build reverse engineering
-dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(reverse, AS_HELP_STRING([--enable-reverse],[enable reverse engineering tools]),
- enable_reverse=$enableval,enable_reverse=no)
-AM_CONDITIONAL(CD_BUILD_REVERSE, test x$enable_reverse = xyes)
-
dnl **** Check for SANE ****
AC_ARG_ENABLE(sane, AS_HELP_STRING([--enable-sane],[Enable SANE support]),
enable_sane=$enableval,enable_sane=no)
@@ -451,7 +444,6 @@ echo "
cd-it8: ${CD_IT8}
cd-create-profile: ${CD_CREATE_PROFILE}
gobject-introspection: ${found_introspection}
- Reverse engineering tools: ${enable_reverse}
BASH completion support: ${enable_bash_completion}
SANE support: ${has_sane}
Extra print profiles: ${enable_print_profiles}
diff --git a/src/sensors/Makefile.am b/src/sensors/Makefile.am
index 58a49ff..782dab0 100644
--- a/src/sensors/Makefile.am
+++ b/src/sensors/Makefile.am
@@ -7,67 +7,4 @@ SUBDIRS = \
munki \
spark
-AM_CPPFLAGS = \
- $(GLIB_CFLAGS) \
- $(GUSB_CFLAGS) \
- $(GUDEV_CFLAGS) \
- $(POLKIT_CFLAGS) \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/lib \
- -I$(top_builddir)/lib \
- -I$(top_srcdir)/lib/colord \
- -DLIBDIR=\"$(libdir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DG_LOG_DOMAIN=\"Cd\" \
- -DCD_COMPILATION \
- -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \
- -DG_USB_API_IS_SUBJECT_TO_CHANGE \
- -DLOCALEDIR=\""$(localedir)"\"
-
-COLORD_PRIVATE_LIBS = \
- $(top_builddir)/lib/colord/libcolordprivate.la
-
-if CD_BUILD_REVERSE
-
-noinst_PROGRAMS = \
- cd-sensor-dump \
- cd-parse-beagle
-
-cd_parse_beagle_SOURCES = \
- huey/huey-enum.c \
- munki/munki-enum.c \
- cd-parse-beagle.c
-
-cd_parse_beagle_LDADD = \
- $(COLORD_PRIVATE_LIBS) \
- $(GLIB_LIBS)
-
-cd_parse_beagle_CFLAGS = \
- $(WARN_CFLAGS)
-
-cd_sensor_dump_SOURCES = \
- ../cd-common.c \
- ../cd-common.h \
- ../cd-sensor.c \
- ../cd-sensor.h \
- ../cd-debug.c \
- ../cd-debug.h \
- cd-sensor-dump.c
-
-cd_sensor_dump_LDADD = \
- $(COLORD_PRIVATE_LIBS) \
- $(POLKIT_LIBS) \
- $(GLIB_LIBS) \
- $(LCMS_LIBS) \
- $(GUSB_LIBS) \
- $(GUDEV_LIBS) \
- -lm
-
-cd_sensor_dump_CFLAGS = \
- $(WARN_CFLAGS)
-
-CLEANFILES = $(noinst_PROGRAMS)
-
-endif
-
-include $(top_srcdir)/git.mk
diff --git a/src/sensors/cd-parse-beagle.c b/src/sensors/cd-parse-beagle.c
deleted file mode 100644
index 36a1974..0000000
--- a/src/sensors/cd-parse-beagle.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include "huey/huey-enum.h"
-#include "munki/munki-enum.h"
-
-#include "cd-sensor.h"
-
-typedef enum {
- CD_PARSE_SECTION_LEVEL,
- CD_PARSE_SECTION_SP,
- CD_PARSE_SECTION_MS_US,
- CD_PARSE_SECTION_DUR,
- CD_PARSE_SECTION_LEN,
- CD_PARSE_SECTION_ERR,
- CD_PARSE_SECTION_DEV,
- CD_PARSE_SECTION_EP,
- CD_PARSE_SECTION_RECORD,
- CD_PARSE_SECTION_SUMMARY
-} CdParseSection;
-
-typedef enum {
- CD_PARSE_ENTRY_DIRECTION_UNKNOWN,
- CD_PARSE_ENTRY_DIRECTION_REQUEST,
- CD_PARSE_ENTRY_DIRECTION_REPLY
-} CdParseEntryDirection;
-
-typedef struct {
- const gchar *record;
- const gchar *summary;
- const gchar *summary_pretty;
- gint dev;
- gint ep;
- const gchar *ep_description;
- CdParseEntryDirection direction;
-} CdParseEntry;
-
-static void
-cd_parse_beagle_process_entry_huey (CdParseEntry *entry)
-{
- g_auto(GStrv) tok = NULL;
- guint j;
- guint8 cmd;
- guint8 instruction = 0;
- const gchar *command_as_text;
- GString *output = NULL;
-
- entry->ep_description = "default";
-
- /* only know how to parse 8 bytes */
- tok = g_strsplit (entry->summary, " ", -1);
- if (g_strv_length (tok) != 8) {
- g_print ("not 8 tokens: %s\n", entry->summary);
- goto out;
- }
-
- output = g_string_new ("");
- for (j = 0; j < 8; j++) {
- command_as_text = NULL;
- cmd = g_ascii_strtoll (tok[j], NULL, 16);
- if (j == 0 && entry->direction == CD_PARSE_ENTRY_DIRECTION_REPLY) {
- command_as_text = huey_rc_to_string (cmd);
- if (command_as_text == NULL)
- g_warning ("return code 0x%02x not known in %s", cmd, entry->summary);
- }
- if ((j == 0 && entry->direction == CD_PARSE_ENTRY_DIRECTION_REQUEST) ||
- (j == 1 && entry->direction == CD_PARSE_ENTRY_DIRECTION_REPLY)) {
- instruction = cmd;
- command_as_text = huey_cmd_code_to_string (instruction);
- if (command_as_text == NULL)
- g_warning ("command code 0x%02x not known", cmd);
- }
-
- /* some requests are filled with junk data */
- if (entry->direction == CD_PARSE_ENTRY_DIRECTION_REQUEST &&
- instruction == HUEY_CMD_REGISTER_READ && j > 1)
- g_string_append_printf (output, "xx ");
- else if (entry->direction == CD_PARSE_ENTRY_DIRECTION_REQUEST &&
- instruction == HUEY_CMD_SET_LEDS && j > 4)
- g_string_append_printf (output, "xx ");
- else if (entry->direction == CD_PARSE_ENTRY_DIRECTION_REQUEST &&
- instruction == HUEY_CMD_GET_AMBIENT && j > 3)
- g_string_append_printf (output, "xx ");
- else if (command_as_text != NULL)
- g_string_append_printf (output, "%02x(%s) ", cmd, command_as_text);
- else
- g_string_append_printf (output, "%02x ", cmd);
- }
-
- /* remove trailing space */
- if (output->len > 1)
- g_string_set_size (output, output->len - 1);
-out:
- if (output != NULL)
- entry->summary_pretty = g_string_free (output, FALSE);
-}
-
-static void
-cd_parse_beagle_process_entry_colormunki (CdParseEntry *entry)
-{
- g_auto(GStrv) tok = NULL;
- guint j;
- guint8 cmd;
- guint tok_len;
- GString *output;
-
- /* set ep description */
- entry->ep_description = munki_endpoint_to_string (entry->ep);
-
- output = g_string_new ("");
-
- /* only know how to parse 8 bytes */
- tok = g_strsplit (entry->summary, " ", -1);
- tok_len = g_strv_length (tok);
-
- /* status */
- if (entry->ep == MUNKI_EP_CONTROL &&
- entry->direction == CD_PARSE_ENTRY_DIRECTION_REPLY &&
- tok_len == 2) {
-
- /* dial position */
- cmd = g_ascii_strtoll (tok[0], NULL, 16);
- g_string_append_printf (output, "%s(dial-position-%s) ",
- tok[0],
- munki_dial_position_to_string (cmd));
-
- /* button value */
- cmd = g_ascii_strtoll (tok[1], NULL, 16);
- g_string_append_printf (output, "%s(button-state-%s)",
- tok[1],
- munki_button_state_to_string (cmd));
- goto out;
- }
-
- /* event */
- if (entry->ep == MUNKI_EP_EVENT &&
- entry->direction == CD_PARSE_ENTRY_DIRECTION_REPLY &&
- tok_len == 8) {
- g_print ("process 8: %s\n", entry->summary);
-
- /* cmd */
- cmd = g_ascii_strtoll (tok[0], NULL, 16);
- g_string_append_printf (output, "%s(%s) ",
- tok[0],
- munki_command_value_to_string (cmd));
-
- for (j=1; j<8; j++) {
- cmd = g_ascii_strtoll (tok[j], NULL, 16);
- g_string_append_printf (output, "%02x ", cmd);
- }
- if (output->len > 1)
- g_string_set_size (output, output->len - 1);
- goto out;
- }
-
- /* unknown command */
- for (j = 0; j < tok_len; j++) {
- cmd = g_ascii_strtoll (tok[j], NULL, 16);
- g_string_append_printf (output, "%02x ", cmd);
- }
- if (output->len > 1)
- g_string_set_size (output, output->len - 1);
-out:
- if (output != NULL)
- entry->summary_pretty = g_string_free (output, FALSE);
-}
-
-static gchar *
-cd_parse_beagle_process_entry (CdSensorKind kind, CdParseEntry *entry)
-{
- gchar *retval = NULL;
- const gchar *direction = "??";
-
- /* timeout */
- if (g_str_has_suffix (entry->record, "IN-NAK]"))
- goto out;
-
- /* device closed */
- if (g_strcmp0 (entry->record, "[1 ORPHANED]") == 0)
- goto out;
-
- /* usb error */
- if (g_strcmp0 (entry->record, "[53 SYNC ERRORS]") == 0)
- goto out;
-
- /* other event to ignore */
- if (g_strcmp0 (entry->record, "Bus event") == 0)
- goto out;
- if (g_strcmp0 (entry->record, "Get Configuration Descriptor") == 0)
- goto out;
- if (g_strcmp0 (entry->record, "Set Configuration") == 0)
- goto out;
-
- /* not sure what these are */
- if (g_str_has_suffix (entry->record, " SOF]"))
- goto out;
- if (g_strcmp0 (entry->record, "Clear Endpoint Feature") == 0)
- goto out;
-
- /* start or end of file */
- if (g_str_has_prefix (entry->record, "Capture started"))
- goto out;
- if (g_strcmp0 (entry->record, "Capture stopped") == 0)
- goto out;
-
- /* get direction */
- if (g_str_has_prefix (entry->record, "IN txn"))
- entry->direction = CD_PARSE_ENTRY_DIRECTION_REPLY;
- else if (g_strcmp0 (entry->record, "Control Transfer") == 0)
- entry->direction = CD_PARSE_ENTRY_DIRECTION_REQUEST;
-
- /* get correct string */
- if (entry->direction == CD_PARSE_ENTRY_DIRECTION_REQUEST)
- direction = ">>";
- else if (entry->direction == CD_PARSE_ENTRY_DIRECTION_REPLY)
- direction = "<<";
-
- /* sexify the output */
- if (kind == CD_SENSOR_KIND_HUEY)
- cd_parse_beagle_process_entry_huey (entry);
- else if (kind == CD_SENSOR_KIND_COLOR_MUNKI_PHOTO)
- cd_parse_beagle_process_entry_colormunki (entry);
- retval = g_strdup_printf ("dev%02i ep%02i(%s)\t%s\t%s\n",
- entry->dev, entry->ep,
- entry->ep_description,
- direction,
- entry->summary_pretty != NULL ? entry->summary_pretty : entry->summary);
-out:
- return retval;
-}
-
-gint
-main (gint argc, gchar *argv[])
-{
- gboolean ret;
- gchar **sections = NULL;
- guint i;
- CdParseEntry entry;
- gchar *part;
- gint retval = 1;
- CdSensorKind kind;
- g_autofree gchar *data = NULL;
- g_auto(GStrv) split = NULL;
- g_autoptr(GError) error = NULL;
- g_autoptr(GString) output = NULL;
-
- if (argc != 4) {
- g_print ("need to specify [huey|colormunki] input output\n");
- goto out;
- }
- kind = cd_sensor_kind_from_string (argv[1]);
- if (kind != CD_SENSOR_KIND_HUEY &&
- kind != CD_SENSOR_KIND_DTP94 &&
- kind != CD_SENSOR_KIND_COLOR_MUNKI_PHOTO) {
- g_print ("only huey and colormunki device kinds supported\n");
- goto out;
- }
-
- /* read file */
- ret = g_file_get_contents (argv[2], &data, NULL, &error);
- if (!ret) {
- g_print ("failed to read: %s\n", error->message);
- goto out;
- }
-
- /* parse string */
- output = g_string_new ("// automatically generated, do not edit\n");
-
- /* parse string */
- split = g_strsplit (data, "\n", -1);
- for (i = 0; split[i] != NULL; i++) {
-
- /* comment or blank line */
- if (split[i][0] == '#' ||
- split[i][0] == '\0')
- continue;
-
- g_print ("@@%u:%s\n", i, split[i]);
-
- /* populate a CdParseEntry */
- sections = g_strsplit (split[i], ",", -1);
- entry.record = sections[CD_PARSE_SECTION_RECORD];
- entry.summary = sections[CD_PARSE_SECTION_SUMMARY];
- entry.dev = atoi (sections[CD_PARSE_SECTION_DEV]);
- entry.ep = atoi (sections[CD_PARSE_SECTION_EP]);
- entry.direction = CD_PARSE_ENTRY_DIRECTION_UNKNOWN;
- entry.summary_pretty = NULL;
- entry.ep_description = NULL;
- part = cd_parse_beagle_process_entry (kind, &entry);
- if (part != NULL) {
- g_string_append (output, part);
-// g_print ("%s\n", part);
- }
- g_free (part);
- g_strfreev (sections);
- }
-
- /* write file */
- ret = g_file_set_contents (argv[3], output->str, -1, &error);
- if (!ret) {
- g_print ("failed to read: %s\n", error->message);
- goto out;
- }
-
- g_print ("done!\n");
- retval = 0;
-out:
- return retval;
-}
-
diff --git a/src/sensors/cd-sensor-dump.c b/src/sensors/cd-sensor-dump.c
deleted file mode 100644
index 41abb38..0000000
--- a/src/sensors/cd-sensor-dump.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <glib/gi18n.h>
-#include <locale.h>
-
-#include "cd-sensor.h"
-#include "cd-debug.h"
-
-static void
-cd_sensor_dump_lock_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- gboolean ret;
- g_autoptr(GError) error = NULL;
- CdSensor *sensor = CD_SENSOR (source_object);
- GMainLoop *loop = (GMainLoop *) user_data;
-
- ret = _cd_sensor_lock_finish (sensor, res, &error);
- if (!ret) {
- g_warning ("failed to lock: %s", error->message);
- g_error_free (error);
- }
- g_main_loop_quit (loop);
-}
-
-int
-main (int argc, char **argv)
-{
- guint retval = 0;
- gboolean ret;
- g_autoptr(GError) error = NULL;
- GString *data = NULL;
- GOptionContext *context;
- CdSensor *sensor;
- gchar *filename = NULL;
- GMainLoop *loop = NULL;
-
- setlocale (LC_ALL, "");
-
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- context = g_option_context_new ("sensor dump program");
- g_option_context_parse (context, &argc, &argv, NULL);
- g_option_context_free (context);
-
- /* get the default sensor */
- sensor = cd_sensor_new ();
- cd_debug_setup (TRUE);
- cd_sensor_set_kind (sensor, CD_SENSOR_KIND_DTP94);
- ret = cd_sensor_load (sensor, &error);
- if (!ret) {
- g_print ("FAILED: Failed to load sensor: %s\n",
- error->message);
- goto out;
- }
-
- /* lock the sensor */
- loop = g_main_loop_new (NULL, FALSE);
- _cd_sensor_lock_async (sensor, NULL, cd_sensor_dump_lock_cb, loop);
- g_main_loop_run (loop);
-
- /* dump details */
- filename = g_strdup ("./sensor-dump.txt");
- g_print ("Dumping sensor details to %s... ", filename);
- data = g_string_new ("");
- ret = cd_sensor_dump (sensor, data, &error);
- if (!ret) {
- g_print ("FAILED: Failed to dump sensor: %s\n", error->message);
- goto out;
- }
-
- /* write to file */
- ret = g_file_set_contents (filename, data->str, data->len, &error);
- if (!ret) {
- g_print ("FAILED: Failed to write file: %s\n", error->message);
- goto out;
- }
-
- /* success */
- g_print ("SUCCESS!!\n");
-out:
- g_free (filename);
- if (loop != NULL)
- g_main_loop_unref (loop);
- if (data != NULL)
- g_string_free (data, TRUE);
- g_object_unref (sensor);
- return retval;
-}
-