summaryrefslogtreecommitdiff
path: root/deps/sysobj_early/include
diff options
context:
space:
mode:
Diffstat (limited to 'deps/sysobj_early/include')
-rw-r--r--deps/sysobj_early/include/appf.h40
-rw-r--r--deps/sysobj_early/include/auto_free.h67
-rw-r--r--deps/sysobj_early/include/cpubits.h39
-rw-r--r--deps/sysobj_early/include/format_early.h47
-rw-r--r--deps/sysobj_early/include/gg_slist.h30
-rw-r--r--deps/sysobj_early/include/nice_name.h32
-rw-r--r--deps/sysobj_early/include/strstr_word.h35
-rw-r--r--deps/sysobj_early/include/util_edid.h268
-rw-r--r--deps/sysobj_early/include/util_ids.h76
-rw-r--r--deps/sysobj_early/include/util_sysobj.h53
10 files changed, 687 insertions, 0 deletions
diff --git a/deps/sysobj_early/include/appf.h b/deps/sysobj_early/include/appf.h
new file mode 100644
index 00000000..b99f9373
--- /dev/null
+++ b/deps/sysobj_early/include/appf.h
@@ -0,0 +1,40 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _APPF_H_
+#define _APPF_H_
+
+/* Appends a formatted element to a string, adding an optional
+ * separator string if the string is not empty.
+ * The string is created if str is null.
+ * ex: ret = appf(ret, "; ", "%s = %d", name, value); */
+char *appf(char *str, const char *sep, const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+
+/* Same as above except that str is untouched.
+ * ex: ret = appf(keeper, "; ", "%s = %d", name, value); */
+char *appfdup(const char *str, const char *sep, const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+
+/* for convenience */
+#define appfsp(str, fmt, ...) appf(str, " ", fmt, __VA_ARGS__)
+#define appfnl(str, fmt, ...) appf(str, "\n", fmt, __VA_ARGS__)
+
+#endif
diff --git a/deps/sysobj_early/include/auto_free.h b/deps/sysobj_early/include/auto_free.h
new file mode 100644
index 00000000..bddaa321
--- /dev/null
+++ b/deps/sysobj_early/include/auto_free.h
@@ -0,0 +1,67 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _AUTO_FREE_H_
+#define _AUTO_FREE_H_
+
+#include <glib.h>
+
+/* DEBUG_AUTO_FREE messages level:
+ * 0 - none
+ * 1 - some
+ * 2 - much
+ */
+#ifndef DEBUG_AUTO_FREE
+#define DEBUG_AUTO_FREE 0
+#endif
+/* the period between free_auto_free()s in the main loop */
+#define AF_SECONDS 11
+/* the minimum time between auto_free(p) and free(p) */
+#define AF_DELAY_SECONDS 10
+
+#define AF_USE_SYSOBJ 0
+
+#if (DEBUG_AUTO_FREE > 0)
+#define auto_free(p) auto_free_ex_(p, (GDestroyNotify)g_free, __FILE__, __LINE__, __FUNCTION__)
+#define auto_free_ex(p, f) auto_free_ex_(p, f, __FILE__, __LINE__, __FUNCTION__)
+#define auto_free_on_exit(p) auto_free_on_exit_ex_(p, (GDestroyNotify)g_free, __FILE__, __LINE__, __FUNCTION__)
+#define auto_free_on_exit_ex(p, f) auto_free_on_exit_ex_(p, f, __FILE__, __LINE__, __FUNCTION__)
+#else
+#define auto_free(p) auto_free_ex_(p, (GDestroyNotify)g_free, NULL, 0, NULL)
+#define auto_free_ex(p, f) auto_free_ex_(p, f, NULL, 0, NULL)
+#define auto_free_on_exit(p) auto_free_on_exit_ex_(p, (GDestroyNotify)g_free, NULL, 0, NULL)
+#define auto_free_on_exit_ex(p, f) auto_free_on_exit_ex_(p, f, NULL, 0, NULL)
+#endif
+gpointer auto_free_ex_(gpointer p, GDestroyNotify f, const char *file, int line, const char *func);
+gpointer auto_free_on_exit_ex_(gpointer p, GDestroyNotify f, const char *file, int line, const char *func);
+
+/* free all the auto_free marked items in the
+ * current thread with age > AF_DELAY_SECONDS */
+void free_auto_free();
+
+/* call at thread termination:
+ * free all the auto_free marked items in the
+ * current thread regardless of age */
+void free_auto_free_thread_final();
+
+/* call at program termination */
+void free_auto_free_final();
+
+#endif
diff --git a/deps/sysobj_early/include/cpubits.h b/deps/sysobj_early/include/cpubits.h
new file mode 100644
index 00000000..2d8fe8a6
--- /dev/null
+++ b/deps/sysobj_early/include/cpubits.h
@@ -0,0 +1,39 @@
+/*
+ * rpiz - https://github.com/bp0/rpiz
+ * Copyright (C) 2017 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _CPUBITS_H_
+#define _CPUBITS_H_
+
+#include <stdint.h>
+
+typedef uint32_t cpubits;
+uint32_t cpubits_count(cpubits *b);
+int cpubits_min(cpubits *b);
+int cpubits_max(cpubits *b);
+int cpubits_next(cpubits *b, int start, int end);
+cpubits *cpubits_from_str(char *str);
+char *cpubits_to_str(cpubits *bits, char *str, int max_len);
+
+#define CPUBITS_SIZE 4096 /* bytes, multiple of sizeof(uint32_t) */
+#define CPUBIT_SET(BITS, BIT) ((BITS)[(BIT)/32] |= (1 << (BIT)%32))
+#define CPUBIT_GET(BITS, BIT) (((BITS)[(BIT)/32] & (1 << (BIT)%32)) >> (BIT)%32)
+#define CPUBITS_CLEAR(BITS) memset((BITS), 0, CPUBITS_SIZE)
+
+#endif
diff --git a/deps/sysobj_early/include/format_early.h b/deps/sysobj_early/include/format_early.h
new file mode 100644
index 00000000..e5524e26
--- /dev/null
+++ b/deps/sysobj_early/include/format_early.h
@@ -0,0 +1,47 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _FORMAT_EARLY_H_
+#define _FORMAT_EARLY_H_
+
+#include <glib.h>
+#include <strings.h>
+#include "appf.h"
+#include "util_sysobj.h"
+#include "vendor.h"
+
+enum {
+ FMT_OPT_NONE = 0,
+ FMT_OPT_ATERM = 1<<16, /* ANSI color terminal */
+ FMT_OPT_PANGO = 1<<17, /* pango markup for gtk */
+ FMT_OPT_HTML = 1<<18, /* html */
+};
+
+gchar *safe_ansi_color(gchar *ansi_color, gboolean free_in); /* verify the ansi color */
+const gchar *color_lookup(int ansi_color); /* ansi_color to html color */
+/* wrap the input str with color based on fmt_opts (none,term,html,pango) */
+gchar *format_with_ansi_color(const gchar *str, const gchar *ansi_color, int fmt_opts);
+
+void tag_vendor(gchar **str, guint offset, const gchar *vendor_str, const char *ansi_color, int fmt_opts);
+gchar *vendor_match_tag(const gchar *vendor_str, int fmt_opts);
+
+gchar *vendor_list_ribbon(const vendor_list vl_in, int fmt_opts);
+
+#endif
diff --git a/deps/sysobj_early/include/gg_slist.h b/deps/sysobj_early/include/gg_slist.h
new file mode 100644
index 00000000..255465ee
--- /dev/null
+++ b/deps/sysobj_early/include/gg_slist.h
@@ -0,0 +1,30 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _GG_SLIST_H_
+#define _GG_SLIST_H_
+
+#include <glib.h>
+
+GSList *gg_slist_remove_null(GSList *sl);
+GSList *gg_slist_remove_duplicates(GSList *sl); /* by pointer */
+GSList *gg_slist_remove_duplicates_custom(GSList *sl, GCompareFunc func);
+
+#endif
diff --git a/deps/sysobj_early/include/nice_name.h b/deps/sysobj_early/include/nice_name.h
new file mode 100644
index 00000000..80031c91
--- /dev/null
+++ b/deps/sysobj_early/include/nice_name.h
@@ -0,0 +1,32 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _NICE_NAME_H_
+#define _NICE_NAME_H_
+
+/* cleaned in-place */
+void nice_name_x86_cpuid_model_string(char *cpuid_model_string);
+
+/* Intel Graphics may have very long names,
+ * like "Intel Corporation Seventh Generation Something Core Something Something Integrated Graphics Processor Revision Ninety-four"
+ * cleaned in-place */
+void nice_name_intel_gpu_device(char *pci_ids_device_string);
+
+#endif
diff --git a/deps/sysobj_early/include/strstr_word.h b/deps/sysobj_early/include/strstr_word.h
new file mode 100644
index 00000000..f17e78ff
--- /dev/null
+++ b/deps/sysobj_early/include/strstr_word.h
@@ -0,0 +1,35 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __STRSTR_WORD_H__
+#define __STRSTR_WORD_H__
+
+/* versions of strstr() and strcasestr() where the match must be preceded and
+ * succeded by a non-alpha-numeric character. */
+char *strstr_word(const char *haystack, const char *needle);
+char *strcasestr_word(const char *haystack, const char *needle);
+
+/* word boundary at start only (prefix), or end only (suffix) */
+char *strstr_word_prefix(const char *haystack, const char *needle);
+char *strcasestr_word_prefix(const char *haystack, const char *needle);
+char *strstr_word_suffix(const char *haystack, const char *needle);
+char *strcasestr_word_suffix(const char *haystack, const char *needle);
+
+#endif
diff --git a/deps/sysobj_early/include/util_edid.h b/deps/sysobj_early/include/util_edid.h
new file mode 100644
index 00000000..5bb4b932
--- /dev/null
+++ b/deps/sysobj_early/include/util_edid.h
@@ -0,0 +1,268 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __UTIL_EDID_H__
+#define __UTIL_EDID_H__
+
+#define _GNU_SOURCE
+#include <stdint.h> /* for *int*_t types */
+#include <glib.h>
+
+typedef struct _edid edid;
+
+typedef struct {
+ edid *e;
+ uint32_t offset;
+} edid_addy;
+
+/* OUI is stored in EDID as 24-bit little-endian,
+ * but lookup file from IEEE expects big-endian.
+ * .oui_str is .oui rendered into big-endian for
+ * easy lookup. */
+typedef struct {
+ union {
+ char pnp[7]; /* only needs 3+null */
+ char oui_str[7]; /* needs 6+null */
+ };
+ uint32_t oui;
+ uint8_t type; /* enum VEN_TYPE_* */
+} edid_ven;
+
+typedef struct {
+ char *str;
+ uint16_t len;
+ uint8_t is_product_name;
+ uint8_t is_serial;
+} DisplayIDString;
+
+typedef struct {
+ uint8_t version;
+ uint8_t extension_length;
+ uint8_t primary_use_case;
+ uint8_t extension_count;
+ uint16_t blocks;
+ uint8_t checksum_ok;
+} DisplayIDMeta;
+
+typedef struct {
+ edid_addy addy;
+ union {
+ uint8_t tag;
+ uint8_t type;
+ };
+ uint8_t revision;
+ uint8_t len;
+ uint8_t bounds_ok;
+
+ /* for vendor specific block */
+ edid_ven ven;
+} DisplayIDBlock;
+
+typedef struct {
+ edid_addy addy;
+ uint8_t interface;
+ uint8_t supports_hdcp;
+ uint8_t exists;
+} DIExtData;
+
+/* order by rising priority */
+enum {
+ OUTSRC_INVALID = -1,
+ OUTSRC_EDID = 0,
+ OUTSRC_ETB,
+ OUTSRC_STD,
+ OUTSRC_DTD,
+ OUTSRC_CEA_DTD,
+ OUTSRC_SVD,
+
+ OUTSRC_DID_TYPE_I,
+ OUTSRC_DID_TYPE_VI,
+ OUTSRC_DID_TYPE_VII,
+};
+
+typedef struct {
+ float horiz_cm, vert_cm;
+ float diag_cm, diag_in;
+ int horiz_blanking, vert_blanking;
+ int horiz_pixels, vert_lines, vert_pixels;
+ float vert_freq_hz;
+ uint8_t is_interlaced;
+ uint8_t is_preferred;
+ int stereo_mode;
+ uint64_t pixel_clock_khz;
+ int src; /* enum OUTSRC_* */
+ uint64_t pixels; /* h*v: easier to compare */
+ char class_inch[12];
+} edid_output;
+
+struct edid_std {
+ uint8_t *ptr;
+ edid_output out;
+};
+
+struct edid_dtd {
+ edid_addy addy;
+ uint8_t cea_ext; /* in a CEA block vs one of the regular EDID descriptors */
+ edid_output out;
+ uint8_t bounds_ok;
+};
+
+struct edid_svd {
+ uint8_t v;
+ uint8_t is_native;
+ edid_output out;
+};
+
+struct edid_sad {
+ uint8_t v[3];
+ uint8_t format, channels, freq_bits;
+ int depth_bits; /* format 1 */
+ int max_kbps; /* formats 2-8 */
+};
+
+struct edid_cea_block {
+ edid_addy addy;
+ int type, len;
+ uint8_t bounds_ok;
+
+ /* for vendor specific block */
+ edid_ven ven;
+};
+
+struct edid_descriptor {
+ edid_addy addy;
+ uint8_t type;
+ char text[14];
+};
+
+struct edid_manf_date {
+ uint8_t week;
+ uint8_t is_model_year; /* ignore week */
+ uint16_t year;
+ int std; /* enum STD_* */
+};
+
+enum {
+ VEN_TYPE_INVALID = 0,
+ VEN_TYPE_PNP,
+ VEN_TYPE_OUI,
+};
+
+enum {
+ STD_EDID = 0,
+ STD_EEDID = 1,
+ STD_EIACEA861 = 2,
+ STD_DISPLAYID = 3,
+ STD_DISPLAYID20 = 4,
+};
+
+typedef struct _edid {
+ union {
+ void* data;
+ uint8_t* u8;
+ uint16_t* u16;
+ };
+ unsigned int len;
+
+ /* enum STD_* */
+ int std;
+
+ uint8_t ver_major, ver_minor;
+ uint8_t checksum_ok; /* first 128-byte block only */
+ uint8_t ext_blocks, ext_blocks_ok, ext_blocks_fail;
+ uint8_t *ext_ok;
+
+ int etb_count;
+ edid_output etbs[24];
+
+ int std_count;
+ struct edid_std stds[8];
+
+ int dtd_count;
+ struct edid_dtd *dtds;
+
+ int cea_block_count;
+ struct edid_cea_block *cea_blocks;
+
+ int svd_count;
+ struct edid_svd *svds;
+
+ int sad_count;
+ struct edid_sad *sads;
+
+ edid_ven ven;
+ struct edid_descriptor d[4];
+ /* point into d[].text */
+ char *name;
+ char *serial;
+ char *ut1;
+ char *ut2;
+
+ uint8_t a_or_d; /* 0 = analog, 1 = digital */
+ uint8_t interface; /* digital interface */
+ uint8_t bpc; /* digital bpc */
+ uint16_t product;
+ uint32_t n_serial;
+ struct edid_manf_date dom;
+ edid_output img;
+ edid_output img_svd;
+ edid_output img_max;
+ uint32_t speaker_alloc_bits;
+
+ DIExtData di;
+
+ DisplayIDMeta did;
+ int did_block_count;
+ DisplayIDBlock *did_blocks;
+ int did_string_count;
+ DisplayIDString *did_strings;
+
+ int didt_count;
+ edid_output *didts;
+
+ GString *msg_log;
+} edid;
+edid *edid_new(const char *data, unsigned int len);
+edid *edid_new_from_hex(const char *hex_string);
+edid *edid_new_from_file(const char *path);
+void edid_free(edid *e);
+char *edid_dump_hex(edid *e, int tabs, int breaks);
+
+const char *edid_standard(int std);
+const char *edid_output_src(int src);
+const char *edid_interface(int type);
+const char *edid_di_interface(int type);
+const char *edid_descriptor_type(int type);
+const char *edid_ext_block_type(int type);
+const char *edid_cea_block_type(int type);
+const char *edid_cea_audio_type(int type);
+
+char *edid_output_describe(edid_output *out);
+char *edid_base_descriptor_describe(struct edid_descriptor *d);
+char *edid_dtd_describe(struct edid_dtd *dtd, int dump_bytes);
+char *edid_cea_block_describe(struct edid_cea_block *blk);
+char *edid_cea_audio_describe(struct edid_sad *sad);
+char *edid_cea_speaker_allocation_describe(int bitfield, int short_version);
+const char *edid_did_block_type(int type);
+char *edid_did_block_describe(DisplayIDBlock *blk);
+
+char *edid_dump2(edid *e);
+
+#endif
diff --git a/deps/sysobj_early/include/util_ids.h b/deps/sysobj_early/include/util_ids.h
new file mode 100644
index 00000000..c5dccfe7
--- /dev/null
+++ b/deps/sysobj_early/include/util_ids.h
@@ -0,0 +1,76 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _UTIL_IDS_H_
+#define _UTIL_IDS_H_
+
+#include <glib.h>
+
+#define IDS_LOOKUP_BUFF_SIZE 220
+#define IDS_LOOKUP_MAX_DEPTH 4
+
+/* may be static, all results[] are NULL or point into _strs */
+typedef struct {
+ gchar *results[IDS_LOOKUP_MAX_DEPTH+1]; /* last always NULL */
+ gchar _strs[IDS_LOOKUP_BUFF_SIZE*IDS_LOOKUP_MAX_DEPTH];
+} ids_query_result;
+#define ids_query_result_new() g_new0(ids_query_result, 1)
+#define ids_query_result_free(s) g_free(s);
+void ids_query_result_cpy(ids_query_result *dest, ids_query_result *src);
+
+/* Given a qpath "/X/Y/Z", find names as:
+ * X <name> ->result[0]
+ * \tY <name> ->result[1]
+ * \t\tZ <name> ->result[2]
+ *
+ * Works with:
+ * - pci.ids "<vendor>/<device>/<subvendor> <subdevice>" or "C <class>/<subclass>/<prog-if>"
+ * ... need to query "<subvendor>" separately
+ * - arm.ids "<implementer>/<part>"
+ * - sdio.ids "<vendor>/<device>", "C <class>"
+ * - sdcard.ids "OEMID <code>", "MANFID <code>"
+ * - usb.ids "<vendor>/<device>", "C <class>" etc.
+ * - edid.ids "<3letter_vendor>"
+ */
+long scan_ids_file(const gchar *file, const gchar *qpath, ids_query_result *result, long start_offset);
+
+typedef struct {
+ gchar *qpath;
+ ids_query_result result;
+} ids_query;
+
+ids_query *ids_query_new(const gchar *qpath);
+void ids_query_free(ids_query *s);
+typedef GSList* ids_query_list;
+
+/* query_list is a GSList of ids_query* */
+long scan_ids_file_list(const gchar *file, ids_query_list query_list, long start_offset);
+/* after scan_ids_file_list(), count hits */
+int query_list_count_found(ids_query_list query_list);
+
+/* returns GSList of ids_query* */
+typedef gchar* (*split_loc_function)(const char *line);
+ids_query_list ids_file_all_get_all(const gchar *file, split_loc_function split_loc_func);
+
+/* debugging */
+void ids_trace_start();
+void ids_trace_stop();
+
+#endif
diff --git a/deps/sysobj_early/include/util_sysobj.h b/deps/sysobj_early/include/util_sysobj.h
new file mode 100644
index 00000000..1bff3d5a
--- /dev/null
+++ b/deps/sysobj_early/include/util_sysobj.h
@@ -0,0 +1,53 @@
+/*
+ * sysobj - https://github.com/bp0/verbose-spork
+ * Copyright (C) 2018 Burt P. <pburt0@gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _UTIL_SYSOBJ_H_
+#define _UTIL_SYSOBJ_H_
+
+#include <glib.h>
+#include "appf.h"
+
+/* string eq */
+#define SEQ(s1, s2) (g_strcmp0((s1), (s2)) == 0)
+
+/* handy for static halp */
+#define BULLET "\u2022"
+#define REFLINK(URI) "<a href=\"" URI "\">" URI "</a>"
+#define REFLINKT(TEXT, URI) "<a href=\"" URI "\">" TEXT "</a>"
+
+gboolean util_have_root();
+void util_null_trailing_slash(gchar *str); /* in-place */
+void util_compress_space(gchar *str); /* in-place, multiple whitespace replaced by one space */
+void util_strstrip_double_quotes_dumb(gchar *str); /* in-place, strips any double-quotes from the start and end of str */
+gchar *util_build_fn(const gchar *base, const gchar *name); /* returns "<base>[/<name>]" */
+gchar *util_canonicalize_path(const gchar *path); /* resolve . and .., but not symlinks */
+gchar *util_normalize_path(const gchar *path, const gchar *relto); /* resolve . and .., and symlinks */
+gsize util_count_lines(const gchar *str); /* doesn't count empty last line */
+gchar *util_escape_markup(gchar *v, gboolean replacing);
+int util_get_did(gchar *str, const gchar *lbl); /* ("cpu6", "cpu") -> 6, returns -1 if error */
+int util_maybe_num(gchar *str); /* returns the guessed base, 0 for not num */
+gchar *util_find_line_value(gchar *data, gchar *key, gchar delim);
+gchar *util_strchomp_float(gchar* str_float); /* in-place, must use , or . for decimal sep */
+gchar *util_safe_name(const gchar *name, gboolean lower_case); /* make a string into a name nice and safe for file name */
+
+/* to quiet -Wunused-parameter nagging. */
+#define PARAM_NOT_UNUSED(p) (void)p
+
+#endif