PC Pro

PAUL OCKENDEN

Paul fixes his Wi-Fi, looks at some hidden sound options in macOS and adds a watchdog to his Raspberry Pi

- @PaulOckend­en

This month, Paul fixes his Wi-Fi, looks at some hidden sound options in macOS and adds a watchdog to his Raspberry Pi.

It seems unlikely, but if I am ever suddenly put in charge of everything, the second law I pass will make it illegal for people who aren’t really sure what they’re doing to mess around in the settings of their broadband routers. I’ve lost count of the number of friends who have asked me to look at their broken setups, only for me to find all kinds of random things that have been “tweaked” by people who didn’t realise what those settings actually do.

What’s worse is that they probably haven’t just clicked these settings randomly – there’s a whole raft of websites out there that will, when you search for Wi-Fi problems or look to increase your connection speed, give you no end of spurious advice. And this same complete and utter cobblers appears to get regurgitat­ed over and over again across the internet. You can see how this happens: someone posts a question, someone else does a web search and finds some claptrap on the subject, and they then post that in response to the original question, so as to appear clever or, more likely, to win points on one of those “gamified” technical support websites. And then, a few days later, someone else finds their advice and the cycle continues.

I recently saw a Wi-Fi network where the MTU had been set to 1,532.

If you’ve not heard of MTU before it stands for maximum transmissi­on unit, and it’s the biggest packet of data that your network thinks it can send; bigger packets need to be “fragmented”, or split into multiple sections with sequence numbers that allow the receiving end to glue the original packet back together again.

If you set the MTU too small, your network runs slowly because it starts to fragment packets that it doesn’t need to, resulting in twice the normal traffic rate. Set it too big and stuff quickly starts to fail. Especially external traffic, which won’t reach your ISP, or other times won’t be received. The annoying thing is that it won’t affect all of your traffic. You might be looking at a web page and find that certain images don’t load while others work fine. That’s because their file size sits in that gap between your actual MTU and the duff value set in the router. Similarly, you might find that some online games don’t work while others do, or particular web pages refuse to load. It’s this intermitte­nt nature of MTU problems that make them hard to track down; on the other hand, for experience­d network bods this acts as a big clue as to where the problem might lie.

Many websites tell you how to determine the correct MTU size to use for your broadband connection, but many are utter tosh. I just Googled it as I’m writing this, and found a support page from probably the most wellknown broadband router manufactur­er, which says to adjust the value in increments of ten. That’s terrible advice – it needs to be multiples of eight! So ignore all these websites and simply ask your ISP. If you’re using the ISPsupplie­d router, it might even be locked to support the MTU that your provider expects to see, but if you’re

“Many sites tell you how to determine the correct MTU size, but many are utter tosh”

using your own router then your provider is the best source to tell you the correct MTU. You may even find the correct value printed on your welcome letter or email.

Anyway, back to the MTU that was set to 1,532 – how did it get there?

You should almost never see an MTU of 1,532. “I saw it on a website somewhere,” I was told. I love the internet, but it’s getting to the point where the technical help you’ll find there is about as reliable as the political opinions on Twitter.

And now comes the bit where it gets quite embarrassi­ng… A couple of weeks ago, I noticed that my own Wi-Fi network was running slowly. Regular readers might remember that I use a mesh-based setup with a dedicated 1,733Mbits/sec backhaul channel running between the various nodes. However, from my MacBook Pro I could only reach a speed of 54Mbits/sec when talking to other local devices on the network, or when using my broadband connection.

My broadband connection was fine: I plugged in a laptop via an Ethernet port on my main router and got pretty much the full 80Mbits/sec in, 20Mbits/sec out that my FTTC connection allows. So next I thought it might be the speed between the mesh nodes that was being clobbered, but again, using wired connection­s showed that this was working well.

Oh, and it wasn’t the MTU either! I never fiddle with that, but I did check, just in case a router firmware update had messed with it; the value was 1,492, which is correct for my ISP.

It was at that point that I looked at the wireless connection between my Mac and its nearest mesh node. That’s really easy on a Mac: you just hold down the Alt key then click the Wi-Fi symbol in the menu bar. Doing so shows all kinds of useful informatio­n, and I could instantly see that my Mac was only connecting at 54Mbits/sec.

Lots of head scratching ensued. At first, I assumed it was a problem with the Mac, so I messed around with various settings (yes, I know… do as I say, not as I do!), but I couldn’t get it to connect at a better speed. Next, I started to dig around in the router settings and I noticed that the WMM option box was unticked.

Now that shouldn’t be a problem, right? WMM stands for Wireless

Multimedia. I wasn’t doing any multimedia stuff on my Mac – no streaming videos or VoIP calls. WMM is designed to give priority to these kinds of multimedia traffic and is part of the quality of service (QoS) stuff you’ll find in various wireless chipsets.

Yet, with certain brands of router (particular­ly Netgear) if you disable WMM, you don’t just lose the priority for things such as audio and video, you also severely limit the wireless connection speed. And that has to be a bug, right?

No, it’s just that Netgear is a bit stricter in how it handles the 802.11n (and higher) Wi-Fi specs than some other manufactur­ers. The issue is that WMM is a subset of 802.11e (the QoS functional­ity mentioned above) and the 802.11n spec says that 802.11e is required. The higher speeds that were introduced with 802.11n and later piggyback on some of the 802.11e features, especially WMM, to function.

That’s why you’ll find that WMM is enabled by default in all fast, modern wireless routers. Some manufactur­ers have tweaked their firmware so that if you turn WMM off it only removes the multimedia optimisati­on but still allows fast connection­s. Others, such as Netgear, are strict about this: untick that box and your network will still work, but not as quickly. But there’s often no warning when you disable WMM, and I guess many people probably won’t even notice that speed drop.

The thing is that you’ll find loads of forums that suggest disabling

WMM to improve throughput or fix other issues. Once again, it’s bogus advice. But it was unticked on my router too, and when I ticked it again everything went back to normal. I’ve no idea why it was unticked. Perhaps

I’d been looking for answers on the internet.

Sounding out a Mac

Sticking with Macs, usually you’ll find it’s pretty easy to use external speakers. You just plug ’em in or connect via Bluetooth and they’ll just work. If you have several speakers connected, you can flip between which one you want by clicking the speaker icon in your menu bar and selecting the appropriat­e speaker from the list.

There’s a bit more control available if you open up the Sound panel in System Preference­s. Here you can set things up so that media plays through your external speakers, but you can still have system alerts bleeping out via your internal speakers, if you want. It’s all quite sensible and easy to use.

What many Mac users don’t realise, though, is that there’s yet another layer of control available. The reason they don’t realise is a) because it’s an applicatio­n that you need to use, rather than the more usual System Preference­s where you’d expect to find control things, and b) because the applicatio­n is called “Audio MIDI Setup” and it even has a picture of a musical keyboard as its icon. If you don’t use your Mac for MIDI-based music, you’ll almost certainly have ignored this tool.

Take a look, though, because there’s all kinds of goodness hidden inside. In particular, it will allow you to select the bit rate and bit depth for all of your sound output devices. You might find that by default they aren’t being driven optimally.

The real magic comes if you click the little “+” in the bottom-left corner. Here you can create a “Multi-Output Device”. This is effectivel­y a virtual speaker, where you can combine several output devices into one; just tick the speakers you want to include. You then need to right-click your Multi-Output Device and select the options to use it for sound output and/or system noises.

There’s also an option to add an Aggregate Device.

This is more complicate­d than the Multi-Output

Device as it also combines various inputs. Plus, it ties

“You’ll find loads of forums that suggest disabling WMM to improve throughput”

the devices together in a slightly different way – as we’ll see later.

If you make a combined device using both wired/internal speakers and Bluetooth devices, you’ll get a noticeable delay between the two.

This is caused by the Bluetooth codec introducin­g a processing delay. It’s the same reason that you end up with lip-sync problems if you try to use Bluetooth headphones (or indeed speakers) with your TV. There are ways around this for audio-visual use by using devices that support the aptX Low Latency codec. That way you’ll find that lip-sync issues are pretty much eliminated. Sadly, although Apple provides the bog-standard aptX codec, there’s no aptX Low Latency (aptX LL) support. It’s the same for Windows 10 – there’s standard aptX built in, but not the LL version.

Anyway, back to the Mac. While you have the Audio MIDI Setup allocation open, you should also check out the Configure Speakers button, which you’ll see down in the bottomrigh­t corner. If you have a simple stereo speaker setup, it doesn’t offer much, other than allowing you to swap the left and right channels if you’ve somehow got them connected the wrong way around. Where the configurat­ion really comes into its own is if you have a multi-speaker setup: you’ll see a range of options for different speaker positions.

I mentioned that Multi-Output and Aggregate devices are combined differentl­y, and you’ll see that in the Configure Speakers screen. If you combine, say, a MacBook’s internal stereo speakers and a Bluetooth stereo soundbar into a Multi-Output Device, you’ll only see the options for the position of stereo speakers. But if you use an Aggregate Device, you’ll also get options for quadraphon­ic sound, treating all four speakers separately.

It’s quite un-Apple-like to offer this much control over things. Usually it’s a case of “our way or not at all”. Perhaps that’s why it hid it all in such an unlikely place!

Watching the dog

As regular readers will know, I’m a big fan of using a Raspberry Pi to run Domoticz for home automation. If you do this, a problem you’re likely to find is that sometimes Domoticz will fall over. It’s usually not the fault of the software itself; I’ve found that most often it’s a third-party interface or driver that causes problems.

You don’t want your home automation system offline, but you can use a watchdog timer to reboot the Pi if Domoticz crashes. First, see if you have the watchdog device available by running:

ls -al /dev/watchdog*

If you see devices called watchdog and

watchdog0, you’re okay, but if not you’ll need to edit /boot/config.txt and add a line saying the following to the end of the file:

dtparam=watchdog=on

Then reboot and those watchdog devices should appear. To install the watchdog package, use the following:

sudo apt-get install watchdog sudo update-rc.d watchdog defaults

The next step is to configure the watchdog. Do this using:

sudo nano /etc/watchdog.conf

You’ll want to change the watchdog timeout value to be 15 seconds. At this point, you can do:

sudo service watchdog start

Then, whenever your Raspberry Pi hangs, it will automatica­lly restart itself. This is useful for all kinds of tasks, not just Domoticz.

A step further is to actually check that Domoticz is working. What you need to do is:

sudo nano /etc/init.d/domoticz.sh

Look for the OPTIONS line and change it to be something like:

OPTIONS="-www 8080 -loglevel=normal -log /tmp/ domoticz.log"

Then re-edit the watchdog.conf file like you did above, and add the following lines:

File = /tmp/domoticz.log change = 600

We’ve just told Domoticz to write out a basic log file while it’s running, and then we’ve instructed the watchdog process to check whether that file has been updated in the past ten minutes. If it hasn’t, the Pi will reboot.

If you make an error, ten minutes should be enough to fix it before the Pi reboots. If you need longer, use:

sudo service watchdog stop That other law

Right at the start of this column, I skipped over the first law I would enact if I was in power. Well, it would be to stop an HGV on a speed limiter from trying to overtake another HGV, also on a speed limiter. The punishment for carrying out this manoeuvre would he harsh, but doubly so if the stunt was pulled on a two-lane motorway. If you want to tweet and accuse me of being a typical BMW driver, the address is below.

“Then, whenever your Raspberry Pi hangs, it will automatica­lly restart itself”

 ?? @PaulOckend­en ?? Paul owns an agency that helps businesses exploit the web, from sales to marketing
@PaulOckend­en Paul owns an agency that helps businesses exploit the web, from sales to marketing
 ??  ?? BELOW This is what happens when you take dodgy forum advice as gospel…
BELOW This is what happens when you take dodgy forum advice as gospel…
 ??  ?? BELOW Here’s Bose advising customers to disable WMM for best performanc­e
BELOW Here’s Bose advising customers to disable WMM for best performanc­e
 ??  ?? ABOVE I could see that my Mac was only connecting at 54Mbits/sec
ABOVE I could see that my Mac was only connecting at 54Mbits/sec
 ??  ?? LEFT You can combine your Mac’s output devices by simply ticking the boxes
LEFT You can combine your Mac’s output devices by simply ticking the boxes
 ??  ?? ABOVE You’ll have to dig around for the extra levels of Mac speaker control
ABOVE You’ll have to dig around for the extra levels of Mac speaker control

Newspapers in English

Newspapers from United Kingdom