sysinfo: Simplify finding pci.ids file on Unix
There is probably no reason to make this user configurable just get the correct one at build time...
This commit is contained in:
parent
2d184c0967
commit
99e16110bc
@ -9,6 +9,7 @@ sysinfo_deps = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
sysinfo_includes = []
|
sysinfo_includes = []
|
||||||
|
sysinfo_cargs = []
|
||||||
|
|
||||||
system = host_machine.system()
|
system = host_machine.system()
|
||||||
if system == 'linux' or system == 'darwin'
|
if system == 'linux' or system == 'darwin'
|
||||||
@ -18,7 +19,8 @@ if system == 'linux' or system == 'darwin'
|
|||||||
]
|
]
|
||||||
|
|
||||||
if system == 'linux'
|
if system == 'linux'
|
||||||
sysinfo_deps += dependency('libpci')
|
libpci = dependency('libpci')
|
||||||
|
sysinfo_deps += libpci
|
||||||
sysinfo_includes += 'unix'
|
sysinfo_includes += 'unix'
|
||||||
sysinfo_sources += [
|
sysinfo_sources += [
|
||||||
'unix/backend.c',
|
'unix/backend.c',
|
||||||
@ -26,6 +28,10 @@ if system == 'linux' or system == 'darwin'
|
|||||||
'unix/parse.c',
|
'unix/parse.c',
|
||||||
'unix/pci.c',
|
'unix/pci.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
picidsdir = libpci.get_pkgconfig_variable('idsdir')
|
||||||
|
pciids = join_paths(picidsdir, 'pci.ids')
|
||||||
|
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
|
||||||
elif system == 'darwin'
|
elif system == 'darwin'
|
||||||
add_languages('objc')
|
add_languages('objc')
|
||||||
sysinfo_sources += 'osx/backend.m'
|
sysinfo_sources += 'osx/backend.m'
|
||||||
@ -40,7 +46,8 @@ endif
|
|||||||
shared_module('sysinfo', sysinfo_sources,
|
shared_module('sysinfo', sysinfo_sources,
|
||||||
dependencies: sysinfo_deps,
|
dependencies: sysinfo_deps,
|
||||||
include_directories: include_directories(sysinfo_includes),
|
include_directories: include_directories(sysinfo_includes),
|
||||||
|
c_args: sysinfo_cargs,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: plugindir,
|
install_dir: plugindir,
|
||||||
name_prefix: '',
|
name_prefix: '',
|
||||||
)
|
)
|
||||||
|
@ -133,16 +133,6 @@ print_info (char *info, gboolean announce)
|
|||||||
hexchat_print (ph, _("Sysinfo: No info by that name\n"));
|
hexchat_print (ph, _("Sysinfo: No info by that name\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Simple wrapper for backend specific options.
|
|
||||||
* Ensure dest >= 512.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
sysinfo_get_str_pref (const char *pref, char *dest)
|
|
||||||
{
|
|
||||||
return hexchat_pluginpref_get_str (ph, pref, dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sysinfo_get_bool_pref (const char *pref, gboolean def)
|
sysinfo_get_bool_pref (const char *pref, gboolean def)
|
||||||
{
|
{
|
||||||
@ -184,24 +174,6 @@ sysinfo_set_pref (char *key, char *value)
|
|||||||
sysinfo_set_pref_real (key, value, DEFAULT_ANNOUNCE);
|
sysinfo_set_pref_real (key, value, DEFAULT_ANNOUNCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LIBPCI
|
|
||||||
else if (!strcmp (key, "pciids"))
|
|
||||||
{
|
|
||||||
if (value && value[0])
|
|
||||||
{
|
|
||||||
hexchat_pluginpref_set_str (ph, "pciids", value);
|
|
||||||
hexchat_printf (ph, _("Sysinfo: pciids is set to: %s\n"), value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char buf[512];
|
|
||||||
if (hexchat_pluginpref_get_str (ph, "pciids", buf) == 0)
|
|
||||||
strcpy (buf, DEFAULT_PCIIDS);
|
|
||||||
hexchat_printf (ph, _("Sysinfo: pciids is set to: %s\n"), buf);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (g_str_has_prefix (key, "hide_"))
|
else if (g_str_has_prefix (key, "hide_"))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -22,8 +22,5 @@
|
|||||||
#define SYSINFO_H
|
#define SYSINFO_H
|
||||||
|
|
||||||
#define bsize 1024
|
#define bsize 1024
|
||||||
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
|
||||||
|
|
||||||
int sysinfo_get_str_pref (const char *name, char *dest);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,11 +122,8 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
|||||||
char *position;
|
char *position;
|
||||||
int cardfound = 0;
|
int cardfound = 0;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (!sysinfo_get_str_pref ("pciids", buffer))
|
|
||||||
strcpy (buffer, DEFAULT_PCIIDS);
|
|
||||||
|
|
||||||
fp = fopen (buffer, "r");
|
fp = fopen (PCIIDS_FILE, "r");
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
{
|
{
|
||||||
g_snprintf(fullname, bsize, "%s:%s", vendor, device);
|
g_snprintf(fullname, bsize, "%s:%s", vendor, device);
|
||||||
|
Loading…
Reference in New Issue
Block a user