-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The SiRFnavIV API protocol #3
Comments
Thanks for your interest! Unfortunately, GPS in GT-I9100 does not output in SiRF Binary protocol (OSP or older SSB) - or at least nobody ever found out how to make them do it. Neither does it output in NMEA 0183. So the docs on OSP/NMEA don't help unfortunately. If it generated OSP (or NMEA), open source http://www.catb.org/gpsd/ would be able to parse them and provide GPS functionality (and it doesn't). So idea of this project is to try to find out what exactly is GSD4t in GT-9100 outputting (it is some other binary protocol, not OSP), and then make a converter to NMEA (or OSP). If that works, adding the support to gpsd(8) will be relatively easy. I've making some progress in decoding, but still nothing definitive. The front-page README.md will be updated when some significant breakthrough occurs (as will Replicant forum thread). |
@mnalis Ah, thank you for clarifying. Because from the website for GSD4t, I was under the impression that one could switch the output format by sending certain commands. If you have more HW details, I may be able to help you search. Perhaps we can dump the ROM and reverse from there? BTW. How can I find the correct device on the SlimKat 4.4.2b4 to connect with, and how? |
Yes, some of the chipsets seem to be capable to switch from OSP to NMEA mode and back. Unfortunately the GSD4t on GT-9100 does not run in either mode so OSP or NMEA commands could not be used; and if there exist such command in it's own binary protocol (for which is there no documentation) it is unknown. I suspect it depends on the firmware running on the GPS chip. Versions of HW and all details I have can be found in debug logs https://github.com/mnalis/gsd4t_logs/blob/master/strace6-rst-short/SLCLog.gp2.parsed.txt So while it might be possible to find other GPS firmware that would produce NMEA or OSP on that GSD4t, it might also brick it - so I've decided on non-intrusive read-only decoding effort. As for SlimKat, I haven't used it, but to find what device is GPS (so you can strace it as described in https://github.com/mnalis/gsd4t_parser/blob/master/README.txt about line 178) you should do something like
if SlimKat is anything like Cyanogenmod, the GPS device will only be opened when used, so |
@mnalis Thanks, that was a good tips, also for finding other devices. |
Yes, I'm running on SlimKat KK4.4.2b4 and found it under the same device as you. It's funny, it is very sensitive and stops output shortly, after dumping. Then I have to restart the GPS app. I use
|
@mnalis Is there any simple way to parse any of this from within phone? Also, check new comment in Replicant forum... Also, can you say something more about all the log files. It's hard to know what is the raw output (as from above) and what you have manipulated (and how)? |
Only non-invasive way is using strace on the phone (as detailed in README.txt in "strace_to_gp2.pl" section and below), then transfer that Or, if you lack hardware/software/time, you can simply take example log files from github and compare (for example, https://github.com/mnalis/gsd4t_logs/blob/master/strace6-rst-short/SLCLog.gp2.human.txt with https://github.com/mnalis/gsd4t_logs/blob/master/strace6-rst-short/strace.log.human.txt) First one (SLCLog.gp2.human.txt) is in parsed SiRF OSP format, which is understood by gpsd and output by closed-source android software. Second one (strace.log.human.txt) is raw output from GPS chip, with annotated parts where I've been able to match or guess the meaning of data. So, when there is no more unknown bytes (or, at least, no more IMPORTANT unknown bytes) in strace.log.human.txt the new binary protocol is understood, and one can start writing new parser for gpsd which could then work with GSD4t without closed-source software. |
Great work!
Ahh, of course! Thanks for reminding me. Easy to forget, and also explains other funny behavior I've seen on other devices recently. So I have been looking at your logs and it seem that yo have solved pretty much everything. Is that correct? I have also looked after some more documentation. And found THIS very useful manual. Then there is the code of the driver_sirf.c that could be useful to look at, because of its very nice comments. Especially line ~367. Which seem to suggest that the unknown sequences are some kind of mode change, but I'm not sure. For example, compare to page 106, where is suggests that last 2 bytes of payload, before the check-sum and End-Seq, is a bit rate. Oh, and another thing. Have you tried to sniff the network during the operation. It's possible that some of those sequences are binary ephemeris or almanac data, that is either downloaded from SGEE servers or from cache.
|
This document on the Fastrax IT430 may also be useful.
|
I just found a much more recent version of the OSP protocol, where some things seem to have changed, since the doc I posted above. |
Thanks for encouragement... No, while I have matched many of the messages, the few big ones (and unfortunately complicated ones) still remain, and I have a feeling they have the most important data. Sniffing the network is a good idea, but I'm currently only looking at downloading data from chip (not AGPS data which will be uploaded to the chip after being pulled from the Internet or cache). as for the OSD commands and NMEA, those unfortunately doesn't help as GSD4t don't speak either. |
(You mean OSP?) Then I assume you didn't actually bother to look at those documents. I have read 3 different documents/manuals, that all state that the GSD4t talk both OSP and NMEA when set properly. The Fastrax above, is based on that same chip. (I can help finding and reading documents, but I can't help when people are being stubborn.) We could both still be right, since "our" chip could have a different FW, from that found in other OTC sold chips. So what is your plan then? As I see it, there are only 3 options:
Also, what is it that make you believe that those remaining messages are more important? What are you missing? |
yes, I mean OSP, that was typo, sorry. Yes, the GSD4t solution does speak both OSP and NMEA, that is true. But the GSD4t chip does not. I'll try to explain. In past, we had SiRFstar III and like, which contained on themselves firmware which would speak NMEA and/or SiRF OSP via serial interface to the OS. Today, GSD4e works that way too. However, GSD4t was entry level (cheaper) solution, which means it does part of the job on host CPU (that is, same ARM Cortex-A9 CPU that the Android OS itself and all Android apps run on). Here is what the makers themselves say:
Which means you send SiRF OSP (or NMEA) commands to the "SiRFHost" software package (and others: SiRFInstantFix, SiRFLSM) runing on your main CPU, and not to the chip itself (as you would with GSD4e). So, as you can see, it is unfortunate that SiRF/CSR decided to call under the same name "gsd4t" two completely different things (both hardware chip that talks one unknown binary protocol only, and hardware+software "solution" which speaks standard NMEA and/or OSP) However, the goals of Replicant are to remove all non-free closed source software from host CPU. That means removing "SiRFHost" libraries (contained in /system/lib/hw/gps.exynos4.so), and, hence, removing OSP and NMEA support. So, what I set to do, is ultimately write free software replacement for "SiRFHost" libraries running on main CPU. And for that, I have to understand the unknown internal binary protocol which is being spoken between SiRFHost libraries and raw GPS chip (via /dev/ttySAC1 serial interface). Note that while it would be indeed very nice if we could remove all traces of non-free firmwares and thus liberate non-host CPUs, that is way way harder (as you don't even know what hardware it that firmware running on, you don't even have dissasemblers for it etc) so it borders on impossible. I hope I've managed to explain how GSD4t in Samsung Galaxy S2 speaks OSP and NMEA, and how we cannot use that for free software replacement (except as a debugging help during reverse engineering the unknown binary protocol). |
primarily, I intent to continue doing (1) (from strace ouput) and document and extract as much as possible information in human readable form. (currently the output is pretty coarse and generic). After that, I (or hopefully someone else would jump in) should learn a lot more up on general GPS operations (also http://www.catb.org/gpsd/gps-hacking.html, http://www.catb.org/gpsd/references.html) and then try to see how I can calculate lat/lon from "pseudorange measurements" which I've hopefully managed to document in (1). If that cannot be acomplished (either because math is too complex for me, or because I didn't manage to extract enough useful data in step (1)), then it will be necessary to try (3) -- reverse engineer /system/lib/hw/gps.exynos4.so and try to see how it does it. Note that I'd like to avoid that reverse engineering effort, because that chunk of aseembly is HUGE. (2) is probably hopeless (see comments about liberating firmwares in comment above).
well, they are the biggest blobs and start happening about the time I get GPS fix, so I assume they might contain "pseudorange measurements" (whatever are those EXACTLY - I need to learn on GPS implementetion details, see above). But, I don't know enough about GPS tech - it might be I already have the data needed to trilaterate pseudoranges to coordinates, but I don't know that. As for help - the biggest one would be someone knowing enough GPS math and teminology to say what data is needed to trilaterate, and what of the data in the hex dumps looks like it might be it. other than that, help matching the raw data to the SiRFHost debug messages and writing more detailed human readable descriptions would be nice. Some perl knowledge needed. Most of all, I'd love more free time -- but that nobody can help :) |
Hi, thanks for that explanation. I have since understood quite a bit more about this. Right, now. I'll just keep it short. I was looking again at your unknown MID 0x45 (69) which seem undocumented at first, but then there is a small note on MID 232 (0xE8) "Extended Ephemeris" is saying that its SID (0xD0) is equivalent to MID:SID of 0x45:0x3...
Can you also add the SID byte to your parser? (That should be the byte directly after the MID.) And I guess that not all OSP has neither MID nor SID. (See OSP-ICD manual.)
Second, I misread older document about maximum payload length. It should be 2^11-1=2047 (0x7FF) bytes. |
True, not all MIDs have SIDs. SID (if present) is already shown as first byte of hex dump payload, for example in I've added MID 0x45 SID1-2 (guessed them from DetailedLog.txt too) Note, I've also found another SiRF parser so I've added it at https://github.com/mnalis/gps-kit-cvs and fixed a few minor things. It doesn't support many MIDs, but have detailed output about those it does support - see https://github.com/mnalis/gsd4t_logs/blob/master/strace6-rst-short/SLCLog.gp2.human2.txt |
Any news or updates? |
Yet another parser (my), for completeness: https://github.com/illarionov/sirfdump |
Good morning. |
Hi everyone . thank you very much |
Good evening, |
Hi fcancillo! thank you for your answer . yes i'm aware of modules avilable , and even tried one to see it feets me. it does. the problem is that I have some difficullties to integrate the moudle for my own reasons, thus I need the gsd4e/gsd4t itself. |
This might be useful cough https://github.com/x893/SiRFLive |
Hello!
I found your interesting project on Replicant. I'd love to see a proper GPS decoder for the GT-I9100 and others. Have you been able to decode this yet? Also, did you see THIS document? Also I found another GithUb repo with some info on the SiRF binary mode (aka OSP).
From THIS manual:
The text was updated successfully, but these errors were encountered: