diff options
Diffstat (limited to 'hardinfo2')
-rw-r--r-- | hardinfo2/hardinfo.c | 5 | ||||
-rw-r--r-- | hardinfo2/pci_util.c | 4 | ||||
-rw-r--r-- | hardinfo2/udisks2_util.c | 8 | ||||
-rw-r--r-- | hardinfo2/vendor.c | 66 |
4 files changed, 18 insertions, 65 deletions
diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c index edbad308..5d4655c3 100644 --- a/hardinfo2/hardinfo.c +++ b/hardinfo2/hardinfo.c @@ -41,9 +41,10 @@ int main(int argc, char **argv) DEBUG("Hardinfo2 version " VERSION ". Debug version."); -#if GLIB_CHECK_VERSION(2,32,0) +#if GLIB_CHECK_VERSION(2,32,5) #else - if (!g_thread_supported ()) g_thread_init (NULL); + //if (!g_thread_supported ()) g_thread_init(NULL); + g_type_init (); #endif /* parse all command line parameters */ diff --git a/hardinfo2/pci_util.c b/hardinfo2/pci_util.c index f0c5059a..d4a9dea3 100644 --- a/hardinfo2/pci_util.c +++ b/hardinfo2/pci_util.c @@ -46,12 +46,8 @@ const gchar *find_pci_ids_file() { } } char *file_search_order[] = { - g_strdup("/usr/share/hwdata/pci.ids"), - g_strdup("/usr/share/misc/pci.ids"), g_build_filename(g_get_user_config_dir(), "hardinfo2", "pci.ids", NULL), g_build_filename(params.path_data, "pci.ids", NULL), - g_build_filename(g_get_user_config_dir(), "hardinfo2", "pci.ids.min", NULL), - g_build_filename(params.path_data, "pci.ids.min", NULL), NULL }; int n; diff --git a/hardinfo2/udisks2_util.c b/hardinfo2/udisks2_util.c index 42ca0e91..67a3e1e6 100644 --- a/hardinfo2/udisks2_util.c +++ b/hardinfo2/udisks2_util.c @@ -210,8 +210,12 @@ GDBusConnection* get_udisks2_connection(void) { return NULL; } + if(!result) { + return NULL; + }else{ + g_variant_unref(result); + } // OK, let's return connection to system bus - g_variant_unref(result); return conn; } @@ -629,7 +633,7 @@ GSList* get_udisks2_all_drives_info(void){ void udisks2_init(){ if (udisks2_conn == NULL){ - udisks2_conn = get_udisks2_connection(); + udisks2_conn = get_udisks2_connection(); } } diff --git a/hardinfo2/vendor.c b/hardinfo2/vendor.c index 9230c696..2031ac44 100644 --- a/hardinfo2/vendor.c +++ b/hardinfo2/vendor.c @@ -76,50 +76,6 @@ int vendor_sort (const Vendor *ap, const Vendor *bp) { return lb-la; } -static int read_from_vendor_conf(const char *path) { - GKeyFile *vendors_file; - gchar *tmp; - gint num_vendors, i, count = 0; /* num_vendors is file-reported, count is actual */ - - DEBUG("using vendor.conf format loader for %s", path); - - vendors_file = g_key_file_new(); - if (g_key_file_load_from_file(vendors_file, path, 0, NULL)) { - num_vendors = g_key_file_get_integer(vendors_file, "vendors", "number", NULL); - - for (i = num_vendors - 1; i >= 0; i--) { - Vendor *v = g_new0(Vendor, 1); - - tmp = g_strdup_printf("vendor%d", i); - - v->match_string = g_key_file_get_string(vendors_file, tmp, "match_string", NULL); - if (v->match_string == NULL) { - /* try old name */ - v->match_string = g_key_file_get_string(vendors_file, tmp, "id", NULL); - } - if (v->match_string) { - v->match_rule = g_key_file_get_integer(vendors_file, tmp, "match_case", NULL); - v->name = g_key_file_get_string(vendors_file, tmp, "name", NULL); - v->name_short = g_key_file_get_string(vendors_file, tmp, "name_short", NULL); - v->url = g_key_file_get_string(vendors_file, tmp, "url", NULL); - v->url_support = g_key_file_get_string(vendors_file, tmp, "url_support", NULL); - - vendors = g_slist_prepend(vendors, v); - count++; - } else { - /* don't add if match_string is null */ - g_free(v); - } - - g_free(tmp); - } - g_key_file_free(vendors_file); - DEBUG("... found %d match strings", count); - return count; - } - g_key_file_free(vendors_file); - return 0; -} static int read_from_vendor_ids(const char *path) { #define VEN_BUFF_SIZE 128 @@ -251,25 +207,27 @@ static int read_from_vendor_ids(const char *path) { void vendor_init(void) { gchar *path; - static SyncEntry se = { + static SyncEntry se1; + static SyncEntry se2 = { .name = N_("Update vendor list"), .file_name = "vendor.ids", + .optional = TRUE, }; + se1.name = N_("Check Update Version"); + se1.file_name = g_strdup_printf("blobs-update-version.json"); + se1.optional=FALSE; + /* already initialized */ if (vendors) return; DEBUG("initializing vendor list"); - sync_manager_add_entry(&se); + sync_manager_add_entry(&se2); + sync_manager_add_entry(&se1); char *file_search_order[] = { - /* new format */ g_build_filename(g_get_user_config_dir(), "hardinfo2", "vendor.ids", NULL), g_build_filename(params.path_data, "vendor.ids", NULL), - /* old format */ - g_build_filename(g_get_user_config_dir(), "hardinfo2", "vendor.conf", NULL), - g_build_filename(g_get_home_dir(), ".hardinfo2", "vendor.conf", NULL), /* old place */ - g_build_filename(params.path_data, "vendor.conf", NULL), NULL }; @@ -286,16 +244,10 @@ void vendor_init(void) int fail = 1; - /* new format */ if (path && strstr(path, "vendor.ids")) { fail = !read_from_vendor_ids(path); } - /* old format */ - if (path && strstr(path, "vendor.conf")) { - fail = !read_from_vendor_conf(path); - } - if (fail) { gint i; |