TIL not to plug an Amazon Echo Dot into my Mac Mini

I recently put an Amazon Echo Dot in my home office. It needs USB power; rather than plug in yet-another-power-adapter, I plugged it into a spare port on a USB hub connected to my Mac Mini.

All was well…until I needed to reboot the Mac. Then I noticed two things:

  • A normal reboot took a long time to show the login screen (more than a minute, versus the usual 10 seconds)
  • Pressing Option during the reboot (to try to reboot from another device) failed – the machine hung, never giving me the screen with devices to try.

I tried resetting NVRAM and the SMC; no dice.

Eventually, I managed to reboot and took a look at the system log; there were many, many error messages like this:

Oct  6 12:52:00 office kernel[0]: 000573.331885 AppleUSB20HubPort@14233000: AppleUSBHostPort::disconnect: persistent enumeration failures

I started disconnecting devices, and when I unplugged the Dot, the messages stopped appearing.

I’m now powering the Dot with its own power supply, plugged into a power strip. It works great, and the Mac Mini is happy, too.

TIL about Python’s “enumerate”

I’ve been writing Python for more than 10 years, and I can’t count the number of times I’ve written code like this:

index = 0
for thing in array:
    do_something_with(index, thing) # Because I care about the index AND the item
    index += 1

But today I learned about the built-in enumerate function which does exactly the same thing, but avoids any chance of getting “index” and “thing” out of sync (not that I’ve ever made that mistake, of course…).

I’m not going to rewrite any old code for fear of adding new bugs, but I’ll remember to enumerate going forward.

Thanks, Dr. Drang!