summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-05-03 02:31:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-05-03 02:31:15 +0200
commit88de46052e87ba7b84629163dd4946c9bb24cd22 (patch)
tree3c9c80434fa75558ec86bd072230b5c92f6d8874 /apps
parent5252a0049e0a509508a8f331222543620db0e6d3 (diff)
downloadipecamera-88de46052e87ba7b84629163dd4946c9bb24cd22.tar.gz
ipecamera-88de46052e87ba7b84629163dd4946c9bb24cd22.tar.bz2
ipecamera-88de46052e87ba7b84629163dd4946c9bb24cd22.tar.xz
ipecamera-88de46052e87ba7b84629163dd4946c9bb24cd22.zip
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
Diffstat (limited to 'apps')
-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");