Skip to content
Permalink
Browse files

firmware: switched to D-Bus

  • Loading branch information
ocerman authored and lpereira committed Jan 4, 2020
1 parent b6f45ad commit 43498b2a714b7fabd61c9a90ff7fabb910165893
Showing with 171 additions and 139 deletions.
  1. +13 −0 hardinfo/info.c
  2. +20 −0 hardinfo/util.c
  3. +1 −0 includes/hardinfo.h
  4. +1 −0 includes/info.h
  5. +136 −139 modules/devices/firmware.c
@@ -431,6 +431,19 @@ gchar *info_flatten(struct Info *info)
return g_string_free(values, FALSE);
}

void info_remove_group(struct Info *info, guint index)
{
struct InfoGroup *grp;

if (index >= info->groups->len)
return;

grp = &g_array_index(info->groups, struct InfoGroup, index);
free_group_fields(grp);

g_array_remove_index(info->groups, index);
}

struct InfoField *info_find_field(struct Info *info, const gchar *tag, const gchar *name) {
struct InfoGroup *group;
struct InfoField *field;
@@ -1349,6 +1349,26 @@ gboolean g_strv_contains(const gchar * const * strv, const gchar *str) {
}
#endif

gchar *hardinfo_clean_grpname(const gchar *v, int replacing) {
gchar *clean, *p;

p = clean = g_strdup(v);
while (*p != 0) {
switch(*p) {
case '[':
*p = '('; break;
case ']':
*p = ')'; break;
default:
break;
}
p++;
}
if (replacing)
g_free((gpointer)v);
return clean;
}

/* Hardinfo labels that have # are truncated and/or hidden.
* Labels can't have $ because that is the delimiter in
* moreinfo. */
@@ -193,6 +193,7 @@ gboolean g_strv_contains(const gchar * const * strv, const gchar *str);
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.
@@ -75,6 +75,7 @@ struct InfoField {

struct Info *info_new(void);

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);

0 comments on commit 43498b2

Please sign in to comment.
You can’t perform that action at this time.