Some Bits: Nelson's log

17 posts in February 2017

HD FM Radio

My new car supports HD Radio. What is that? It’s a US standard for radio stations to broadcast a digital sideband adjacent to their audio frequency. The FM version is a 100-150 kbit/sec digital stream that encodes data in HDC, a proprietary standard that is similar to AAC. In theory there can be multiple HD streams on one channel, and a station could be digital-only. I haven’t seen that in practice.

The audio quality definitely seems better than analog FM. It’s also better than the low bandwidth Sirius XM channels like their NPR channel, that thing is awful. The big bummer is that since it’s a sideband the digital FM broadcasts don’t really offter the opportunity to free up any spectrum. Not that the TV spectrum process has gone very well.

 

 

2017 Audi A3 vs SD cards

My new car has a fancy stereo from Audi / Bang & Olufsen that can play audio (and video!) off of SD cards. Awesome! So I loaded up a 128GB SDXC card with my music collection, inserted it, and watched it crash as it indexed. But it seemed to work anyway after rebooting. Only some music is missing.

Looking more closely I figured out music started being missing right around Johnny Cash. But nothing wrong with those Johnny Cash files, they work on a new card just fine. A bit more googling and head-scratching and I learned the Audi might only read 64GB of an SD card. This limit is baffling; the big limit on SD is 32GB, the SDHC format. The car’s manual explicitly says it supports up to 128GB cards. I found this other post that claims > 64GB cards work, but only with FAT32, not exFAT. There may also be limits on the number of files / directories / etc, but it’s vague.

Anyway, on my exFAT SDXC card everything after Johnny Cash is unreadable. At first I thought that was the 64GB limit but counting carefully really it’s like 69GB in. I’m also at about 9800 files before I hit the Js, so maybe it’s actually a 10,000 file limit?

Another mystery is the indexing system. It definitely scanned the SD card the first time it saw it, for several minutes before crashing. Now when I put the card in it doesn’t index it. I’m not positive if it’s detecting changes in the drive or not. (I think so?) Where is it storing the index? There’s a file on the root of the SD filesystem named “WMPInfo.xml” that it placed there, some Windows Media Player junk. But it’s only 296 bytes. The car has its own dedicated hard drive with a partition for a “jukebox” I can copy music to. Perhaps it has another partition for databases and stuff. It’s got a copy of the GraceNote database built in somewhere!

 

OpenAddresses / population

Justin Meyers did an awesome treatment of OpenAddresses data. He put all the points in QGIS, then binned them by county, then put the shapefile in a repo. Nice! I wanted to see what the data looked like normalized by population, so I did two treatments. One is kinda sorta logarithmic, the other is a simple linear scale capped at 2 addresses / person.

Logarithmicish

output.png

Linear, capped at 2

linear.png

I’m not quite sure what this visualization really shows. I was hoping it’d be a proxy for data coverage; like naively I expected there’d be one address per person, more or less. But that’s clearly not what I’m seeing here. The Montana outlier is particularly baffling, there’s 10 addresses / person in many counties.

 

routes at my WISP

I continue to be baffled by my WISP’s networking. Last few days I’ve had frustrating small outages, like 1-2 minutes at a time. But only during working hours. Support told me they were doing “some maintenance that might cause that” one of the days. I fear they think even an occasional 2 minute outage while they reboot equipment is OK, but happening 5+ times a day is getting really old. I do have some sympathy for them though. It’s a fixed wireless network, my house is connected via at least 2 radio relays at other customers’ houses before reaching a wired network. That’s gotta be hard to manage.

Anyway, I realize part of my confusion now is that traceroute is lying to me. Here’s an mtr report after running about 25 minutes.

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. OpenWrt.lan                       0.0%  1606    0.4   0.3   0.3   0.5   0.0
 2. sbbgateway.lan                    2.6%  1606    2.2   2.3   1.6  24.6   2.0
 3. 173.195.183.1                     0.0%  1605   35.7  39.6  16.0 136.5  15.0
 4. 173.195.188.45                    0.0%  1605   33.3  37.5  14.4 139.4  14.9
 5. 173.195.188.21                    0.0%  1605   46.1  39.7  17.2 142.3  15.5
 6. 173.195.177.1                     0.0%  1605   29.0  36.9  18.0 128.5  15.1
 7. 173.195.177.254                   0.0%  1605   37.8  39.0  17.5 145.9  15.3
 8. v122.core1.fmt2.he.net            0.0%  1605   39.1  51.3  28.0 176.6  14.3
 9. 10ge7-1.core1.sjc2.he.net         0.0%  1605   57.3  51.2  27.4 128.1  15.7
10. 72.14.219.161                     0.0%  1605  104.7  47.6  28.2 155.5  16.3
11. 108.170.242.81                    0.0%  1605   57.0  49.5  27.5 142.6  15.9
12. 216.239.49.103                    0.0%  1605   55.2  50.6  28.3 146.1  15.8
13. google-public-dns-a.google.com    0.0%  1605   49.0  47.2  27.4 158.4  14.3  

Hop 1 is my router. Hop 2 is the wireless antenna on my property. Hop 8 is Hurricane Electric, a network provider in California, and beyond that is the public Internet.

But what’s going on between hops 3 and 7? I used to think this was the wireless nodes in my WISP, that hop 3 was the first radio and hop 4 was the second and so on. But looking at that average ping time I realize there’s no latency between 3 and 7. So now I think that hop 3 must be the first bit of wired infrastructure at my ISP, and that hops 2-3 are the sum total of all fixed wireless links. Perhaps they are acting as bridges, transparent at the IP layer. That’s how my own Ubiquiti nodes operate, I actually have 2 Ubiquity M2s running between hops 1 and 2 that are invisible to mtr.

FWIW the boxes at hops 3-5 look to be running MikroTik RouterOS. That’s also consistent with wired infrastructure; my wireless antenna at hop 2 is a Cambium device. No idea what 6 and 7 are. I don’t want to freak out my ISP by probing too hard.

One reason I’m looking at this so closely is I’m trying to understand the 2.3% packet loss shown at hop 2. That looks like it’s to my own equipment and I should be able to fix that. But every test I’ve done directly shows 0 packet loss to that device, the Cambium antenna up in my tree. Now my theory is the packet loss is actually in the wireless network between hops 2 and 3, the WISP’s wireless infrastructure. MTR can’t report it directly because those devices aren’t visible at the IP layer, so it just credits the packet loss to the last IP hop in the route, hop 2.

I think I see a similar thing when I mtr backwards back into my router at the WISP from a public Internet host; there’s no latency in my ISP’s network on the way in until a high latency gap at the last hop. The route back is different from the route out, which makes direct comparison a bit trickier.

Latency

I did a ping test to 173.195.177.254, the edge of my ISP’s network.

51 packets transmitted, 51 received, 0% packet loss, time 50076ms
rtt min/avg/max/mdev = 17.645/38.194/84.315/14.119 ms

I also asked my neighbor to do one.

52 packets transmitted, 52 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 17.737/29.401/53.861/8.731 ms

So his latency is 9ms better than mine. Significantly less jitter and worst case, too. I believe the difference between us is one radio hop. He has a radio link directly to Twin Cities Church. I think I have two hops, one north to a house and then from there south to the church.

I’d thought the church was where the wired internet began, it’s a major hub for the WISP. But those latency numbers suggest there’s possibly more wireless. The WISP’s office is down in Alta Sierra. The distances involved are so short I don’t think signal propagation time matters; it’s at most 20km, or 0.07ms at the speed of light. Not relevant. Processing time on the antenna relays though, not to mention congestion, those matter. Perhaps it’s 9ms per wireless hop, based on my measurement of my own link. We have ~20ms of latency unaccounted for, that suggests there are two more wireless hops from the church to the wired infrastructure.

Exede satellite Internet

A Metafilter discussion introduced me to a type of Internet access I didn’t know about before; Exede satellite Internet, part of ViaSat (and WildBlue). It seems better than the Hughesnet satellite Internet which is so slow, metered, and high latency as to be nearly useless. Although I took a brief look at Hughes and they seem to have improved their offering somewhat, not sure if Exede is significantly better.

If you’re in the right regions Exede offers Liberty Internet, 12/3 Mbps, or even 25/3, for $70-$150 a month. The problem is after you go through 12-30GB that month they drop you down to a lower service which is only 1-5Mbps, or maybe worse. If you’re in the wrong area all you get is Classic service, 5/1 Mbps, for $50-$130/month. That comes with a 10-25GB monthly cap and I can’t tell if it’s a hard cap or another slowdown.

It’s still high latency though. Their FAQ is full of mealy-mouth bullshit about “web accelerators” and how latency is better, but the what to expect page confesses 700ms latency and that gaming won’t work. That’s the incontrovertible problem with geosync satellite systems; it’s 240ms just getting to the satellite and back, not to mention all the other work that has to be done.

The other part of Exede that got my attention is it’s bidirectional; you’re sending signals back to the satellite via the antenna. Old Hughes installs relied on a phone line for uploads. Hughes now advertises up to 1Mbps upload speeds though, so maybe they have a satellite option now.

I was baffled why the 12/25 Mbps service was available in San Francisco, but only 5 Mbps in Grass Valley. It’s satellite, why does it matter where I am? Well it turns out they’ve broken up the US into cells with different “beams”. I found a good map and technical detail. It looks like most of the western US isn’t served by ViaSat-1 at all, but instead by Anik-F2.

beams.JPG

 

beams 2.JPG

 

Windows metered network connections

My ISP is down again so I’m back to Verizon tethering. Setting up the network connection I noticed Windows has a metered network option. The docs are very vague, but basically it’s a flag to tell the OS and applications “hey, this network isn’t free”. Windows itself will be a bit more careful; only downloading priority updates for example. There’s also configurable options to not sync OneDrive or download device drivers.

In theory third party apps could also inspect this setting and be smarter on a metered connection. Specifically apps on the new “Universal” platform. In practice I wonder if many apps are that smart. Dropbox isn’t, apparently. It’s all a bit confusing really, and most of the search results you see on Google about metering are “why isn’t stuff updating how do I turn off this metered connection thing?”

Also TIL that Windows 10 enrolls your computer as a peer to peer server in uploading Windows updates to other Windows computers. Yes, by default Microsoft assumes you want to use your upstream bandwidth to serve other customers. That’s some fucking bullshit.

 

Ah, Windows, ye olde errors

Bloom is off the rose with Windows. Or at least, Civilization 6, one of the games I switched to Windows to be able to play well. (It runs on Mac but 50% slower, and I wanted higher end graphics hardware.)

The whole system often freezes when exiting the game to desktop. Well that’s not quite right, Ctrl-Alt-Del still works and you can reboot or log out. But Alt-Tab doesn’t work to switch apps, which is odd because it works fine while the game is running.

GSync also doesn’t work. That’s the fancy variable framerate stuff. All sorts of screen tearing unless I enable VSync.

Both of these bugs could be specific to Civ 6. But it’s the kind of thing you’d think the OS and its graphics drivers would take care of uniformly for all games. Ha, as if.

 

Windows S.M.A.R.T.

Windows doesn’t seem to have built in S.M.A.R.T. support! After reading this guide and this Stack question I think the best option is CrystalDiskInfo. It used to have some bundled adware but the author promises he removed it all, and there’s a portable version for download (ie: no installer). I took a chance and it seems to work.

Capture.PNG

That’s my USB drive. Ignore all the junk and focus on “Health Status: Good”. Its heuristics seem reasonable; at least it shows my two new drives healthy and identifies errors in a failing drive that look plausible.

Gripe

Why the fuck doesn’t Windows have basic SMART error monitoring and notification? It’s the first line of detection for a failing drive, popping up errors for the user would save countless amounts of lost data. (And ignore the advice to try Windows’ wmic; at least on the drive I know is failing, it shows “OK” even though it’s not.)

And why are SMART tools so bad? Note the same user-hostile display table at the bottom as every other SMART tool in the world shows. What’s the temperature? 123? 111? No, it’s 00000000001D, which for some reason is being displayed in hex with leading zeros. At least this program translates it to 29C. No idea what the spin up time might mean though. I don’t even know what “Current” and “Worst” are supposed to mean. Linux smartmontools shows the same nonsense.

Speaking of smartmontools, I tried installing like four versions of it for Windows from dodgy SourceForge binaries. They all sucked, many couldn’t even find my drives. So much terrible Windows software out there.

Ken’s computer is showing signs of a failing hard drive. Last CHKDSK randomly found about 30 files corrupted. The machine is about five years old, just in time for a shitty consumer hard drive to fail. Ugh.

 

An example ugly Windows font

I’ve complained about Windows font rendering but was hard pressed to have a good example. Well here’s one, from a Bloomberg articleCapture.PNG

Look at how ugly that is! The kerning in “To” is wrong. The “m” and “r” and “u” and “n” are all broken, by which I mean literally broken like white pixels in the middle of the letter. The tail on the “9” has visible jaggies. I’m not just nitpicking, I find this really difficult to read.

The font is a web font, TiemposTextWeb, at 18px. Maybe it’s just a spectacularly bad choice? But Bloomberg is a big publication, clearly someone thought it was a good font. That sample is rendered in Chrome; it looks the same in Edge. I have ClearType turned on with more or less default settings in Windows 10; I used the tuner to pick a very slightly heavier rendering at some point but I don’t think that’s the problem.

It looks much better in the PDF specimen. Here’s some sloppily-made images of the PDF and then Chrome / webfont rendering the same text, to show the spindly nature of Windows’ rendering.

pdf.png

ttf.png

Another example

Another example, Gentium Basic, an SIL font popular because it has support for a lot of scripts. The lowercase “a” is entirely broken, even at 30px.

Capture.PNG

I mean that’s some fucking garbage right there. It looks a bit better if install a TTF and render it with Paint.  It still looks bad, but at least it’s not broken, just ugly-ass.

Capture.PNG

On the same page there’s a “Gentium Plus” that looks a little better still. It’s not great, but it’s at least not embarassing. So maybe font quality is part of the story, but something very bad is also happening in Windows’ font rendering.

Windows customizations

I’ve now set up a second Windows box. I was in a hurry and didn’t take notes, but from memory here are some of the specific tweaks I made in addition to installing normal application software.

I sure wish Windows had a clean way to store these customizations and copy them to a new machine. MacOS is much better; almost everything is localized to your home directory and Time Machine will help you set up a new Mac.

I thought I’d be clever and copy my roaming profile over to the new computer. That worked for some things like Discord and Slack. But lots of configurations are stored in other places. Cmder still stores its config files right in the program directory for instance, which seems like a good idea if you’re using it as a portable app but otherwise is not a good thing. And some applications settings are buried in the registry and I don’t know of an easy way to extract the ones you can safely copy over.

Windows 10: separate speaker and headphones

I have both headphones and speakers plugged into my motherboard’s analog output jacks. It’s a pretty standard Windows desktop setup, the motherboard does HD Audio which has 5 analog jacks which can be programmed to do different things like speakers, headphones, line-in.

Also pretty standard, my computer had the RealTek HD Audio Manager installed, an ASUS skinned one. This does a nice job of popping up a dialog when the user plugs in new speakers and asking them to configure it. Unfortunately it also seems to have a behavior where when I plug in headphones it automatically silences the speakers. In fact both analog outputs show up as a single “Speaker” device in Windows, there’s no way to use them independently.

In theory the Realtek driver has option settings to reconfigure this behavior, to let you use the rear and front jacks as separate devices. But my version didn’t have those settings, no “Playback Device” section at all.

Following some cargo cult advice I solved this problem by just uninstalling Realtek entirely. Goodbye 500 MB of stupid reverb effects I’ll never use. Turns out Windows 10 itself can manage the audio hardware with no problems. I did have to unplug and re-plug the devices for Windows to detect them, but now my speakers and headphones show up as separate sound devices.

Capture.PNG

While I’m here, a little theory on how this all works in Windows. Each sound device is an independent output channel for apps to play to. Most apps just play to the “Default App”, which you configure in the Sound control panel or with a program like SoundSwitch. But some apps let you choose a specific output device, particularly games, and you can use that to play different sounds simultaneously through different apps. There’s also a notion of a “Communications device” separate from the usual default, I think for VOIP apps like Skype to use a headset always.

I’m still confused about what drivers are involved. Device Manager tells me stuff is being managed by Microsoft’s Driver 10.0.14393.0, which I think is just Windows 10. But Sound tells me that there’s also a RealTek Controller which a RealTek Driver 6.0.1.7910. I wonder if Microsoft ships that, or if I didn’t uninstall that driver when I uninstalled the Realtek Audio Manager?

Update: this stopped working after I rebooted.

Update 2: a reader wrote to suggest

The problem is that Windows 10 reinstalls the Realtek driver automatically (in the background without asking no less...). To stop that you can open the device manager and open the “Sound, video and game controllers” list (not “Audio inputs and outputs”, there it doesn’t work). There you will see that your audio device is a Realtek device again. Open properties, go to the driver tab and click on “Roll Back Driver...”. Now you will get the Windows driver and it wont reinstall the Realtek driver.

Garage door remote radio

Spent way too much time today learning about how radio garage door openers work. Good articles on Wikipedia: remotes and rolling codes.

Most garage door openers work on a radio signal in 300-400MHz. There are various identification / code systems in use to uniquely pair transmitters and receivers.

My San Francisco garage works by having the transmitter and receiver share a single 10-12 bit key that is programmed via DIP switches. Presumably they also have to agree on which frequency they speak. (Two gate controllers also work via DIP switches.) Note this kind of system is terribly insecure, it’s easy to build a universal opener that just sends all codes.

My Grass Valley garage has Intellicode, a rolling code. This works by the transmitter having a secret key. You put your receiver in “learning mode” and it memorizes the secret key. Then there’s a simple PRNG-like crypto protocol where the transmitter is generating one time passwords that the receiver recognizes. This is more secure than a fixed code, although there are attacks against it too.

There’s a variety of “learning remotes” that you can use to duplicate a garage door opener, to make a new transmitter. Fancy cars tend to have HomeLink systems. I just bought a Clicker battery powered remote.

HomeLink seems to work by first listening to a working transmitter, then copying it. Presumably it’s figuring out what frequency to use. And if it’s a fixed code, it learns the 10-12 bit code that otherwise you’d set with DIP switches. If there’s a rolling code you have to do an extra step of having the receiver now learn the HomeLink’s key.

The Clicker seems to work by me manually identifying which type of transmitter I’m trying to clone. It’s got a library of ~15 types, which presumably tells it what frequency to use and what kind of code it needs. Then there’s either physical DIP switches to set and memorize or for a rolling code, you have the receiver learn the Clicker’s key.

There’s also a new modern world of Internet-enabled garage door openers where you just tell it to open via a smartphone app. I’m told you can retrofit these as new receiver units wired into an existing working motor drive unit.

 

rsync to exFAT USB

Ran into a weird bug trying to rsync my music collection to a USB drive on a Linux box.

mkstemp function not implemented

This blog post has an explanation for the problem; rsync -a wants to set file owner, group, etc and exFAT doesn’t support those filesystem features. And apparently the Linux FUSE driver doesn’t just fail gracefully? Also not clear why it shows up as an error for mkstemp, except I imagine that libc function is also trying to set permissions.

Anyway trying the cargo cult solution which is not to use rsync -a, but instead just the options you really need, which are -rltD.

 rsync  --delete -rltDW --info=progress2

The -W is a bit of lagniappe, it’s supposed to help USB speeds. info=progress2 is a reasonable display for rsyncing 120GB of music files.

I’m seeing roughly 30±10MBytes/sec writing large files, . The destination is a USB 3.0 adapter for an SD Class 10 card. The card promises 80MB/sec reads and “somewhat slower write speeds”, so that seems reasonable.

 

Lightweight NTP clients for Unix

NTP is important, it sets your system clock. A proper Unix machine with an ordinary network connection should be within 10ms of true time. The problem is the traditional software we use to do this, ntpd, is old and complicated and has had a lot of security problems. It also does way more than your typical server needs, supporting obscure protocols and funky hardware you’ll never access.

I think a modern Unix machine just needs a simple network only time setter. Poll the time from ~4 NTP servers, discipline the clock to ~10ms, implement leap seconds correctly. That’s about it. I’m on the fence about client-only; if it’s not a big deal to be a simple server, that’d be better. I’m also ignorant about security, the historical crypto stuff in ntpd is pretty woolly.

A lot of other people think there should be a simpler time settings, there’s a bunch of alternatives now.

  • chrony is the best alternative I know of. It seems to do time correctly, and it has some clever accommodations for running in difficult environments like a VM or on a machine like a laptop that’s asleep a lot of time.
  • NTPSec, a big effort to first simplify the old ntpd code, then port it to a safe language like Rust or Go. The project has some problems but they are getting ambitious work done. Keep an eye on it.
  • systemd-timesyncd is everywhere now thanks to systemd. It’s too simple though, really just an SNTP client, and can’t discipline the clock nearly accurately enough to be useful for good time.
  • ntimed, see the blog. This project was looking promising but seems to have stalled out.
  • openntpd, the OpenBSD rewrite of an NTP daemon. It has a lot of problems including good clock discipline and leap seconds and is not really suitable.
  • ntpd! The venerable classic. Despite the problems the bugs are being fixed and it’s still the daemon I suspect powers most of the world’s Unix machines.

Chrony has a very useful comparison of chrony, ntp, and openntpd. The Performance numbers at the bottom are what’s most interesting to me (those numbers are microseconds).

End of the day, I think ntpd is still a decent choice. Chrony looks like the best alternative. I don’t have experience with it to comment on. I have no way of knowing if it’s more secure than ntpd. It’s also in C and has had some security problems.

34″ ultrawide monitors: Asus vs Acer

I’ve had occasion to try out two fancy gaming monitors recently; the Asus ROG Swift PG348Q and the Acer Predator X34 bmiphz. They are nearly identical. Both are great. Buy whichever one is cheaper. Last few times I’ve looked one has been $1100 and one has been $1200. If it’s a coin flip, I think the Acer X34 is slightly better.

Both monitors have identical panels and specs, as you can see in this comparison. They’re both 3440 x 1440 monitors in a 34″ package (109 ppi), they both support NVidia GSync, they’re both IPS panels. They both have an “overclock” feature to run up to 100 fps. I think there’s no meaningful difference in the display. This one review found slightly better color fidelity in the Asus but given it’s the same panel I think that’s probably individual item variance or testing error, not a real thing. They sure look the same to me. The difference is in the extra electronics and details.

For electronics, they both have speakers that can be driven via USB, but the Asus PG348Q has absolute garbage 2W speakers whereas the Acer X34 has merely awful 7W speakers. Also the Acer is 100% better in that it has 4 USB outputs, not just 2. The Asus has slightly nicer buttons and OSD menu UI but you will use those things once at setup and never again.

I like the Acer stand better; it came preassembled and doesn’t have an unusable cable management feature. Also it’s not some ugly asymmetric weirdo thing like the Asus. Both monitors have stupid decorative LED lights shining down that you will immediately turn off. The Acer monitor has the word “PREDATOR” prominently on the front bezel which is sort of sinister, but it’s easy enough to ignore it or put some tape over the branding.

They’re great monitors. The 34″ 21:9 form factor is the first monitor big enough I haven’t felt any need to have a second monitor. The screen quality looks very good to me and I haven’t missed my old iMac screen at all. But I don’t have exacting color fidelity requirements. I will say both the Asus and Acer screens look a bit hot to me, even after fiddling with color calibration. They also both have suspiciously garish default color settings and weird “gaming modes” I don’t understand.