Commit 14632e65 authored by Andrey Filippov's avatar Andrey Filippov

debugging exif, moved here other gps/imu related scripts

parent 09f51911
#TODO: pass $(LN) from bitbake
WWW_PAGES = /www/pages LN = ln
WWW_PAGES = /www/pages/
BINDIR = /usr/bin/ BINDIR = /usr/bin/
VARHTML = /var/volatile/html/
CONFDIR = /etc/elphel393/
INSTMODE = 0755 INSTMODE = 0755
INSTDOCS = 0644 INSTDOCS = 0644
INSTOWNER = root INSTOWNER = root
...@@ -9,7 +12,8 @@ INSTGROUP = root ...@@ -9,7 +12,8 @@ INSTGROUP = root
PROGS = nmea2exif log_imu PROGS = nmea2exif log_imu
SRCS = nmea2exif.c log_imu.c SRCS = nmea2exif.c log_imu.c
OBJS = nmea2exif.o OBJS = nmea2exif.o
PHPSCRIPTS= logger_launcher.php imu_setup.php start_gps_compass.php PHPSCRIPTS= start_gps_compass.php
PHPWEB= logger_launcher.php imu_setup.php
CFLAGS += -Wall -I$(STAGING_DIR_HOST)/usr/include-uapi CFLAGS += -Wall -I$(STAGING_DIR_HOST)/usr/include-uapi
LDLIBS += -lm LDLIBS += -lm
...@@ -27,7 +31,13 @@ install: $(PROGS) ...@@ -27,7 +31,13 @@ install: $(PROGS)
$(INSTALL) -d $(DESTDIR)$(BINDIR) $(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -d $(DESTDIR)$(WWW_PAGES) $(INSTALL) -d $(DESTDIR)$(WWW_PAGES)
$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(DESTDIR)$(BINDIR) $(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(DESTDIR)$(BINDIR)
$(INSTALL) -o $(INSTOWNER) -m $(INSTDOCS) $(PHPSCRIPTS) $(DESTDIR)$(WWW_PAGES) $(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PHPSCRIPTS) $(DESTDIR)$(BINDIR)
$(INSTALL) -o $(INSTOWNER) -m $(INSTDOCS) $(PHPWEB) $(DESTDIR)$(WWW_PAGES)
$(INSTALL) $(OWN)-d $(DESTDIR)$(VARHTML)
$(LN) -sf $(VARHTML) $(DESTDIR)$(WWW_PAGES)var
$(INSTALL) $(OWN)-d $(DESTDIR)$(CONFDIR)
$(LN) -sf $(CONFDIR) $(DESTDIR)$(WWW_PAGES)etc
clean: clean:
rm -rf $(PROGS) *.o *~ rm -rf $(PROGS) *.o *~
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
//#define EXIF_DEV "/dev/exif_meta" //#define EXIF_DEV "/dev/exif_meta"
#define PROGRAM_SERIAL 0 #define PROGRAM_SERIAL 0
//#define D(x) #define D(x)
#define D(x) x //#define D(x) x
// TODO: use only existing sensor channels? // TODO: use only existing sensor channels?
const char *exif_paths[SENSOR_PORTS] = { const char *exif_paths[SENSOR_PORTS] = {
...@@ -345,7 +345,37 @@ void process_GPGGA(char*response, struct meta_GPSInfo_t *meta) { ...@@ -345,7 +345,37 @@ void process_GPGGA(char*response, struct meta_GPSInfo_t *meta) {
/// Skip 14 = Diff. reference station ID# /// Skip 14 = Diff. reference station ID#
} }
void debug_meta(struct meta_GPSInfo_t *meta)
{
unsigned char * buf = (unsigned char *) meta;
int i;
printf("GPSLatitudeRef %c)\n", meta->GPSLatitudeRef);
printf("GPSLatitude_deg_nom 0x%x)\n",__be32_to_cpu(meta->GPSLatitude_deg_nom));
printf("GPSLatitude_deg_denom 0x%x)\n",__be32_to_cpu(meta->GPSLatitude_deg_denom));
printf("GPSLatitude_min_nom 0x%x)\n",__be32_to_cpu(meta->GPSLatitude_min_nom));
printf("GPSLatitude_min_denom 0x%x)\n",__be32_to_cpu(meta->GPSLatitude_min_denom));
printf("GPSLongitudeRef %c)\n", meta->GPSLongitudeRef);
printf("GPSLongitude_deg_nom 0x%x)\n",__be32_to_cpu(meta->GPSLongitude_deg_nom));
printf("GPSLongitude_deg_denom 0x%x)\n",__be32_to_cpu(meta->GPSLongitude_deg_denom));
printf("GPSLongitude_min_nom 0x%x)\n",__be32_to_cpu(meta->GPSLongitude_min_nom));
printf("GPSLongitude_min_denom 0x%x)\n",__be32_to_cpu(meta->GPSLongitude_min_denom));
printf("GPSAltitudeRef %c)\n", meta->GPSAltitudeRef);
printf("GPSAltitude_nom 0x%x)\n",__be32_to_cpu(meta->GPSAltitude_nom));
printf("GPSAltitude_denom 0x%x)\n",__be32_to_cpu(meta->GPSAltitude_denom));
printf("GPSTimeStamp_hrs_nom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_hrs_nom));
printf("GPSTimeStamp_hrs_denom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_hrs_denom));
printf("GPSTimeStamp_min_nom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_min_nom));
printf("GPSTimeStamp_min_denom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_min_denom));
printf("GPSTimeStamp_sec_nom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_sec_nom));
printf("GPSTimeStamp_sec_denom 0x%x)\n",__be32_to_cpu(meta->GPSTimeStamp_sec_denom));
printf("GPSDateStamp %s)\n", meta->GPSDateStamp);
printf("GPSMeasureMode %c)", meta->GPSMeasureMode);
for (i = 0; i < sizeof (struct meta_GPSInfo_t); i++){
if ((i & 0xf) == 0) printf("\n%02x:",i);
printf(" %02x",(int) buf[i]);
}
printf("\n");
}
...@@ -373,9 +403,9 @@ int main(int argc, char *argv[]) { ...@@ -373,9 +403,9 @@ int main(int argc, char *argv[]) {
fd_exif[chn] = open(exif_paths[chn], O_RDWR); fd_exif[chn] = open(exif_paths[chn], O_RDWR);
if (fd_exif[chn] < 0) { if (fd_exif[chn] < 0) {
fprintf(stderr,"Can not open device file %s\n",exif_paths[chn]); fprintf(stderr,"Can not open device file %s\n",exif_paths[chn]);
}
} else good_chns++; } else good_chns++;
} }
}
if (!good_chns){ if (!good_chns){
fprintf(stderr,"Could not open any of EXIF channel device files, aborting\n"); fprintf(stderr,"Could not open any of EXIF channel device files, aborting\n");
exit (-1); exit (-1);
...@@ -434,14 +464,19 @@ int main(int argc, char *argv[]) { ...@@ -434,14 +464,19 @@ int main(int argc, char *argv[]) {
// D(printf ("Got GPRMC\n")); // D(printf ("Got GPRMC\n"));
D(printf ("Got NMEA string >>%s<<\n",response+1)); D(printf ("Got NMEA string >>%s<<\n",response+1));
process_GPRMC(response, &meta); process_GPRMC(response, &meta);
D(printf ("sizeof(meta)=0x%x\n",sizeof(meta)));
D(debug_meta(&meta));
for (chn =0; chn < SENSOR_PORTS; chn++) if (fd_exif[chn]>=0){ for (chn =0; chn < SENSOR_PORTS; chn++) if (fd_exif[chn]>=0){
lseek (fd_exif[chn],Exif_GPSInfo_GPSLatitudeRef,SEEK_END); /// position file pointer at the beginning of the data field for GPSLatitudeRef lseek (fd_exif[chn],Exif_GPSInfo_GPSLatitudeRef,SEEK_END); /// position file pointer at the beginning of the data field for GPSLatitudeRef
D(printf ("filepos(%d)=0x%x\n",chn, (int)lseek (fd_exif[chn],0,SEEK_CUR)));
write (fd_exif[chn], &meta, sizeof(meta)); write (fd_exif[chn], &meta, sizeof(meta));
} }
} else if (!memcmp(response+1,"GPGGA", sizeof("GPGGA")-1)) { } else if (!memcmp(response+1,"GPGGA", sizeof("GPGGA")-1)) {
// D(printf ("Got GPRMC\n")); // D(printf ("Got GPRMC\n"));
D(printf ("Got NMEA string >>%s<<\n",response+1)); D(printf ("Got NMEA string >>%s<<\n",response+1));
process_GPGGA(response, &meta); process_GPGGA(response, &meta);
D(printf ("sizeof(meta)=0x%x\n",sizeof(meta)));
D(debug_meta(&meta));
for (chn =0; chn < SENSOR_PORTS; chn++) if (fd_exif[chn]>=0){ for (chn =0; chn < SENSOR_PORTS; chn++) if (fd_exif[chn]>=0){
lseek (fd_exif[chn],Exif_GPSInfo_GPSLatitudeRef,SEEK_END); /// position file pointer at the beginning of the data field for GPSLatitudeRef lseek (fd_exif[chn],Exif_GPSInfo_GPSLatitudeRef,SEEK_END); /// position file pointer at the beginning of the data field for GPSLatitudeRef
write (fd_exif[chn], &meta, sizeof(meta)); write (fd_exif[chn], &meta, sizeof(meta));
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment