summaryrefslogtreecommitdiffstats
path: root/apps/grab.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/grab.c')
-rw-r--r--apps/grab.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/grab.c b/apps/grab.c
index 0f90e71..b891e2f 100644
--- a/apps/grab.c
+++ b/apps/grab.c
@@ -1,10 +1,22 @@
#include <stdio.h>
+#include <stdlib.h>
#include <pcilib.h>
#include <pcilib/error.h>
#include <ipecamera.h>
+void log_error(void *arg, const char *file, int line, pcilib_log_priority_t prio, const char *format, va_list ap) {
+ vprintf(format, ap);
+ printf("\n");
+
+ if (prio == PCILIB_LOG_ERROR) {
+ printf("Exiting at [%s:%u]\n\n", file, line);
+ exit(-1);
+ }
+}
+
+
int main() {
int err;
pcilib_event_id_t evid;
@@ -14,6 +26,8 @@ int main() {
void *data;
FILE *f;
+ pcilib_set_logger(PCILIB_LOG_WARNING, &log_error, NULL);
+
pcilib_t *pcilib = pcilib_open("/dev/fpga0", "ipecamera");
if (!pcilib) pcilib_error("Error opening device");