diff options
Diffstat (limited to 'includes')
49 files changed, 1049 insertions, 343 deletions
diff --git a/includes/alpha/processor-platform.h b/includes/alpha/processor-platform.h index 778a1a88..7dfdd91c 100644 --- a/includes/alpha/processor-platform.h +++ b/includes/alpha/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/arm/processor-platform.h b/includes/arm/processor-platform.h index 0ffdac24..a168db68 100644 --- a/includes/arm/processor-platform.h +++ b/includes/arm/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/benchmark.h b/includes/benchmark.h index 277f0c07..08392ad2 100644 --- a/includes/benchmark.h +++ b/includes/benchmark.h @@ -2,22 +2,43 @@ #define __BENCHMARK_H__ #include "hardinfo.h" +#include "util_sysobj.h" /* for SEQ() */ + +#define BENCH_PTR_BITS ((unsigned int)sizeof(void*) * 8) extern ProgramParameters params; -enum { - BENCHMARK_BLOWFISH, +enum BenchmarkEntries { + BENCHMARK_BLOWFISH_SINGLE, + BENCHMARK_BLOWFISH_THREADS, + BENCHMARK_BLOWFISH_CORES, + BENCHMARK_ZLIB, BENCHMARK_CRYPTOHASH, BENCHMARK_FIB, BENCHMARK_NQUEENS, - BENCHMARK_ZLIB, BENCHMARK_FFT, BENCHMARK_RAYTRACE, + BENCHMARK_SBCPU_SINGLE, + BENCHMARK_SBCPU_ALL, + BENCHMARK_SBCPU_QUAD, + BENCHMARK_MEMORY_SINGLE, + BENCHMARK_MEMORY_DUAL, + BENCHMARK_MEMORY_QUAD, + BENCHMARK_MEMORY_ALL, BENCHMARK_GUI, BENCHMARK_N_ENTRIES -} BenchmarkEntries; +}; -void benchmark_bfish(void); +void benchmark_bfish_single(void); +void benchmark_bfish_threads(void); +void benchmark_bfish_cores(void); +void benchmark_memory_single(void); +void benchmark_memory_dual(void); +void benchmark_memory_quad(void); +void benchmark_memory_all(void); +void benchmark_sbcpu_single(void); +void benchmark_sbcpu_all(void); +void benchmark_sbcpu_quad(void); void benchmark_cryptohash(void); void benchmark_fft(void); void benchmark_fib(void); @@ -31,9 +52,12 @@ typedef struct { double result; double elapsed_time; int threads_used; + int revision; + char extra[256]; /* no \n, ; or | */ + char user_note[256]; /* no \n, ; or | */ } bench_value; -#define EMPTY_BENCH_VALUE {-1.0f,0,0} +#define EMPTY_BENCH_VALUE {-1.0f,0,0,-1,""} char *bench_value_to_str(bench_value r); bench_value bench_value_from_str(const char* str); @@ -52,4 +76,12 @@ bench_value benchmark_crunch_for(float seconds, gint n_threads, extern bench_value bench_results[BENCHMARK_N_ENTRIES]; +/* in bench_util.c */ + +/* guarantee a minimum size of data + * or return null */ +gchar *get_test_data(gsize min_size); +char *md5_digest_str(const char *data, unsigned int len); +#define bench_msg(msg, ...) fprintf (stderr, "[%s] " msg "\n", __FUNCTION__, ##__VA_ARGS__) + #endif /* __BENCHMARK_H__ */ diff --git a/includes/callbacks.h b/includes/callbacks.h index 392d5767..421cff5e 100644 --- a/includes/callbacks.h +++ b/includes/callbacks.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -40,5 +40,6 @@ void cb_manage_hosts(); void cb_connect_host(GtkAction * action); void cb_local_computer(); void cb_act_as_server(); +void cb_sync_on_startup(); #endif /* __CALLBACKS_H__ */ diff --git a/includes/computer.h b/includes/computer.h index 5a69a171..f8589d77 100644 --- a/includes/computer.h +++ b/includes/computer.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +19,7 @@ #define __COMPUTER_H__ #include "hardinfo.h" +#include "x_util.h" typedef struct _Computer Computer; typedef struct _OperatingSystem OperatingSystem; @@ -26,6 +27,7 @@ typedef struct _MemoryInfo MemoryInfo; typedef struct _UptimeInfo UptimeInfo; typedef struct _LoadInfo LoadInfo; typedef struct _DisplayInfo DisplayInfo; +typedef struct _Distro Distro; typedef struct _AlsaInfo AlsaInfo; typedef struct _AlsaCard AlsaCard; @@ -36,14 +38,14 @@ typedef struct _FileSystemEntry FileSystemEntry; struct _AlsaCard { gchar *alsa_name; gchar *friendly_name; -/* +/* gchar *board; gchar revision, compat_class; gint subsys_vendorid, subsys_id; - + gint cap_dac_res, cap_adc_res; gboolean cap_3d_enh; - + gint curr_mic_gain; gboolean curr_3d_enh, curr_loudness, @@ -57,14 +59,18 @@ struct _AlsaInfo { }; struct _DisplayInfo { - gchar *ogl_vendor, *ogl_renderer, *ogl_version; - gboolean dri; - - gchar *display_name, *vendor, *version; - gchar *extensions; - gchar *monitors; - + /* old stuff */ gint width, height; + + /* new stuff */ + xinfo *xi; /* x info */ + wl_info *wl; /* wayland info */ + + gchar *display_server; + + /* don't free */ + const gchar *vendor; /* X vendor; points to xrr->xi->vendor */ + const gchar *session_type; /* points to wl->xdg_session_type */ }; struct _LoadInfo { @@ -84,10 +90,15 @@ struct _Computer { gchar *date_time; }; +#include "distro_flavors.h" + struct _OperatingSystem { gchar *kernel; + gchar *kcmdline; gchar *libc; - gchar *distrocode, *distro; + gchar *distrocode; + gchar *distroid; + gchar *distro; gchar *hostname; gchar *language; gchar *homedir; @@ -97,10 +108,12 @@ struct _OperatingSystem { gchar *desktop; gchar *username; - + gchar *boots; gchar *entropy_avail; + + const DistroFlavor* distro_flavor; }; struct _MemoryInfo { @@ -108,6 +121,12 @@ struct _MemoryInfo { gfloat ratio; }; +struct _Distro { + gchar *distro; + gchar *codename; + gchar *id; +}; + #define get_str(field_name,ptr) \ if (g_str_has_prefix(tmp[0], field_name)) { \ ptr = g_strdup(tmp[1]); \ @@ -137,16 +156,31 @@ extern gchar *module_list; gchar *computer_get_formatted_loadavg(); gchar *computer_get_formatted_uptime(); gchar *computer_get_alsacards(Computer * computer); -gchar *computer_get_entropy_avail(); +gchar *computer_get_entropy_avail(void); +gchar *computer_get_aslr(void); +gchar *computer_get_dmesg_status(void); +const gchar *computer_get_selinux(void); +gchar *computer_get_lsm(void); OperatingSystem *computer_get_os(void); AlsaInfo *computer_get_alsainfo(void); MemoryInfo *computer_get_memory(void); UptimeInfo *computer_get_uptime(void); DisplayInfo *computer_get_display(void); +void computer_free_display(DisplayInfo *di); void scan_modules_do(void); void scan_filesystems(void); void scan_users_do(void); +/* Memory Usage */ +extern GHashTable *memlabels; +void init_memory_labels(void); +void scan_memory_do(void); +void scan_boots_real(void); +void scan_languages(OperatingSystem *os); +void scan_groups_do(void); + +void kernel_module_icon_init(void); + #endif /* __COMPUTER_H__ */ diff --git a/includes/cpu_util.h b/includes/cpu_util.h index c11d3f69..1adbf491 100644 --- a/includes/cpu_util.h +++ b/includes/cpu_util.h @@ -47,4 +47,6 @@ void cputopo_free(cpu_topology_data *cputd); gchar *cputopo_section_str(cpu_topology_data *cputd); +int cpu_procs_cores_threads_nodes(int *p, int *c, int *t, int *n); + #endif diff --git a/includes/devices.h b/includes/devices.h index e18a3838..e2ab8f7f 100644 --- a/includes/devices.h +++ b/includes/devices.h @@ -48,10 +48,6 @@ gchar *processor_describe_default(GSList * processors); gchar *processor_describe_by_counting_names(GSList * processors); gchar *processor_frequency_desc(GSList *processors); -/* Memory */ -void init_memory_labels(void); -void scan_memory_do(void); - /* Printers */ void init_cups(void); @@ -65,14 +61,19 @@ void scan_pci_do(void); void scan_printers_do(void); /* Sensors */ -void scan_sensors_do(void); -void sensors_init(void); -void sensors_shutdown(void); +#define SENSORS_GROUP_BY_TYPE 1 -#if defined(ARCH_x86) || defined(ARCH_x86_64) -/* SPD */ -void scan_spd_do(void); -#endif /* ARCH_x86 */ +void scan_sensors_do(void); +void sensor_init(void); +void sensor_shutdown(void); +void __scan_dtree(void); +void scan_gpu_do(void); +gboolean __scan_udisks2_devices(void); +void __scan_ide_devices(void); +void __scan_scsi_devices(void); +void __scan_input_devices(void); +void __scan_usb(void); +void __scan_dmi(void); extern gchar *battery_list; extern gchar *input_icons; @@ -83,20 +84,19 @@ extern gchar *pci_list; extern gchar *printer_icons; extern gchar *printer_list; extern gchar *sensors; +extern gchar *sensor_icons; extern gchar *storage_icons; extern gchar *storage_list; extern gchar *usb_list; -extern GHashTable *memlabels; +extern gchar *usb_icons; extern GHashTable *_pci_devices; extern GHashTable *sensor_compute; extern GHashTable *sensor_labels; extern GModule *cups; -#if defined(ARCH_x86) || defined(ARCH_x86_64) -extern gchar *spd_info; extern gchar *dmi_info; -#endif - extern gchar *dtree_info; +extern gchar *gpu_list; +extern gchar *gpu_summary; #endif /* __DEVICES_H__ */ diff --git a/includes/remote.h b/includes/distro_flavors.h index 6a988a3b..c316eeb6 100644 --- a/includes/remote.h +++ b/includes/distro_flavors.h @@ -1,11 +1,11 @@ /* - * Remote Client * HardInfo - Displays System Information - * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2019 L. A. F. Pereira <l@tia.mat.br> + * This file 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,13 +17,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __REMOTE_H__ -#define __REMOTE_H__ +#ifndef __DISTRO_FLAVORS_H__ +#define __DISTRO_FLAVORS_H__ -void remote_disconnect_all(gboolean ssh); -gboolean remote_connect_host(gchar * hostname); -void connect_dialog_show(GtkWidget * parent); -void host_manager_show(GtkWidget * parent); +typedef struct { + const char *name; + const char *icon; + const char *url; +} DistroFlavor; -#endif /* __REMOTE_H__ */ +typedef struct UbuntuFlavor { + const DistroFlavor base; + const char *package; +} UbuntuFlavor; +/* items are const; free with g_slist_free() */ +GSList *ubuntu_flavors_scan(void); + +#endif diff --git a/includes/dmi_util.h b/includes/dmi_util.h index aecda739..2fec1a04 100644 --- a/includes/dmi_util.h +++ b/includes/dmi_util.h @@ -1,12 +1,12 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2017 L. A. F. Pereira <l@tia.mat.br> * This file * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,11 +21,49 @@ #ifndef __DMI_UTIL_H__ #define __DMI_UTIL_H__ -char *dmi_get_str(const char *id_str); +#include <inttypes.h> + +typedef uint32_t dmi_handle; +typedef uint32_t dmi_type; + +/* -1 = yes, but will be ignored + * 0 = no + * 1 = yes */ +int dmi_str_status(const char *id_str); +char *dmi_get_str(const char *id_str); /* ignore nonsense */ +char *dmi_get_str_abs(const char *id_str); /* include nonsense */ /* if chassis_type is <=0 it will be fetched from DMI. * with_val = true, will return a string like "[3] Desktop" instead of just * "Desktop". */ char *dmi_chassis_type_str(int chassis_type, gboolean with_val); +typedef struct { + dmi_handle id; + uint32_t size; + dmi_type type; + const char *type_str; /* untranslated, use _() for translation */ +} dmi_handle_ext; + +typedef struct { + uint32_t count; + dmi_handle *handles; + dmi_handle_ext *handles_ext; +} dmi_handle_list; + +/* get a list of handles that match a dmi_type */ +dmi_handle_list *dmidecode_handles(const dmi_type *type); +void dmi_handle_list_free(dmi_handle_list *hl); + +/* get a list of handles which have a name, and/or optional value, and/or limit to an optional dmi_type + * dmidecode_match_value("Name", NULL, NULL) : all dmi handles with an item called "Name" + * dmidecode_match_value("Name", "Value", NULL) : all dmi_handles with an item called "Name" that has a value of "Value" + * dmidecode_match_value("Name", "Value", &dt) : all dmi_handles with "Name: Value" that are of type stored in dt */ +dmi_handle_list *dmidecode_match_value(const char *name, const char *value, const dmi_type *type); + +/* get the first value for name, limiting to optional dmi_type and/or optional handle */ +char *dmidecode_match(const char *name, const dmi_type *type, const dmi_handle *handle); + +void dmidecode_cache_free(); + #endif diff --git a/includes/dt_util.h b/includes/dt_util.h index 7ef6808b..bec9af1c 100644 --- a/includes/dt_util.h +++ b/includes/dt_util.h @@ -20,6 +20,7 @@ enum { DTP_STR, /* null-delimited list of strings */ DTP_HEX, /* list of 32-bit values displayed in hex */ DTP_UINT, /* unsigned int list */ + DTP_UINT64, /* unsigned int64 list */ DTP_INTRUPT, /* interrupt-specifier list */ DTP_INTRUPT_EX, /* extended interrupt-specifier list */ DTP_OVR, /* all in /__overrides__ */ @@ -29,6 +30,8 @@ enum { DTP_CLOCKS, /* <phref, #clock-cells> */ DTP_GPIOS, /* <phref, #gpio-cells> */ DTP_DMAS, /* dma-specifier list */ + DTP_OPP1, /* list of operating points, pairs of (kHz,uV) */ + DTP_PH_REF_OPP2, /* phandle reference to opp-v2 table */ }; /* simplest, no aliases, doesn't require an existing dt. @@ -36,6 +39,7 @@ enum { char* dtr_get_string(const char *p, int decode); typedef uint32_t dt_uint; /* big-endian */ +typedef uint64_t dt_uint64; /* big-endian */ typedef struct _dtr dtr; typedef struct _dtr_obj dtr_obj; @@ -53,18 +57,20 @@ char *dtr_obj_alias(dtr_obj *); char *dtr_obj_symbol(dtr_obj *); char *dtr_obj_path(dtr_obj *); /* device tree path */ char *dtr_obj_full_path(dtr_obj *); /* system path */ +dtr_obj *dtr_get_parent_obj(dtr_obj *); /* find property/node 'name' relative to node * if node is NULL, then from root */ dtr_obj *dtr_get_prop_obj(dtr *, dtr_obj *node, const char *name); char *dtr_get_prop_str(dtr *, dtr_obj *node, const char *name); uint32_t dtr_get_prop_u32(dtr *, dtr_obj *node, const char *name); +uint64_t dtr_get_prop_u64(dtr *, dtr_obj *node, const char *name); /* attempts to render the object as a string */ char* dtr_str(dtr_obj *obj); int dtr_guess_type(dtr_obj *obj); -char *dtr_elem_phref(dtr *, dt_uint e, int show_path); +char *dtr_elem_phref(dtr *, dt_uint e, int show_path, const char *extra); char *dtr_elem_hex(dt_uint e); char *dtr_elem_byte(uint8_t e); char *dtr_elem_uint(dt_uint e); @@ -80,10 +86,16 @@ const char *dtr_find_device_tree_root(void); /* write to the message log */ void dtr_msg(dtr *s, char *fmt, ...); -#define sp_sep(STR) (strlen(STR) ? " " : "") -/* appends an element to a string, adding a space if - * the string is not empty. - * ex: ret = appf(ret, "%s=%s\n", name, value); */ -char *appf(char *src, char *fmt, ...); +/* operating-points v0,v1,v2 */ +typedef struct { + uint32_t version; /* opp version, 0 = clock-frequency only */ + uint32_t phandle; /* v2 only */ + uint32_t khz_min; + uint32_t khz_max; + uint32_t clock_latency_ns; +} dt_opp_range; + +/* free result with g_free() */ +dt_opp_range *dtr_get_opp_range(dtr *, const char *name); #endif diff --git a/includes/e2k/processor-platform.h b/includes/e2k/processor-platform.h new file mode 100644 index 00000000..c6361823 --- /dev/null +++ b/includes/e2k/processor-platform.h @@ -0,0 +1,72 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2020 EntityFX <artem.solopiy@gmail.com> and MCST Elbrus Team + * + * 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, version 2. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __PROCESSOR_PLATFORM_H__ +#define __PROCESSOR_PLATFORM_H__ + +#include "cpu_util.h" + +/* + +E2K /proc/cpuinfo: + + +processor : 0 +vendor_id : E8C-SWTX +cpu family : 4 +model : 7 +model name : E8C +revision : 2 +cpu MHz : 1299.912740 +cache0 : level=1 type=Instruction scope=Private size=128K line_size=256 associativity=4 +cache1 : level=1 type=Data scope=Private size=64K line_size=32 associativity=4 +cache2 : level=2 type=Unified scope=Private size=512K line_size=64 associativity=4 +cache3 : level=3 type=Unified scope=Private size=16384K line_size=64 associativity=16 +bogomips : 2600.68 + +*/ + + +typedef struct _ProcessorCache ProcessorCache; + +struct _ProcessorCache { + gint level; + gint number_of_sets; + gint physical_line_partition; + gint size; + gchar *type; + gint ways_of_associativity; + gint uid; /* uid is unique among caches with the same (type, level) */ + gchar *shared_cpu_list; /* some kernel's don't give a uid, so try shared_cpu_list */ + gint phy_sock; +}; + +//e2k processor structure +struct _Processor { + gint id; + gfloat cpu_mhz; + gchar *model_name; + gchar *vendor_id; + gfloat bogomips; + + gint model, family, revision; + + GSList *cache; +}; + +#endif /* __PROCESSOR_PLATFORM_H__ */ diff --git a/includes/egg-markdown.h b/includes/egg-markdown.h index 4475b9f0..1a2b03f4 100644 --- a/includes/egg-markdown.h +++ b/includes/egg-markdown.h @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Copyright (C) 2008 Richard Hughes <richard@hughsie.com> - * Copyright (C) 2009 Leandro Pereira <leandro@hardinfo.org> + * Copyright (C) 2009 L.Pereira <l@tia.mat.br> * * Licensed under the GNU General Public License Version 2 * diff --git a/includes/expr.h b/includes/expr.h index 4bda6b72..18d0cc65 100644 --- a/includes/expr.h +++ b/includes/expr.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/gpu_util.h b/includes/gpu_util.h new file mode 100644 index 00000000..c0089ffb --- /dev/null +++ b/includes/gpu_util.h @@ -0,0 +1,61 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 L. A. F. Pereira <l@tia.mat.br> + * + * 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, version 2 or later. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __GPU_UTIL_H__ +#define __GPU_UTIL_H__ + +#include <stdint.h> +#include "pci_util.h" +#include "dt_util.h" + +typedef struct nvgpu { + char *model; + char *bios_version; + char *uuid; +} nvgpu; + +typedef struct gpud { + char *id; /* ours */ + char *nice_name; + char *vendor_str; + char *device_str; + char *location; + uint32_t khz_min, khz_max; /* core */ + uint32_t mem_khz_min, mem_khz_max; /* memory */ + + char *drm_dev; + char *sysfs_drm_path; + pcid *pci_dev; + + char *dt_compat, *dt_status, *dt_name, *dt_path; + const char *dt_vendor, *dt_device; + dt_opp_range *dt_opp; + + nvgpu *nv_info; + /* ... */ + + struct gpud *next; /* this is a linked list */ +} gpud; + +gpud *gpu_get_device_list(); +int gpud_list_count(gpud *); +void gpud_list_free(gpud *); + +void gpud_free(gpud *); + +#endif diff --git a/includes/guibench.h b/includes/guibench.h index d24403bc..16f34218 100644 --- a/includes/guibench.h +++ b/includes/guibench.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2009 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/hardinfo.h b/includes/hardinfo.h index 637aa1fd..872a29fc 100644 --- a/includes/hardinfo.h +++ b/includes/hardinfo.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,14 +19,19 @@ #ifndef __HARDINFO_H__ #define __HARDINFO_H__ +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> #include <gtk/gtk.h> #include "config.h" #include "shell.h" #include "vendor.h" #include "gettext.h" #include "info.h" +#include "format_early.h" -#define HARDINFO_COPYRIGHT_LATEST_YEAR 2017 +#define HARDINFO2_COPYRIGHT_LATEST_YEAR 2024 #ifndef LOCALEDIR #define LOCALEDIR "/usr/share/locale" @@ -36,6 +41,7 @@ typedef enum { MODULE_FLAG_NONE = 0, MODULE_FLAG_NO_REMOTE = 1<<0, MODULE_FLAG_HAS_HELP = 1<<1, + MODULE_FLAG_HIDE = 1<<2, } ModuleEntryFlags; typedef struct _ModuleEntry ModuleEntry; @@ -45,16 +51,29 @@ typedef struct _ProgramParameters ProgramParameters; struct _ProgramParameters { gboolean create_report; + gboolean force_all_details; /* for create_report, include any "moreinfo" that exists for any item */ gboolean show_version; gboolean gui_running; gboolean list_modules; gboolean autoload_deps; - gboolean run_xmlrpc_server; + gboolean skip_benchmarks; + gboolean quiet; + + /* + * OK to use the common parts of HTML(4.0) and Pango Markup + * in the value part of a key/value. + * Including the (b,big,i,s,sub,sup,small,tt,u) tags. + * https://developer.gnome.org/pango/stable/PangoMarkupFormat.html + */ + gboolean markup_ok; + int fmt_opts; gint report_format; + gint max_bench_results; gchar **use_modules; gchar *run_benchmark; + gchar *bench_user_note; gchar *result_format; gchar *path_lib; gchar *path_data; @@ -84,11 +103,11 @@ struct _ModuleAbout { }; /* String utility functions */ -inline void remove_quotes(gchar *str); -inline char *strend(gchar *str, gchar chr); -inline void remove_linefeed(gchar *str); -gchar *strreplacechr(gchar *string, gchar *replace, gchar new_char); -gchar *strreplace(gchar *string, gchar *replace, gchar *replacement); +void remove_quotes(gchar *str); +char *strend(gchar *str, gchar chr); +void remove_linefeed(gchar *str); +gchar *strreplacechr(gchar *string, gchar *replace, gchar new_char); +gchar *strreplace(gchar *string, gchar *replace, gchar *replacement); /* Widget utility functions */ void widget_set_cursor(GtkWidget *widget, GdkCursorType cursor_type); @@ -102,25 +121,24 @@ gchar *file_chooser_build_filename(GtkWidget *chooser, gchar *extension); gpointer file_types_get_data_by_name(FileTypes *file_types, gchar *name); /* Misc utility functions */ -#if RELEASE == 1 -gpointer idle_free(gpointer ptr); -#else -gpointer __idle_free(gpointer ptr, gchar *f, gint l); -#define idle_free(p) __idle_free(p, __FILE__, __LINE__) -#endif /* RELEASE == 1 */ +#if !(RELEASE == 1) +#define DEBUG_AUTO_FREE 2 +#endif +#include "auto_free.h" +#define idle_free(ptr) auto_free(ptr) gchar *find_program(gchar *program_name); -inline gchar *size_human_readable(gfloat size); +gchar *size_human_readable(gfloat size); void nonblock_sleep(guint msec); -void open_url(gchar *url); GSList *modules_get_list(void); GSList *modules_load_selected(void); GSList *modules_load_all(void); void module_unload_all(void); -ModuleAbout *module_get_about(ShellModule *module); +const ModuleAbout *module_get_about(ShellModule *module); gchar *seconds_to_string(unsigned int seconds); -gchar *h_strdup_cprintf(const gchar *format, gchar *source, ...); +gchar *h_strdup_cprintf(const gchar *format, gchar *source, ...) + __attribute__((format(gnu_printf, 1, 3))); gchar *h_strconcat(gchar *string1, ...); void h_hash_table_remove_all (GHashTable *hash_table); @@ -146,9 +164,10 @@ gchar *module_call_method(gchar *method); gchar *module_call_method_param(gchar * method, gchar * parameter); /* Sysfs stuff */ -gfloat h_sysfs_read_float(gchar *endpoint, gchar *entry); -gint h_sysfs_read_int(gchar *endpoint, gchar *entry); -gchar *h_sysfs_read_string(gchar *endpoint, gchar *entry); +gfloat h_sysfs_read_float(const gchar *endpoint, const gchar *entry); +gint h_sysfs_read_int(const gchar *endpoint, const gchar *entry); +gint h_sysfs_read_hex(const gchar *endpoint, const gchar *entry); +gchar *h_sysfs_read_string(const gchar *endpoint, const gchar *entry); #define SCAN_START() static gboolean scanned = FALSE; if (reload) scanned = FALSE; if (scanned) return; #define SCAN_END() scanned = TRUE; @@ -171,6 +190,11 @@ gchar *moreinfo_lookup(gchar *key); gboolean g_strv_contains(const gchar * const * strv, const gchar *str); #endif +/* in gg_key_file_parse_string_as_value.c */ +gchar * +gg_key_file_parse_string_as_value (const gchar *string, const gchar list_separator); + +gchar *hardinfo_clean_grpname(const gchar *v, int replacing); /* Hardinfo labels that have # are truncated and/or hidden. * Labels can't have $ because that is the delimiter in * moreinfo. @@ -179,4 +203,32 @@ gchar *hardinfo_clean_label(const gchar *v, int replacing); /* hardinfo uses the values as {ht,x}ml, apparently */ gchar *hardinfo_clean_value(const gchar *v, int replacing); +/* Same as hardinfo_spawn_command_line_sync(), but calls shell_status_pulse() + * before. */ +gboolean hardinfo_spawn_command_line_sync(const gchar *command_line, + gchar **standard_output, + gchar **standard_error, + gint *exit_status, + GError **error); + +/* a marker in text to point out problems, using markup where possible */ +const char *problem_marker(); + +/* a version of g_strescape() that allows escaping extra characters. + * use with g_strcompress() as normal. */ +gchar * +gg_strescape (const gchar *source, + const gchar *exceptions, + const gchar *extra); + +/* hinote helpers */ +#define note_max_len 512 +#define note_printf(note_buff, fmt, ...) \ + snprintf((note_buff) + strlen(note_buff), note_max_len - strlen(note_buff) - 1, \ + fmt, ##__VA_ARGS__) +#define note_print(note_buff, str) note_printf((note_buff), "%s", str) +gboolean note_cond_bullet(gboolean cond, gchar *note_buff, const gchar *desc_str); +gboolean note_require_tool(const gchar *tool, gchar *note_buff, const gchar *desc_str); +int cpu_procs_cores_threads(int *p, int *c, int *t); + #endif /* __HARDINFO_H__ */ diff --git a/includes/help-viewer.h b/includes/help-viewer.h index 688ff325..85c78edf 100644 --- a/includes/help-viewer.h +++ b/includes/help-viewer.h @@ -1,10 +1,10 @@ /* * HelpViewer - Simple Help file browser - * Copyright (C) 2009 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2009 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/ia64/processor-platform.h b/includes/ia64/processor-platform.h index 5d525639..d118fe86 100644 --- a/includes/ia64/processor-platform.h +++ b/includes/ia64/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/iconcache.h b/includes/iconcache.h index 97f59a82..b71924c3 100644 --- a/includes/iconcache.h +++ b/includes/iconcache.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/info.h b/includes/info.h index 253c06e0..77894518 100644 --- a/includes/info.h +++ b/includes/info.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2017 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,8 +18,20 @@ #pragma once +#include <stdarg.h> #include <glib.h> +enum InfoGroupSort { + INFO_GROUP_SORT_NONE, + INFO_GROUP_SORT_NAME_ASCENDING, + INFO_GROUP_SORT_NAME_DESCENDING, + INFO_GROUP_SORT_VALUE_ASCENDING, + INFO_GROUP_SORT_VALUE_DESCENDING, + INFO_GROUP_SORT_TAG_ASCENDING, + INFO_GROUP_SORT_TAG_DESCENDING, + INFO_GROUP_SORT_MAX, +}; + struct Info { GArray *groups; @@ -36,32 +48,60 @@ struct Info { struct InfoGroup { const gchar *name; + enum InfoGroupSort sort; GArray *fields; - /* scaffolding fields */ + /* scaffolding fields */ const gchar *computed; }; struct InfoField { const gchar *name; - gchar *value; + const gchar *value; + const gchar *icon; int update_interval; + gboolean highlight; /* select in GUI, highlight in report (flag:*) */ + gboolean report_details; /* show moreinfo() in report (flag:!) */ + gboolean value_has_vendor; /* (flag:^) */ + gboolean label_is_escaped; /* if the label will need g_strcompress() before display use */ + gboolean free_name_on_flatten; gboolean free_value_on_flatten; + + /* scaffolding fields */ + gchar *tag; /* moreinfo() lookup tag */ }; struct Info *info_new(void); -void info_add_group(struct Info *info, const gchar *group_name, ...); +void info_remove_group(struct Info *info, guint index); +struct InfoGroup *info_add_group(struct Info *info, const gchar *group_name, ...); +void info_group_strip_extra(struct InfoGroup *group); + void info_add_computed_group(struct Info *info, const gchar *name, const gchar *value); +void info_add_computed_group_wo_extra(struct Info *info, const gchar *name, const gchar *value); + +void info_group_add_field(struct InfoGroup *group, struct InfoField field); +void info_group_add_fields(struct InfoGroup *group, ...); +void info_group_add_fieldsv(struct InfoGroup *group, va_list ap); -struct InfoField info_field(const gchar *name, gchar *value); struct InfoField info_field_printf(const gchar *name, const gchar *format, ...) __attribute__((format(printf, 2, 3))); -struct InfoField info_field_update(const gchar *name, int update_interval); -struct InfoField info_field_last(void); + +#define info_field_full(...) \ + (struct InfoField) { __VA_ARGS__ } + +#define info_field(n, v, ...) \ + info_field_full(.name = (n), .value = (v), __VA_ARGS__) + +#define info_field_update(n, ui, ...) \ + info_field_full(.name = (n), .value = "...", .update_interval = (ui), \ + __VA_ARGS__) + +#define info_field_last() \ + (struct InfoField) {} void info_set_column_title(struct Info *info, const gchar *column, const gchar *title); void info_set_column_headers_visible(struct Info *info, gboolean setting); @@ -71,3 +111,4 @@ void info_set_view_type(struct Info *info, ShellViewType setting); void info_set_reload_interval(struct Info *info, int setting); gchar *info_flatten(struct Info *info); +struct Info *info_unflatten(const gchar *str); diff --git a/includes/loadgraph.h b/includes/loadgraph.h index d79ca39b..d176e816 100644 --- a/includes/loadgraph.h +++ b/includes/loadgraph.h @@ -1,6 +1,6 @@ /* * Simple Load Graph - * Copyright (C) 2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2006 L. A. F. Pereira <l@tia.mat.br> * * The Simple Load Graph is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -47,6 +47,9 @@ void load_graph_clear(LoadGraph *lg); void load_graph_set_data_suffix(LoadGraph *lg, gchar *suffix); gchar *load_graph_get_data_suffix(LoadGraph *lg); +void load_graph_set_title(LoadGraph *lg, const gchar *title); +const gchar *load_graph_get_title(LoadGraph *lg); + gint load_graph_get_height(LoadGraph *lg); #endif /* __LOADGRAPH_H__ */ diff --git a/includes/xmlrpc-server.h b/includes/loongarch64/processor-platform.h index e608b711..43ba0a26 100644 --- a/includes/xmlrpc-server.h +++ b/includes/loongarch64/processor-platform.h @@ -1,6 +1,6 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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 @@ -15,11 +15,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __XMLRPC_SERVER_H__ -#define __XMLRPC_SERVER_H__ -void xmlrpc_server_start(GMainLoop *main_loop); -void xmlrpc_server_init(void); +#ifndef __PROCESSOR_PLATFORM_H__ +#define __PROCESSOR_PLATFORM_H__ -#endif /* __XMLRPC_SERVER_H__ */ +struct _Processor { + gchar *vendor_id; + gchar *family; + gchar *model_name; + gint revision; + gfloat cpu_mhz, bogomips; + gchar *features; +}; +#endif /* __PROCESSOR_PLATFORM_H__ */ diff --git a/includes/m68k/processor-platform.h b/includes/m68k/processor-platform.h index 9aea1dfe..5e38bc11 100644 --- a/includes/m68k/processor-platform.h +++ b/includes/m68k/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/markdown-text-view.h b/includes/markdown-text-view.h index 648ea39c..11d184a2 100644 --- a/includes/markdown-text-view.h +++ b/includes/markdown-text-view.h @@ -2,7 +2,7 @@ * Markdown Text View * GtkTextView subclass that supports Markdown syntax * - * Copyright (C) 2009 Leandro Pereira <leandro@hardinfo.org> + * Copyright (C) 2009 L.Pereira <l@tia.mat.br> * Portions Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com> * Portions Copyright (C) GTK+ Team (based on hypertext textview demo) * diff --git a/includes/menu.h b/includes/menu.h index 3c804008..d5e8aeeb 100644 --- a/includes/menu.h +++ b/includes/menu.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/mips/processor-platform.h b/includes/mips/processor-platform.h index 9bdae18b..394ba99e 100644 --- a/includes/mips/processor-platform.h +++ b/includes/mips/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/network.h b/includes/network.h index 1e71126e..13d54872 100644 --- a/includes/network.h +++ b/includes/network.h @@ -9,5 +9,7 @@ extern gchar *network_interfaces; extern gchar *network_icons; void scan_net_interfaces(void); +void scan_samba(void); +void scan_nfs_shared_directories(void); -#endif /* __NETWORK_H__ */
\ No newline at end of file +#endif /* __NETWORK_H__ */ diff --git a/includes/parisc/processor-platform.h b/includes/parisc/processor-platform.h index c55c69ec..b7485bda 100644 --- a/includes/parisc/processor-platform.h +++ b/includes/parisc/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/pci_util.h b/includes/pci_util.h new file mode 100644 index 00000000..f2d1d605 --- /dev/null +++ b/includes/pci_util.h @@ -0,0 +1,78 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 L. A. F. Pereira <l@tia.mat.br> + * + * 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, version 2 or later. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __PCI_UTIL_H__ +#define __PCI_UTIL_H__ + +#include <stdint.h> + +#define SYSFS_PCI_ROOT "/sys/bus/pci/devices" + +char *pci_address_str(uint32_t dom, uint32_t bus, uint32_t dev, uint32_t func); + +typedef struct pcid { + uint32_t domain; + uint32_t bus; + uint32_t device; + uint32_t function; + uint32_t class; + uint32_t vendor_id; + uint32_t device_id; + uint32_t sub_vendor_id; + uint32_t sub_device_id; + uint32_t revision; + char *slot_str; + char *class_str; + char *vendor_id_str; + char *device_id_str; + char *sub_vendor_id_str; + char *sub_device_id_str; + + char *driver; /* Kernel driver in use */ + char *driver_list; /* Kernel modules */ + + float pcie_speed_max; /* GT/s */ + float pcie_speed_curr; /* GT/s */ + uint32_t pcie_width_max; + uint32_t pcie_width_curr; + + /* ... */ + +} pcid; + +pcid *pci_get_device(uint32_t dom, uint32_t bus, uint32_t dev, uint32_t func); +pcid *pci_get_device_str(const char *addy); +#define pcid_new() g_new0(pcid, 1) +gint pcid_cmp_by_addy(gconstpointer a, gconstpointer b); +void pcid_free(pcid *); + +typedef GSList* pcid_list; +/* examples: + * to get all pci devices: + * pcid_list list = pci_get_device_list(0, 0); + * to get all display controllers: + * pcid_list list = pci_get_device_list(0x300, 0x3ff); + */ +pcid_list pci_get_device_list(uint32_t class_min, uint32_t class_max); +#define pcid_list_count(l) g_slist_length(l); +#define pcid_list_free(l) g_slist_free_full(l, (GDestroyNotify)pcid_free) + +const gchar *find_pci_ids_file(); +char *pci_lookup_ids_vendor_str(uint32_t id); + +#endif diff --git a/includes/ppc/processor-platform.h b/includes/ppc/processor-platform.h index d3d1a568..df1fcbaa 100644 --- a/includes/ppc/processor-platform.h +++ b/includes/ppc/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/report.h b/includes/report.h index 782621cb..47b510c1 100644 --- a/includes/report.h +++ b/includes/report.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - + #ifndef __REPORT_H__ #define __REPORT_H__ #include <gtk/gtk.h> @@ -24,6 +24,7 @@ typedef enum { REPORT_FORMAT_HTML, REPORT_FORMAT_TEXT, + REPORT_FORMAT_SHELL, N_REPORT_FORMAT } ReportFormat; @@ -41,22 +42,29 @@ typedef struct _ReportContext ReportContext; struct _ReportContext { ShellModuleEntry *entry; gchar *output; - + void (*header) (ReportContext *ctx); void (*footer) (ReportContext *ctx); void (*title) (ReportContext *ctx, gchar *text); void (*subtitle) (ReportContext *ctx, gchar *text); void (*subsubtitle) (ReportContext *ctx, gchar *text); - void (*keyvalue) (ReportContext *ctx, gchar *key, gchar *value); - + void (*keyvalue) (ReportContext *ctx, gchar *key, gchar *value, gsize longest_key); + + void (*details_start) (ReportContext *ctx, gchar *key, gchar *value, gsize longest_key); + void (*details_section) (ReportContext *ctx, gchar *name); + void (*details_keyvalue) (ReportContext *ctx, gchar *key, gchar *value, gsize longest_key); + void (*details_end) (ReportContext *ctx); + ReportFormat format; - - gboolean is_image_enabled; + gboolean first_table; + gboolean in_details; gboolean show_column_headers; - guint columns; + guint columns, parent_columns; GHashTable *column_titles; + GHashTable *icon_refs; + GHashTable *icon_data; }; struct _ReportDialog { @@ -67,7 +75,7 @@ struct _ReportDialog { GtkWidget *btn_sel_all; GtkWidget *btn_sel_none; GtkWidget *treeview; - + GtkTreeModel *model; }; @@ -75,14 +83,16 @@ void report_dialog_show(); ReportContext *report_context_html_new(); ReportContext *report_context_text_new(); +ReportContext *report_context_shell_new(); void report_header (ReportContext *ctx); void report_footer (ReportContext *ctx); void report_title (ReportContext *ctx, gchar *text); void report_subtitle (ReportContext *ctx, gchar *text); void report_subsubtitle (ReportContext *ctx, gchar *text); -void report_key_value (ReportContext *ctx, gchar *key, gchar *value); +void report_key_value (ReportContext *ctx, gchar *key, gchar *value, gsize longest_key); void report_table (ReportContext *ctx, gchar *text); +void report_details (ReportContext *ctx, gchar *key, gchar *value, gchar *details, gsize longest_key); void report_create_from_module_list(ReportContext *ctx, GSList *modules); gchar *report_create_from_module_list_format(GSList *modules, ReportFormat format); diff --git a/includes/riscv/processor-platform.h b/includes/riscv/processor-platform.h index 07cbf86e..b2c1c69c 100644 --- a/includes/riscv/processor-platform.h +++ b/includes/riscv/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/s390/processor-platform.h b/includes/s390/processor-platform.h index 9164a7f2..2edee105 100644 --- a/includes/s390/processor-platform.h +++ b/includes/s390/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/sh/processor-platform.h b/includes/sh/processor-platform.h index 26b58ec5..e8ba7686 100644 --- a/includes/sh/processor-platform.h +++ b/includes/sh/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/sha1.h b/includes/sha1.h index 573ff8ac..8b5c0b2f 100644 --- a/includes/sha1.h +++ b/includes/sha1.h @@ -17,7 +17,7 @@ typedef struct { - guint32 state[5]; + guint32 state[20]; guint32 count[2]; guchar buffer[64]; } SHA1_CTX; diff --git a/includes/shell.h b/includes/shell.h index 2eb9e6d2..ab39106c 100644 --- a/includes/shell.h +++ b/includes/shell.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,7 +27,7 @@ typedef struct _Shell Shell; typedef struct _ShellTree ShellTree; typedef struct _ShellInfoTree ShellInfoTree; typedef struct _ShellNote ShellNote; -typedef struct _ShellSummary ShellSummary; +typedef struct _DetailView DetailView; typedef struct _ShellModule ShellModule; typedef struct _ShellModuleMethod ShellModuleMethod; @@ -52,7 +52,7 @@ typedef enum { SHELL_VIEW_LOAD_GRAPH, SHELL_VIEW_PROGRESS, SHELL_VIEW_PROGRESS_DUAL, - SHELL_VIEW_SUMMARY, + SHELL_VIEW_DETAIL, SHELL_VIEW_N_VIEWS } ShellViewType; @@ -81,14 +81,16 @@ struct _Shell { GtkWidget *status, *progress; GtkWidget *remote_label; GtkWidget *notebook; - GtkWidget *hpaned, *vpaned; + GtkWidget *hbox, *vpaned; + + GtkWindow *transient_dialog; ShellTree *tree; - ShellInfoTree *info, *moreinfo; + ShellInfoTree *info_tree; ShellModule *selected_module; ShellModuleEntry *selected; ShellNote *note; - ShellSummary *summary; + DetailView *detail_view; LoadGraph *loadgraph; GtkActionGroup *action_group; @@ -97,20 +99,18 @@ struct _Shell { ShellViewType view_type; gboolean normalize_percentage; - + gint _pulses; ShellOrderType _order_type; - + GKeyFile *hosts; HelpViewer *help_viewer; }; -struct _ShellSummary { - GtkWidget *header; +struct _DetailView { GtkWidget *scroll; GtkWidget *view; - - GSList *items; + GtkWidget *detail_box; }; struct _ShellTree { @@ -127,7 +127,7 @@ struct _ShellInfoTree { GtkWidget *view; GtkTreeModel *model; GtkTreeSelection *selection; - + GtkTreeViewColumn *col_progress, *col_value, *col_extra1, *col_extra2, *col_textvalue; }; @@ -141,10 +141,10 @@ struct _ShellModule { GdkPixbuf *icon; GModule *dll; - gpointer (*aboutfunc) (); + gconstpointer (*aboutfunc)(void); gchar *(*summaryfunc) (); void (*deinit) (); - + guchar weight; GSList *entries; @@ -162,7 +162,7 @@ struct _ShellModuleEntry { gboolean selected; gint number; guint32 flags; - + gchar *(*func) (); void (*scan_func) (); @@ -196,6 +196,8 @@ void shell_action_set_property(const gchar *action_name, const gchar *property, gboolean setting); +void shell_set_transient_dialog(GtkWindow *dialog); + void shell_set_side_pane_visible(gboolean setting); void shell_set_note_from_entry(ShellModuleEntry *entry); void shell_ui_manager_set_visible(const gchar *path, @@ -220,6 +222,39 @@ void shell_update_remote_menu(void); void shell_set_remote_label(Shell *shell, gchar *label); +/* decode special information in keys + * + * key syntax: + * [$[<flags>][<tag>]$]<name>[#[<dis>]] + * flags: + * [[!][*][^]] + * ! = show details (moreinfo) in reports + * * = highlight/select this row + * ^ = value is/has a vendor string + * @ = label is escaped with key_label_escape() + */ +gboolean key_is_flagged(const gchar *key); /* has $[<flags>][<tag>]$ at the start of the key */ +gboolean key_is_highlighted(const gchar *key); /* flag '*' = select/highlight */ +gboolean key_wants_details(const gchar *key); /* flag '!' = report should include the "moreinfo" */ +gboolean key_value_has_vendor_string(const gchar *key); /* flag '^' = try and match the value to a vendor */ +#define key_label_escape(LBL) (gg_strescape(LBL, NULL, "=$#")) +gboolean key_label_is_escaped(const gchar *key); /* flag '@' = the label part is key_label_escape()-d and + * needs to be g_strcompress()-ed before use. + * key_get_components() will do this automatically for label. */ +gchar *key_mi_tag(const gchar *key); /* moreinfo lookup tag */ +const gchar *key_get_name(const gchar *key); /* get the key's name, flagged or not */ +/* + * example for key = "$*!Foo$Bar#7": + * flags = "$*!^Foo$" // key_is/wants_*() still works on flags + * tag = "Foo" // the moreinfo/icon tag + * name = "Bar#7" // the full unique name + * label = "Bar" // the label displayed + * dis = "7" + */ +void key_get_components(const gchar *key, + gchar **flags, gchar **tag, gchar **name, gchar **label, gchar **dis, + gboolean null_empty); + #endif /* __SHELL_H__ */ diff --git a/includes/socket.h b/includes/socket.h index 7c44837e..8dd4d439 100644 --- a/includes/socket.h +++ b/includes/socket.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/sparc/processor-platform.h b/includes/sparc/processor-platform.h index 31748a5b..c0e6f5cc 100644 --- a/includes/sparc/processor-platform.h +++ b/includes/sparc/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/ssh-conn.h b/includes/ssh-conn.h deleted file mode 100644 index b1b0a9ca..00000000 --- a/includes/ssh-conn.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Remote Client - HardInfo - Displays System Information - Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org> - - Based on ssh-method.c from GnomeVFS - Copyright (C) 1999 Free Software Foundation - Original author: Ian McKellar <yakk@yakk.net> - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ -#ifndef __SSH_CONN_H__ -#define __SSH_CONN_H__ - -#include "config.h" -#ifdef HAS_LIBSOUP -#include <libsoup/soup.h> - -typedef struct _SSHConn SSHConn; - -typedef enum { - SSH_CONN_OK, - SSH_CONN_NO_URI, - SSH_CONN_UNKNOWN_PROTOCOL, - SSH_CONN_UNKNOWN_ERROR, - SSH_CONN_CANNOT_SPAWN_SSH, - SSH_CONN_BAD_PARAMS, - SSH_CONN_PERMISSION_DENIED, - SSH_CONN_HOST_KEY_CHECK_FAIL, - SSH_CONN_REFUSED, - SSH_CONN_INVALID_USER_PASS, -} SSHConnResponse; - -struct _SSHConn { - SoupURI *uri; - int fd_read, fd_write, fd_error; - GPid pid; - gchar *askpass_path; - - gint exit_status; -}; - -SSHConnResponse ssh_new(SoupURI * uri, - SSHConn ** conn_return, gchar * command); -void ssh_close(SSHConn * conn); - -int ssh_write(SSHConn * conn, - gconstpointer buffer, gint num_bytes, gint * bytes_written); -int ssh_read(gint fd, gpointer buffer, gint num_bytes, gint * bytes_read); - -const char *ssh_conn_errors[10]; -#endif /* HAS_LIBSOUP */ -#endif /* __SSH_CONN_H__ */ diff --git a/includes/stock.h b/includes/stock.h index 706e5c51..d3efffdb 100644 --- a/includes/stock.h +++ b/includes/stock.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +19,8 @@ #ifndef __STOCK_H__ #define __STOCK_H__ +#define HI_STOCK_CLIPBOARD "hi-stock-clipboard" +#define HI_STOCK_REFRESH "hi-stock-refresh" #define HI_STOCK_REPORT "hi-stock-report" #define HI_STOCK_INTERNET "hi-stock-internet" #define HI_STOCK_MODULE "hi-stock-module" diff --git a/includes/storage_util.h b/includes/storage_util.h new file mode 100644 index 00000000..7774e71f --- /dev/null +++ b/includes/storage_util.h @@ -0,0 +1,22 @@ +#include "vendor.h" +#include "pci_util.h" + +// udisks2 drive info extended +typedef struct u2driveext { + udiskd *d; + pcid *nvme_controller; + struct{ + gchar *oui; + gchar *vendor; + } wwid_oui; + vendor_list vendors; +} u2driveext; + + +GSList *get_udisks2_drives_ext(); + +u2driveext* u2drive_ext(udiskd * udisks_drive_data); +void u2driveext_free(u2driveext *u); + +void udisks2_shutdown(void); +void storage_shutdown(void); diff --git a/includes/syncmanager.h b/includes/syncmanager.h index ae0ed267..3b886b0f 100644 --- a/includes/syncmanager.h +++ b/includes/syncmanager.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,17 +21,15 @@ #include <gtk/gtk.h> -typedef struct _SyncEntry SyncEntry; +typedef struct _SyncEntry SyncEntry; struct _SyncEntry { - gchar *name; - gchar *fancy_name; - gchar *save_to; - - gchar *(*get_data)(void); - void (*callback)(SyncEntry *entry, const gchar *response); - - gboolean selected; + const gchar *name; + const gchar *file_name; + + gchar *(*generate_contents_for_upload)(gsize *size); + + gboolean selected; }; void sync_manager_add_entry(SyncEntry *entry); @@ -39,4 +37,6 @@ void sync_manager_clear_entries(void); void sync_manager_show(GtkWidget *parent); gint sync_manager_count_entries(void); -#endif /* __SYNCMANAGER_H__ */ +void sync_manager_update_on_startup(void); + +#endif /* __SYNCMANAGER_H__ */ diff --git a/includes/udisks2_util.h b/includes/udisks2_util.h new file mode 100644 index 00000000..9b26f6dd --- /dev/null +++ b/includes/udisks2_util.h @@ -0,0 +1,69 @@ +#include "vendor.h" + +typedef struct udiskp { + gchar *block; + gchar *type; + gchar *version; + gchar *label; + guint64 size; + struct udiskp* next; +} udiskp; + +enum{ + UDSK_INTPVAL_SKIP = 0, + UDSK_INTPVAL_DIMENSIONLESS = 1, + UDSK_INTPVAL_MILISECONDS = 2, + UDSK_INTPVAL_HOURS = 3, + UDSK_INTPVAL_SECTORS = 4, + UDSK_INTPVAL_CELSIUS = 5, +}; + +typedef struct udisksa { + guint8 id; + gchar *identifier; + gint value; + gint worst; + gint threshold; + gint64 interpreted; + guint8 interpreted_unit; // enum + struct udisksa* next; +} udisksa; + +typedef struct udiskd { + gchar *model; + gchar *vendor; + gchar *revision; + gchar *block_dev; + gchar *serial; + gchar *wwid; + gchar *connection_bus; + gchar *partition_table; + udiskp *partitions; + gboolean ejectable; + gboolean removable; + gint32 rotation_rate; + guint64 size; + gchar *media; + gchar **media_compatibility; + gboolean pm_supported; + gboolean aam_supported; + gboolean apm_supported; + gboolean smart_supported; + gboolean smart_enabled; + gboolean smart_failing; + guint64 smart_poweron; + gint64 smart_bad_sectors; + gint32 smart_temperature; + udisksa *smart_attributes; +} udiskd; + +typedef struct udiskt { + gchar *drive; + gint32 temperature; +} udiskt; +void udisks2_init(); +void udisks2_shutdown(); +GSList *get_udisks2_temps(); +GSList *get_udisks2_all_drives_info(); +void udiskt_free(udiskt *u); +void udiskd_free(udiskd *u); diff --git a/includes/uidefs.h b/includes/uidefs.h index 70d2de17..c3042492 100644 --- a/includes/uidefs.h +++ b/includes/uidefs.h @@ -5,55 +5,62 @@ #if RELEASE #define DEBUG_TOOLBAR_ITEMS -#else /* !RELEASE */ -#define DEBUG_TOOLBAR_ITEMS "<separator/>" \ - "<toolitem name=\"ReportBug\" action=\"ReportBugAction\" />" -#endif /* !RELEASE */ +#else /* !RELEASE */ +#define DEBUG_TOOLBAR_ITEMS \ + "<separator/>" \ + "<toolitem name=\"ReportBug\" action=\"ReportBugAction\" />" +#endif /* !RELEASE */ -#ifdef HAS_LIBSOUP -#define SYNC_MANAGER_ITEMS " <separator/>" \ -" <menuitem name=\"SyncManager\" action=\"SyncManagerAction\" />" +#define SYNC_MANAGER_MENU_ITEMS \ + "<separator/>" \ + "<menuitem name=\"SyncManager\" action=\"SyncManagerAction\" " \ + "always-show-image=\"true\"/>" \ + "<menuitem name=\"SyncOnStartup\" action=\"SyncOnStartupAction\"/>" +#define SYNC_MANAGER_TOOL_ITEMS \ + "<toolitem name=\"SyncManager\" action=\"SyncManagerAction\"/>" -#else /* !HAS_LIBSOUP */ -#define SYNC_MANAGER_ITEMS -#endif /* !HAS_LIBSOUP */ +char *uidefs_str = + "<ui>" + " <menubar>" + " <menu name=\"InformationMenu\" action=\"InformationMenuAction\">" + " <menuitem name=\"Report\" action=\"ReportAction\" />" + " <menuitem name=\"Copy\" action=\"CopyAction\" />" + SYNC_MANAGER_MENU_ITEMS \ + " <separator/>" + " <menuitem name=\"Quit\" action=\"QuitAction\" />" + " </menu>" + " <menu name=\"ViewMenu\" action=\"ViewMenuAction\">" + " <menuitem name=\"SidePane\" action=\"SidePaneAction\"/>" + " <menuitem name=\"Toolbar\" action=\"ToolbarAction\"/>" + " <separator/>" + " <separator name=\"LastSep\"/>" + " <menuitem name=\"Refresh\" action=\"RefreshAction\"/>" + " </menu>" + " <menu name=\"HelpMenu\" action=\"HelpMenuAction\">" + " <menuitem name=\"WebPage\" action=\"HomePageAction\"/>" + " <menuitem name=\"ReportBug\" action=\"ReportBugAction\"/>" + " <menuitem name=\"About\" action=\"AboutAction\"/>" + " </menu>" + " </menubar>" + " <toolbar action=\"MainMenuBar\" action=\"MainMenuBarAction\">" + " <placeholder name=\"ToolItems\">" + " <toolitem name=\"Refresh\" action=\"RefreshAction\"/>" + " <separator/>" + " <toolitem name=\"Report\" action=\"ReportAction\"/>" + " <toolitem name=\"Copy\" action=\"CopyAction\"/>" + " <separator/>" + DEBUG_TOOLBAR_ITEMS \ + SYNC_MANAGER_TOOL_ITEMS \ + " </placeholder>" + " </toolbar>" + "</ui>"; -char *uidefs_str = "<ui>" \ -" <menubar>" \ -" <menu name=\"InformationMenu\" action=\"InformationMenuAction\">" \ -" <menuitem name=\"Report\" action=\"ReportAction\" />" \ -" <menuitem name=\"Copy\" action=\"CopyAction\" />" \ -SYNC_MANAGER_ITEMS -" <separator/>" \ -" <menuitem name=\"Quit\" action=\"QuitAction\" />" \ -" </menu>" \ -" <menu name=\"ViewMenu\" action=\"ViewMenuAction\">" \ -" <menuitem name=\"SidePane\" action=\"SidePaneAction\"/>" \ -" <menuitem name=\"Toolbar\" action=\"ToolbarAction\"/>" \ -" <separator/>"\ -" <separator name=\"LastSep\"/>" \ -" <menuitem name=\"Refresh\" action=\"RefreshAction\"/>" \ -" </menu>" \ -" <menu name=\"HelpMenu\" action=\"HelpMenuAction\">" \ -" <menuitem name=\"WebPage\" action=\"HomePageAction\"/>" \ -" <menuitem name=\"ReportBug\" action=\"ReportBugAction\"/>" \ -" <separator/>" \ -" <menu name=\"HelpMenuModules\" action=\"HelpMenuModulesAction\">" \ -" <separator name=\"LastSep\"/>" \ -" </menu>" \ -" <menuitem name=\"About\" action=\"AboutAction\"/>" \ -" </menu>" \ -" </menubar>" \ -" <toolbar action=\"MainMenuBar\" action=\"MainMenuBarAction\">" \ -" <placeholder name=\"ToolItems\">" \ -" <toolitem name=\"Refresh\" action=\"RefreshAction\"/>" \ -" <separator/>" \ -" <toolitem name=\"Report\" action=\"ReportAction\"/>" \ -" <toolitem name=\"Copy\" action=\"CopyAction\"/>" \ -" <separator/>" \ -DEBUG_TOOLBAR_ITEMS \ -" </placeholder>" \ -" </toolbar>" \ -"</ui>"; +/*DISABLED + " <separator/>" + " <menu name=\"HelpMenuModules\" " + "action=\"HelpMenuModulesAction\">" + " <separator name=\"LastSep\"/>" + " </menu>" +*/ -#endif /* __UIDEFS_H__ */ +#endif /* __UIDEFS_H__ */ diff --git a/includes/usb_util.h b/includes/usb_util.h new file mode 100644 index 00000000..736a9237 --- /dev/null +++ b/includes/usb_util.h @@ -0,0 +1,78 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 L. A. F. Pereira <l@tia.mat.br> + * + * 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, version 2 or later. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __USB_UTIL_H__ +#define __USB_UTIL_H__ + +/* this is a linked list */ +typedef struct usbd { + int bus, dev; + int vendor_id, product_id; + char *vendor; + char *product; + char *manufacturer; + char *device; + char *serial; + + int dev_class; + int dev_subclass; + int dev_protocol; + char *dev_class_str; + char *dev_subclass_str; + char *dev_protocol_str; + + char *usb_version; + char *device_version; /* bcdDevice */ + + int max_curr_ma; + + int speed_mbs; + + vendor_list vendors; + + gboolean user_scan; /* not scanned as root */ + struct usbi *if_list; + + struct usbd *next; +} usbd; + +/* another linked list */ +typedef struct usbi { + int if_number; + int if_class; + int if_subclass; + int if_protocol; + char *if_label; + char *if_class_str; + char *if_subclass_str; + char *if_protocol_str; + char *driver; + + struct usbi *next; +} usbi; + +usbd *usb_get_device_list(); +int usbd_list_count(usbd *); +void usbd_list_free(usbd *); +void usb_lookup_ids_vendor_product_str(gint vendor_id, gint product_id, + gchar **vendor_str, gchar **product_str); + +usbd *usb_get_device(int bus, int dev, const gchar* sysfspath); +void usbd_free(usbd *); + +#endif diff --git a/includes/vendor.h b/includes/vendor.h index 778e2ea3..213adaf8 100644 --- a/includes/vendor.h +++ b/includes/vendor.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2007 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,16 +18,62 @@ #ifndef __VENDOR_H__ #define __VENDOR_H__ +#include "gg_slist.h" -typedef struct _Vendor Vendor; -struct _Vendor { - char *id; +typedef GSList* vendor_list; +#define vendor_list_append(vl, v) g_slist_append(vl, (Vendor*)v) +#define vendor_list_concat(vl, ext) g_slist_concat(vl, ext) +vendor_list vendor_list_concat_va(int count, vendor_list vl, ...); /* count = -1 for NULL terminated list */ +#define vendor_list_free(vl) g_slist_free(vl) +#define vendor_list_remove_duplicates(vl) gg_slist_remove_duplicates(vl) +vendor_list vendor_list_remove_duplicates_deep(vendor_list vl); + +enum { + VENDOR_MATCH_RULE_WORD_IGNORE_CASE = 0, + VENDOR_MATCH_RULE_WORD_MATCH_CASE = 1, + VENDOR_MATCH_RULE_EXACT = 2, + VENDOR_MATCH_RULE_WORD_PREFIX_IGNORE_CASE = 3, + VENDOR_MATCH_RULE_WORD_PREFIX_MATCH_CASE = 4, + VENDOR_MATCH_RULE_WORD_SUFFIX_IGNORE_CASE = 5, + VENDOR_MATCH_RULE_WORD_SUFFIX_MATCH_CASE = 6, + /* "ST" hits for "ST3600A" but not "AST" or "STMicro" or "STEC" */ + VENDOR_MATCH_RULE_NUM_PREFIX_IGNORE_CASE = 7, + VENDOR_MATCH_RULE_NUM_PREFIX_MATCH_CASE = 8, +}; + +typedef struct { + char *match_string; + int match_rule; /* VENDOR_MATCH_RULE_* enum */ char *name; + char *name_short; char *url; -}; + char *url_support; + char *wikipedia; /* wikipedia page title (assumes en:, otherwise include langauge), usually more informative than the vendor's page */ + char *note; /* a short stored comment */ + char *ansi_color; + + unsigned long file_line; + unsigned long ms_length; + unsigned long weight; + gboolean has_parens; +} Vendor; + +void vendor_init(void); +void vendor_cleanup(void); +/* end list of strings with NULL */ +const Vendor *vendor_match(const gchar *id_str, ...) + __attribute__((sentinel)); +vendor_list vendors_match(const gchar *id_str, ...) + __attribute__((sentinel)); +const gchar *vendor_get_name(const gchar *id_str); +const gchar *vendor_get_shortest_name(const gchar *id_str); +const gchar *vendor_get_url(const gchar *id_str); +gchar *vendor_get_link(const gchar *id_str); +gchar *vendor_get_link_from_vendor(const Vendor *v); +void vendor_free(Vendor *v); + +vendor_list vendors_match_core(const gchar *str, int limit); -void vendor_init(void); -const gchar *vendor_get_name(const gchar *id); -const gchar *vendor_get_url(const gchar *id); +extern gboolean vendor_die_on_error; #endif /* __VENDOR_H__ */ diff --git a/includes/x86/processor-platform.h b/includes/x86/processor-platform.h index a89a831f..0e9a276b 100644 --- a/includes/x86/processor-platform.h +++ b/includes/x86/processor-platform.h @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2006 L. A. F. Pereira <l@tia.mat.br> * * 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, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/includes/x_util.h b/includes/x_util.h new file mode 100644 index 00000000..4d398c94 --- /dev/null +++ b/includes/x_util.h @@ -0,0 +1,104 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 L. A. F. Pereira <l@tia.mat.br> + * This file + * 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, version 2 or later. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __X_UTIL_H__ +#define __X_UTIL_H__ + +/* wayland information (lives here in x_util for now) */ +typedef struct { + char *xdg_session_type; + char *display_name; +} wl_info; + +wl_info *get_walyand_info(); +void wl_free(wl_info *); + +typedef struct { + char *glx_version; + int direct_rendering; + char *ogl_vendor, *ogl_renderer; + + char *ogl_core_version, *ogl_core_sl_version; + char *ogl_version, *ogl_sl_version; /* compat */ + char *ogles_version, *ogles_sl_version; +} glx_info; + +glx_info *glx_create(); +gboolean fill_glx_info(glx_info *glx); +void glx_free(glx_info *glx); + +typedef struct { + int number; + int px_width; + int px_height; + int min_px_width; + int min_px_height; + int max_px_width; + int max_px_height; +} x_screen; + +typedef struct { + /* I guess it is kindof like gpu? */ + int reserved; /* TODO: */ +} x_provider; + +typedef struct { + char name[64]; + int connected; + int screen; /* index into xrr_info.screens[], look there for x screen number */ + int px_width; + int px_height; + int px_offset_x; + int px_offset_y; + int mm_width; + int mm_height; +} x_output; + +typedef struct { + int reserved; /* TODO: */ +} x_monitor; + +typedef struct { + char *display_name; + int screen_count; + x_screen *screens; + int provider_count; + x_provider *providers; + int output_count; + x_output *outputs; + int monitor_count; + x_monitor *monitors; +} xrr_info; + +xrr_info *xrr_create(); +gboolean fill_xrr_info(xrr_info *xrr); +void xrr_free(xrr_info *xrr); + +typedef struct { + int nox; /* complete failure to find X */ + char *display_name, *vendor, *version, *release_number; + xrr_info *xrr; + glx_info *glx; +} xinfo; + +xinfo *xinfo_get_info(); +void xinfo_free(xinfo *xi); + +#endif diff --git a/includes/xmlrpc-client.h b/includes/xmlrpc-client.h deleted file mode 100644 index 32fad08c..00000000 --- a/includes/xmlrpc-client.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * XMLRPC Client - * HardInfo - Displays System Information - * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org> - * - * 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, version 2. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __XMLRPC_CLIENT_H__ -#define __XMLRPC_CLIENT_H__ - -#include "config.h" - -#ifdef HAS_LIBSOUP -#include <libsoup/soup.h> - -void xmlrpc_init(void); -gint xmlrpc_get_integer(gchar *addr, - gchar *method, - const gchar *param_types, - ...); -gchar *xmlrpc_get_string(gchar *addr, - gchar *method, - const gchar *param_types, - ...); -GValueArray *xmlrpc_get_array(gchar *addr, - gchar *method, - const gchar *param_types, - ...); -#endif /* HAS_LIBSOUP */ - -#endif /* __XMLRPC_CLIENT_H__ */ |