Re: Maemo Mapper - no GPS info and satellite details
2 Attachment(s)
:cool:
A more crazy one:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
void set_gps(int fd, int msg_type, int mode, int rate, char *buf, int buf_len);
int
main(int argc, char **argv)
{
char cmdbuf[1024]={0};
char buf[64];
char *real_gpsd = "/usr/sbin/gpsd_real ";
int i;
//the real gpsd executable:
snprintf(cmdbuf, 1024, "%s", "/usr/sbin/gpsd_real ");
for ( i=1; i<argc; i++)
{
strncat(cmdbuf, argv[i], 1024);
strncat(cmdbuf, " ", 1);
}
strncat(cmdbuf, "&", 1);
printf("Executing: %s\n", cmdbuf);
system(cmdbuf);
//poll for the bluetooh to be ready
while (system ("ls /dev/rfcomm0 >> /dev/null") != 0)
{
sleep(2);
}
while (1)
{
int fd=open("/dev/rfcomm0", O_RDWR);
set_gps(fd, 1, 0, 1, buf, 64);
set_gps(fd, 2, 0, 5, buf, 64);
set_gps(fd, 3, 0, 1, buf, 64);
set_gps(fd, 5, 0, 1, buf, 64);
//quit if the gps module has gone
if (system ("ls /dev/rfcomm0 >> /dev/null") != 0)
{
system("killall gpsd_real");
return 0;
}
sleep(60);
}
}
/*
* fd: the file to write
* msg_type: NMEA msg type: 1-9
* mode: query or setRate: 0=setRate, 1=Query
* rate: off=0, max=255, unit: second
* buf: output buffer
* buf_len: output buffer len
*/
void set_gps(int fd, int msg_type, int mode, int rate, char *buf, int buf_len)
{
char *sptr=0;
char *ptail=0;
int csum=0;
int buf_tmp_size=0;
memset(buf, 0, buf_len);
snprintf(buf, buf_len, "%s,0%d,0%d,0%d,01*", "$PSRF103", msg_type, mode, rate);
sptr=buf+1; /*skip the $*/
buf_tmp_size=strlen(buf);
ptail=buf+buf_tmp_size;
while(*sptr && *sptr != '*')
csum ^= *sptr++;
snprintf(ptail, buf_len-buf_tmp_size, "%x\r\n", csum);
printf("%s", buf);
write(fd, buf, strlen(buf));
}
save it as gps_set.c and compile it:
Code:
gcc -o gpsd gps_set.c
and then copy the real gpsd in /usr/sbin to /usr/sbin/gpsd_real:
Code:
cp /usr/sbin/gpsd /usr/sbin/gpsd_real
and place the gpsd we just compiled above to /usr/sbin
now start maemo mapper and connect to your T805 (The T805 really sucks, this took me a whole day to fix this problem....) and now you should see all the details .......
:cool: Crazy enough?
One thing I should repeat here:
I do not remommend doing this but this is just an alternative. I recommend to fix this in maemo mapper itself or the official gpsd source codes.
source file and binary are attached.
source file: Attachment 4096
binary: Attachment 4097
well, I don't guarantee this will work for you, but just make it a reference of possible fix.
|