Of the six Raspberry Pis that perform various tasks around my house, two of them are dedicated Kodi boxes. For more than a year I’ve had exemplary performance from both.
Suddenly, about a month ago, one of them stopped working. There had been no power outages, no refreshed addons, no updates, and no irresponsible users. It began behaving irregularly, and nothing played smoothly. It got stuck frequently, addons not responding. My phone remote app stuttered and stammered trying to communicate.
My set up
I’m running OSMC on a Raspberry Pi 2 from a SanDisk 8 giga class 10 SD. I have the standard Edimax ew-7811un WiFi dongle and an A4Tech G3 280 wireless mouse. My WiFi signal is strong enough for streaming HD movies. I have a good quality 2.1-amp power supply, and sturdy cable.
Starting Diagnostics
Most Pi users know the problems usually begin with the power supply or the SD card. I was confident the power supply was good, so I tackled the SD first. Fortunately, I keep image backups of my important SDs, knowing they’re prone to corruption. Although I’d made a few changes since my last backup, I formatted the card and reinstalled the image. This had solved many Pi problems in the past, so I was confident it would work this time too.
Not so. I plugged in my cables - and it still didn’t work.
Wifi?
I took out my Edimax dongle and examined it closely. I noticed the plastic was cracked. Aha... heat! It got too hot, fried the chip, and cracked the plastic. No problem, I have spares everywhere.
Plugged it in, knowing I’d nailed it.
More than an hour had passed and I had a very disgruntled partner waiting to watch the latest Outlander episode. She already curses me for cutting the chord in favour of a quirky little box she refuses to understand - but I assured her everything would work fine now.
No dice. Nothing. Same problem.
Partner marches off “to read a book”.
Ok, so it must be the router. I disconnected, waited five minutes, and turned it on.
The same.
Like all geeks I know that sometimes bad karma enters a system and no matter what you do, it just won’t work. The next day, everything’s fine and you’re left baffled at the cause. This was clearly one of these days, so I gave it a rest, confident the problem would resolve itself the next day.
More of the same
I was disappointed. Next day it was the same again.
I had another idea. I brought the SD card from my second Kodi and tried it. Same thing. Then I tried the SD card from the troublesome Kodi in the good one. It worked fine! Then I spent a frustrating 30 minutes with the two micro SD’s in my hand trying to figure out which was which!
When I’d finally worked it out, I was completely baffled. How is any of this possible? If it’s not the SD card, not the WiFi dongle, not the router, then all it can be is the RasPi itself.
However unlikely such a scenario, I brought my good RasPi with its good dongle and good card, and placed the whole shenanigans in the bad Kodi’s location.
I sat back utterly confused; for reasons beyond my understanding, the good RasPi adopted the bad Kodi’s badness!
We were now well into the second evening and Outlander was still a distant dream. There were heavy vibes in the household.
Baking a new Pi
At this point I was loosing it. What on earth was going on? I checked the WiFi again. Changed dongles again. Reformatted the card again. Nothing.
A neighbour had asked me to set up a Kodi for him. I had an unused RasPi, unused dongle and brand new SD card waiting to give him. In desperation, I opened the seals and set everything up. Surely this time it would work?
No. It didn’t.
I gave up. It made no sense. Partner had gone to a friend’s house to watch Outlander. Things weren’t looking good.
I was lying in bed, in the clear moments before sleep, trying to make sense of it. I’d changed everything. I’d reset the WiFi over and over. What could it possibly be? I didn’t even know how to describe the problem to search for a solution on the web.
On the cusp of sleep, I suddenly realised. There was a single common factor in all the setups I’d tried; each time I’d moved everything around, I’d attached the wireless mouse. Could that be it?
Searching the Web
My realisation came at night, but next morning I had to work, so couldn’t experiment. Between tasks in the office, I launched my browser and searched for degraded RasPi/Kodi performance and wireless mice. I found nothing.
That night I went home and disconnected the mouse.
As if I’d lifted a heavy shroud, Kodi burst into glorious life and has been working perfectly since.
It’s not just me
I wouldn't have been prompted to write about this without today’s events.
I am an avid member of Raspberry Pi groups on Facebook and today I came across an enquiry from a gentleman who was having synchronisation problems with Kodi. Several group members were trying to help him. Each time they’d send him away to try something new. Each time he'd come back disappointed. By the time I entered the exchange, most others had given up.
The problem he was experiencing was poor synchronisation between sound and picture. Elsewhere in the chat he'd explained he was using the RasPi 2 and WiFi.
Remembering my own experience I asked him if by any chance he had a wireless mouse attached.
“Actually, I have,” he replied.
“Disconnect it," I said, "and get back to me".
Today I received an enthusiastic greeting from him.
“You solved my problem. My Kodi has never worked so smoothly!"
I went back to Google to see if anyone has reported poor Kodi performance on WiFi with a wireless mouse. I can't find anything. Even if it has been reported, it still needs to be stressed again. Hopefully this post might help others who are struggling with erratic Pi/Kodi behavior.
I know WiFi and mouse broadcast on the same frequency and there's every possibility that one interferes with the other. Radio engineers reading this, may want to comment. Why did this happen suddenly? Is it possible that when the mouse's batteries weakened, radio interference increased as it 'worked harder' to communicate?
Author's Addendum
Since this post went public, there has been considerable discussion on Facebook and elsewhere. One comment, which apparently comes from someone who understands, went as follows:
Sam Nazarko Poor performance with USB peripherals is caused by hotplugging being ran (sic) on the main render thread. We resolved this issue around April in OSMC.
The bug is still present in OpenELEC, but it's not affected as severely because it uses an old version of Kodi which uses a less real time buffer for dvdplayer & mmal. Once (if?) they upgrade to Kodi 16 they will see the same problem unless they take the fix for hotplug detection being run in a new thread.
For me, this comment illustrates a common problem with Open Source software. Many people invest huge amounts of time and energy in producing some amazing stuff for everyone to use. Unfortunately, documentation doesn't always keep pace with updates - leaving the average Joe, (like me), in the dark and frustrated. That said, keep doing what you do. The minor setbacks are nothing compared to the benefits.