summaryrefslogtreecommitdiffstats
path: root/pcilib
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib')
-rw-r--r--pcilib/plugin.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pcilib/plugin.c b/pcilib/plugin.c
index 663bb27..12dbf1d 100644
--- a/pcilib/plugin.c
+++ b/pcilib/plugin.c
@@ -7,6 +7,7 @@
#include <sys/types.h>
#include "model.h"
+#include "error.h"
#include "pci.h"
#include "config.h"
@@ -42,13 +43,22 @@ void *pcilib_plugin_get_symbol(void *plug, const char *symbol) {
const pcilib_model_description_t *pcilib_get_plugin_model(pcilib_t *pcilib, void *plug, unsigned short vendor_id, unsigned short device_id, const char *model) {
void *get_model;
+ const pcilib_model_description_t *model_info;
if (!plug) return NULL;
get_model = dlsym(plug, "pcilib_get_event_model");
if (!get_model) return NULL;
- return ((const pcilib_model_description_t *(*)(pcilib_t *pcilib, unsigned short vendor_id, unsigned short device_id, const char *model))get_model)(pcilib, vendor_id, device_id, model);
+ model_info = ((const pcilib_model_description_t *(*)(pcilib_t *pcilib, unsigned short vendor_id, unsigned short device_id, const char *model))get_model)(pcilib, vendor_id, device_id, model);
+ if (!model_info) return model_info;
+
+ if (model_info->interface_version != PCILIB_EVENT_INTERFACE_VERSION) {
+ pcilib_warning("Plugin %s exposes outdated interface version (%lu), pcitool supports (%lu)", model_info->name, model_info->interface_version, PCILIB_EVENT_INTERFACE_VERSION);
+ return NULL;
+ }
+
+ return model_info;
}
const pcilib_model_description_t *pcilib_find_plugin_model(pcilib_t *pcilib, unsigned short vendor_id, unsigned short device_id, const char *model) {