summaryrefslogtreecommitdiff
path: root/android/gpsd_wrapper.c
blob: 125203820167a78d3dfb3156dc8c6e2935e2260b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>
#include <android/log.h>
#include <cutils/properties.h>
#include <sys/system_properties.h>

int main (){
	char gpsd_params[PROP_VALUE_MAX];
	char cmd[1024];
	int i = 0;
	property_get("service.gpsd.parameters", gpsd_params, "-Nn,-D2,/dev/ttyACM0,/dev/ttyACM1");
	while (gpsd_params[i] != 0){
		if (gpsd_params[i] == ',') gpsd_params[i] = ' ';
		i++;
	}

	sprintf(cmd, "/vendor/bin/logwrapper /vendor/bin/gpsd %s", gpsd_params);

	__android_log_print(ANDROID_LOG_DEBUG, "gpsd_wrapper", "Starting gpsd: %s", cmd);

	system(cmd);
	return 0;
}