Contributed by mtu on from the olympic-mania-is-over-now-back-to-c2k8 dept.
Read on to learn more about OpenBSD's approach to time and position:
When I think of precision time and a long history of time keeping devices, I think of Switzerland. So does it surprise you that a Swiss OpenBSD developer, Marc Balmer (mbalmer@), spends a lot of his energy in this area? In fact, he has spent a considerable amount of time working on OpenBSD time in novel ways, especially for a non-Real-time Operating System. He highlights this work on support for Radio Clocks in OpenBSD here.
Marc also runs a very successful company, micro systems that supports OpenBSD systems in Switzerland. He is also very busy helping to organise and run several conferences every year.
Here is what Marc had to say about his time at the c2k8 hackathon:
ldattach(8) to make it usable with other applications that need GPS data, removed nmeaattach(8), and added accelerated X support for the AMD Geode LX graphics processor.
I will only talk about the first item here, since I think it is a good example of how software evolves when people using it for different purposes work together.
nmea(4) line discipline to decode GPS data and use it as a precise time reference, I needed a way to attach the line discipline to a tty. Line disciplines are quite different from device drivers and the tty subsystem has quite some subtleties that you have to think of. Not only do you have the tty/cua difference, which is very important to understand, but also the fact, that a file descriptor must be open on a tty device for data to flow and the line discipline to be active. The program that attaches the line discipline thus must open a file descriptor on the device the GPS unit is plugged in AND keep that filedescriptor open. Unfortunately that also means that no other process can look at the GPS data; a tty can only be opened by one process. While we get precise time information, the data from the GPS is otherwise lost, quite frustrating if you want time and position data.
gpsd is such an application (it is in our ports tree) and I am actually using it myself, since I wrote some graphical GPS applications. Fortunately the main gpsd developer is also an OpenBSD developer, Chris Kuethe, and he modified gpsd to attach the line discipline from within gpsd. This is, of course, completely OS dependent and no other OS has the nmea(4) line discipline, afaik. Chris asked me long before the hackathon to find a better solution to the problem, so that the OpenBSD specific code could be ripped out of gpsd again.
pty(4) device. ptys always come in pairs, so while ldattach feeds the data to its end of the pair, any application can open the other end and use the GPS data for whatever task.
Chris, being a perfectionist and a GPS expert, was not yet satisfied with that approach although he liked the concept of data being passed over a pty. But he wanted it bi-directional: "after all I have to talk to my GPSes to configure them". And that is how it got implemented in the end.
If you pass the -p option to ldattach, it will open a pty pair and relay data between the GPS unit and the pty in both directions. gpsd can use the GPS unit as if it was directly connected and the kernel still picks up the precise time information and feeds that to ntpd. ldattach will output the name of the pty so that gpsd can be started with a command line like 'gpsd `ldattach -p cuaU0`'.
- Marc Balmer
Besides working on GPS support for OpenBSD, Chris Kuethe (ckuethe@) seems to enjoy speed. Last year I was able to watch him drive his not-so-stock BMW 3 series through some remote Canadian mountain highways as if he was on the famous Nürburgring race track :-). No, I wasn't with him but I was able to watch it on his Sony PSP at Pacsec 2007. He recorded the ride via a camcorder that he fixed to the side of his car. It would have been more exciting for me if I was in the driver's seat but maybe not in his car.
About a week just before the c2k8 hackathon, returning from some company event, he was dropping off a co-worker and was backing out of the driveway when one of his wheels came right off the axle. Essentially, it broke from years of wear and tear and perhaps a little fatigue from being run so hard ;-). Thank goodness this didn't happen on the highway.
At c2k8, Chris showed me some really cool stuff that he is doing with OpenBSD and GPS. If I recall correctly, he is tracking the position of any and all GPS satellites within direct view of his home. He also graphs them real-time (or almost) showing approximate strength and distance relative to his home. It was quite fascinating.
Here is what Chris had to say about his work and time at the c2k8 hackathon:
I helped out a bit with testing things:
setting up a test harness for henning and mcbride's pf changes applying actual load to cryptoraid by running it on my production laptop mbalmer's ldattach-with-pty-relay code
Readers of ports@ and source-changes@ might have also noticed that I've become interested in usb lcd display panels - so I wrote up an ugly little monitor program to watch the status of my gps (and ldattach), ntpd and my clock control loops and display this all on the little lcd. A port of the control library is in the works.
I would like to thank both Marc and Chris for giving us a unique way of keeping time without Internet ;-).
(c2k8 hackathon summary to be continued)
(Comments are closed)