summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.bzrignore2
-rwxr-xr-xpci5
-rw-r--r--pcilib/plugin.c12
3 files changed, 17 insertions, 2 deletions
diff --git a/.bzrignore b/.bzrignore
index 371cdfe..a32f269 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -25,6 +25,6 @@ apps/heb_strip_bad_values
*.out
apps/check_counter
apps/lorenzo_ipedma_test
-pci
pcitool.pc
config.h
+pcitool/pci
diff --git a/pci b/pci
new file mode 100755
index 0000000..80fde98
--- /dev/null
+++ b/pci
@@ -0,0 +1,5 @@
+#! /bin/bash
+
+APP_PATH=`dirname $0`
+
+LD_LIBRARY_PATH="$APP_PATH/pcilib" $APP_PATH/pcitool/pci $*
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) {