36 #include <linux/input.h>
46 static void *
baro_read(
void *data __attribute__((unused)))
48 struct input_event
ev;
51 int fd_sonar = open(
"/dev/input/baro_event", O_RDONLY);
53 printf(
"Unable to open baro event to read pressure\n");
59 n = read(fd_sonar, &
ev,
sizeof(
ev));
60 if (n ==
sizeof(
ev) &&
ev.type == EV_ABS &&
ev.code == ABS_PRESSURE) {
80 pthread_t baro_thread;
81 if (pthread_create(&baro_thread, NULL,
baro_read, NULL) != 0) {
82 printf(
"[swing_board] Could not create baro reading thread!\n");
84 pthread_setname_np(baro_thread,
"pprz_baro_thread");