gpsd_wrapper.c 579 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <android/log.h>
  4. #include <cutils/properties.h>
  5. #include <sys/system_properties.h>
  6. int main (){
  7. char gpsd_params[PROP_VALUE_MAX];
  8. char cmd[1024];
  9. int i = 0;
  10. property_get("service.gpsd.parameters", gpsd_params, "-Nn,-D2,/dev/ttyACM0,/dev/ttyACM1");
  11. while (gpsd_params[i] != 0){
  12. if (gpsd_params[i] == ',') gpsd_params[i] = ' ';
  13. i++;
  14. }
  15. sprintf(cmd, "/vendor/bin/logwrapper /vendor/bin/gpsd %s", gpsd_params);
  16. __android_log_print(ANDROID_LOG_DEBUG, "gpsd_wrapper", "Starting gpsd: %s", cmd);
  17. system(cmd);
  18. return 0;
  19. }