USB 3.0 Hub Stops Working on El Capitan

Has your USB 3.0 stopped working without explanation on your Mac? Here’s how to fix it.

I use a lot of external storage and it has been hard to find a USB hub that is fast, connects all my devices at once, and when using a device doesn’t drop other devices connected to it.

Anker 13-Port USB 3.0I finally found one that’s rock solid; it’s the Anker 13-Port USB 3.0 and it does everything I ever wanted.

Things were good until mid-January 2016 when the device started malfunctioning in strange ways. The first three ports did not recognize any device I put on it.  The other ports sometimes worked and sometimes didn’t. Reliability went out the window and I was forced to stop using it.  My guess was that something burned out. I went so far as to buy another smaller USB 3.0 hub, and well, it didn’t work either — so much so I ended up returning it.  I really wanted this hub working.

Curious, I handed the broken device to an electrical engineer and asked him if he could ascertain what was wrong with it. He took it apart, did diagnostic tests, saw nothing wrong, tried it on his computer, it worked fine, and handed it back to me fixed as just a mystery. However the story doesn’t stop there.

The Impossible Behavior

When I connected the device back up to my Mac, it behaved exactly the same way as it did before. I, of course, tried all my Mac’s USB ports.  I even tried a completely different Mac.  Identical failures.

So sure the device was working, my electrical engineer friend pulled out his Microsoft Surface Tablet, connected the hub, and instantly it worked.

We put it back on my Macs, with the same devices that just worked, it failed. Back to the Surface, it worked.  Back to the Mac, it failed.  In short, it was an electrical engineer’s WTF-nightmare.

The Common Denominator and Other Clues

At this point the problem was clearly related to the Mac.  More over, it used to work just fine, at least until mid-January.  What happened in mid-January?  El Capitan 10.11.3.

Both Macs were running El Capitan 10.11.3.

As a general rule, with Apple, the first generation hardware products have flaws, and the operating systems versions don’t usually get all the kinks out until version x.x.4 is released.  This threw immediate suspicion on the operating system, which meant it was time to check if other folks were having similar issues.

Yes they were.  (See this discussion.)

The Fix

While you’d think that one would need to go to Anker’s Driver Download page, that’s not the case.  You need to do two things:

  1. Reset the NVRAM / PRAM. (For a MacBook Pro it’s the Command-Option-P-R chord on boot.)
  2. Reset the SMC.  (For a MacBook Pro it’s the Shift-Option-Command-PowerOnButton.)

When the machine rebooted the USB hub behaved just like it used to.  Problem solved.

UPDATE (21-Mar-2016): With the introduction of El Capitan 10.11.4, it rebroke the USB 3.0 capabilities again.  The Console reports:

3/23/16 4:32:20.000 PM kernel[0]: 000227.351907 AppleUSB30Hub@14400000: AppleUSBHub::start: failed to set configuration with 0xe00002eb
3/23/16 4:32:21.000 PM kernel[0]: 000228.290970 AppleUSB30Hub@14400000: AppleUSB30Hub::start: failed to set hub depth 0 (0xe0005000)

So far, performing the above steps are not working.

OTHERS ARE HAVING IT TOO: Often the problem manifests as if the USB device, or something connected to it, is no longer working or has inadequate power, or is no longer detected by the host system.

Try your device on an older operating system (ideally the same hardware if you can), a Windows box, a Linux box, or even a Raspberry Pi — you’ll see the USB device works properly there.

YOU CAN HELP: It appears Apple may not know about the problem.

  1. Report it as a bug in OS X via the Apple Bug Reporter.
  2. Provide feedback via http://www.apple.com/feedback/

Please be kind when reporting issue, as these are the people who can help you. Give them technical details and model information to help them track it down.

UPDATE (06-May-2016): Apple has acknowledged issue 26102223 in their system and have asked for more information; I’m forwarding it to them.

UPDATE (09-Oct-2016): SOLUTION — It’s LeapMotion’s Fault!!

It seems that the Leap Motion driver may be the culprit here!

Uninstalling the driver (according to their instructions at https://support.leapmotion.com/entries/39493988-Uninstalling-the-Leap-Motion-software-on-Mac-OSX) caused the device to spring back to life without even a reboot required. Credit and thanks to David Ryskalczyk for hunting this down.

*** Between MAY and OCT, this blog suffered a large data-loss pertaining to the comments left by visitors.  I wish I had the original post by David Ryskalczyk reporting his extensive solution.  Here’s what I can manually recreate.

… I figured that maybe this was a software issue. I proceeded to clean install 10.12 on a USB drive — no issues; then 10.11 on a USB drive — *also* no issues! Seems to be software. From there I started isolating things — first with kexts, which turned out to be inconclusive, then with daemons (looking in /Library/LaunchDaemons and LaunchAgents to see what was installed and running). After removing a bunch of stuff I did additional testing and confirmation to figure out exactly what was causing the problem, and sure enough, it was the Leap Motion runtime!
Hopefully this can be fixed so the Leap Motion drivers can successfully coexist with these USB hubs. … I suspect the real cause is that the Leap Motion runtime is tripping up a bug in the Apple drivers.
I (and others) were able to confirm that David’s fix does indeed work.
Apple, after passing on this information to them, merely marked my bug report closed as a duplicate.
This information was also passed onward to Anker, who was very grateful to have the information for answering support calls about it.
I can also confirm that after months of not having the LeapMotion driver installed, my favorite Anker 3.0 USB has been working like a champ.

Making RawTherapee Work in OS X Lion

RawTherapee

I’ve been playing with RawTherapee (v4.0.9), a very impressive RAW file editor that’s extremely technical. It’s available on Google Code.

Here’s how I made it work with OS X Lion 10.7.4.

After installation, opening the app results in an instant crash with an error like this:

Dyld Error Message:
  Symbol not found: _iconv
  Referenced from: /usr/lib/libcups.2.dylib
  Expected in: /Applications/RawTherapee.app/Contents/MacOS/lib/libiconv.2.dylib
 in /usr/lib/libcups.2.dylib

This post led me to copy some libraries from OS X into the application directory:

$ cd /Applications/RawTherapee.app/Contents/MacOS/lib/
$ cp /usr/lib/libcups* .

And then to fix the icons:

$ sudo mkdir -p /opt/local/share
$ sudo ln -s /Applications/RawTherapee.app/Contents/MacOS/share/mime /opt/local/share/mime

You’ll still get a lot of memory errors in the console, but it’s possible to use the software.

Find and Replace in Word using C# .NET

Solution to how to do a global search and replace in MS-Word, including across floating text objects, in C#/.NET.

Heads up, this article contains high quantity of geek content. Non-geeks should move along.

I’ve been trying to use Microsoft.Office.Interop.Word to perform a global bulk search and replace operations across an entire document. The problem was, however, if a document contained a floating text box, which manifested itself as a shape object of type textbox, the find and replace wouldn’t substitute the text for that region. Even using Word’s capability to record a macro and show the VBA code wasn’t helpful, as the source code in BASIC wasn’t performing the same operation as inside the Word environment.

What I wanted was a simple routine to replace text anywhere inside of a document. If you Google for this you’ll get the wrong kind of textbox, the wrong language, people telling you not to use floating textboxes, and all kinds of weird story iterators.

One site seemed to have the solution; many kind thanks to Doug Robbins, Greg Maxey, Peter Hewett, and Jonathan West for coming up with this solution and explaining it so well.

However, the solution was in Visual Basic for Applications, and I needed a C# solution for a .NET project. Here’s my port, which works with Office 2010 and Visual Studio 2010 C#/.NET 4.0. I’ve left a lot of redundant qualifiers and casting on to help people searching for this article.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Office.Interop.Word;

// BEGIN: Somewhere in your code
Application app = null;
Document doc = null;
try
{
  app = new Microsoft.Office.Interop.Word.Application();

  doc = app.Documents.Open(filename, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing);

  FindReplaceAnywhere(app, find_text, replace_text);

  doc.SaveAs(outfilename, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing);
}
finally
{
  try
  {
      if (doc != null) ((Microsoft.Office.Interop.Word._Document) doc).Close(true, Missing, Missing);
  }
  finally { }
  if (app != null) ((Microsoft.Office.Interop.Word._Application) app).Quit(true, Missing, Missing);
}
// END: Somewhere in your code             



// Helper
private static void searchAndReplaceInStory(Microsoft.Office.Interop.Word.Range rngStory, string strSearch, string strReplace)
{
    rngStory.Find.ClearFormatting();
    rngStory.Find.Replacement.ClearFormatting();
    rngStory.Find.Text = strSearch;
    rngStory.Find.Replacement.Text = strReplace;
    rngStory.Find.Wrap = WdFindWrap.wdFindContinue;

    object arg1 = Missing; // Find Pattern
    object arg2 = Missing; //MatchCase
    object arg3 = Missing; //MatchWholeWord
    object arg4 = Missing; //MatchWildcards
    object arg5 = Missing; //MatchSoundsLike
    object arg6 = Missing; //MatchAllWordForms
    object arg7 = Missing; //Forward
    object arg8 = Missing; //Wrap
    object arg9 = Missing; //Format
    object arg10 = Missing; //ReplaceWith
    object arg11 = WdReplace.wdReplaceAll; //Replace
    object arg12 = Missing; //MatchKashida
    object arg13 = Missing; //MatchDiacritics
    object arg14 = Missing; //MatchAlefHamza
    object arg15 = Missing; //MatchControl

    rngStory.Find.Execute(ref arg1, ref arg2, ref arg3, ref arg4, ref arg5, ref arg6, ref arg7, ref arg8, ref arg9, ref arg10, ref arg11, ref arg12, ref arg13, ref arg14, ref arg15);
}

// Main routine to find text and replace it,
//   var app = new Microsoft.Office.Interop.Word.Application();
public static void FindReplaceAnywhere(Microsoft.Office.Interop.Word.Application app, string findText, string replaceText)
{
    // http://forums.asp.net/p/1501791/3739871.aspx
    var doc = app.ActiveDocument;

    // Fix the skipped blank Header/Footer problem
    //    http://msdn.microsoft.com/en-us/library/aa211923(office.11).aspx
    Microsoft.Office.Interop.Word.WdStoryType lngJunk = doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.StoryType;

    // Iterate through all story types in the current document
    foreach (Microsoft.Office.Interop.Word.Range rngStory in doc.StoryRanges)
    {

        // Iterate through all linked stories
        var internalRangeStory = rngStory;

        do
        {
            searchAndReplaceInStory(internalRangeStory, findText, replaceText);

            try
            {
                //   6 , 7 , 8 , 9 , 10 , 11 -- http://msdn.microsoft.com/en-us/library/aa211923(office.11).aspx
                switch (internalRangeStory.StoryType)
                {
                    case Microsoft.Office.Interop.Word.WdStoryType.wdEvenPagesHeaderStory: // 6
                    case Microsoft.Office.Interop.Word.WdStoryType.wdPrimaryHeaderStory:   // 7
                    case Microsoft.Office.Interop.Word.WdStoryType.wdEvenPagesFooterStory: // 8
                    case Microsoft.Office.Interop.Word.WdStoryType.wdPrimaryFooterStory:   // 9
                    case Microsoft.Office.Interop.Word.WdStoryType.wdFirstPageHeaderStory: // 10
                    case Microsoft.Office.Interop.Word.WdStoryType.wdFirstPageFooterStory: // 11

                        if (internalRangeStory.ShapeRange.Count > 0)
                        {
                            foreach (Microsoft.Office.Interop.Word.Shape oShp in internalRangeStory.ShapeRange)
                            {
                                if (oShp.TextFrame.HasText != 0)
                                {
                                    searchAndReplaceInStory(oShp.TextFrame.TextRange, findText, replaceText);
                                }
                            }
                        }
                        break;

                    default:
                        break;
                }
            }
            catch
            {
                // On Error Resume Next
            }

            // ON ERROR GOTO 0 -- http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

            // Get next linked story (if any)
            internalRangeStory = internalRangeStory.NextStoryRange;
        } while (internalRangeStory != null); // http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
    }

}

Let me know if it worked for you; bug fixes and enhancements welcome.

Seeing in Black and White

I just had an interesting thing happen: I saw in black and white. That’s what my brian actually saw with the unaided eye. Here’s the cool part, I tell you how I reproduced it. It was like nothing I’d experienced before. It was beautiful.

A few moments ago, I just had a very interesting and unique experience. I saw in black’n’white. I’d never had this happen before in my life. First I’ll describe the experience, then how I did it, which, curiously enough was repeatable.

“It was clearly not imagination… It was a greyscale world that I physically saw, like a black and white movie, but a zillion times sharper, far more dynamic range, and in 3D.”
With the totally unaided eye, my brain saw my surroundings, in broad daylight, in black and white. The only exception was that objects which were normally bright red had an ever slight red hue to them, but it was only brilliant red objects that did this.

The effect lasted about 7-10 seconds in duration before the color faded back in, almost as if the saturation was being brought up from near nothing to normal.

To convey the effect, this is much like the image I saw:

Seeing in Black and White

When I moved my eyes to look at other parts of the scene, the effect diminished, but if I kept focusing on one spot, like a child’s staring contest, the effect would hold longer. This was very much the inverse of the behavior of an after-image, where if you stay still it fades, but if you rapidly blink, it returns.

The black and white effect composed of the entire field of view. And as it gently faded back to normal, it affected more of the center of the field of view first:

Seeing in Black and White

It only took 2-3 seconds for normal color to return. There was no pain or any form of discomfort before, during, or after. I’m in very good health.

It was as if the signals from the cones were being ignored by the brain, but the signals from the rods were fine. I remember that the detail was astounding, and that the tone of the grass was very similar to the sky, though I’ve been unable to represent that as closely as I’d like in my photographic simulation.

I’m certain you’ve personally woken up in the morning and upon your eyes adjusting to the light have seen the image fade in, not focus, but as your brian assembles bits of the information into meaningful images, like it’s adapting to light after not being exposed to it for a long while.

Here’s how I did it.


I’m going to err on the side of giving too much information, some that might not be relevant, primarily because I don’t know what actually caused it. However, I was able to recreated it, on demand, several minutes later by experimentation; the effect lasted even longer. It was wondrous.

Being inside for the better part of the morning, I figured I’d go outside an lay in the sun for a few minutes. So, I lay down on my back on our driveway which has a slight incline. It was about thirty minutes past noon, and the sun was slightly overhead just off center to my right, enough that it was still bright enough that just closing my eyes was uncomfortable, so I criss-crossed my arms over them to put them in shadow, though I could still tell it was very bright out with my eyes closed. The weather was 89°F, I was in direct light, and there were few clouds in the sky.

I rested this way for about 10 minutes, and I did so just to the point where my eyes were fully relaxed and no longer concerned about the brightness of the light though my eyelids. Also, I wasn’t quite drifting off, but relaxed as you might be just taking in warmth of a nice day at the beach.

What led to the discovery was that I heard a car drive by and so I sat up quickly, opening my eyes. Two things stood out. One, this gave me a slight head-rush, though I’d describe it weak at best. Two, my eyes had not adjusted to the light fully. And, although while bright, it wasn’t uncomfortable, there was no blinding whitewash, no pain, and no caused for squinting required — I was looking away from direct light.

That’s when I noticed the scene seemed extremely washed out and monochromatic; it looked like a black and white photograph.

Thinking my mind or eyes were playing tricks on me, I moved my eyes, but the effect lasted longer than a second, though faded as I looked at more “new” material in my field of attention.

The reds came rushing back in first, with greens right after. It wasn’t one color than another, it was overlapped. I became visually more aware of reds, as that happened, greens started replacing the grey tones as well, and by the time greens were normal, the other colors like purples and blues from the nearby flowers in our garden were already present.

This part will be hard to describe because there’s no English equivalent for it, but it wasn’t like I was seeing in black and white, but rather the absence of color.

I know that sounds identical from a logic standpoint, but the perception was an absence of something, not the presence of something. Intellectually, I knew there had to be color, I just wasn’t seeing it.

It was a greyscale world that I physically saw, like a black and white movie, but a zillion times sharper, far more dynamic range, and in 3D.

It was clearly not imagination, nor dream, it was very real and perceptible.

That’s what made me want to try and repeat it.


Though this time around, if I could get it to work, I’d plan a more scientific excursion. So I selected an area of our yard with brilliant colors, our flower garden, which would be my baseline.

First, I waited about 5 minutes and looked at the area, taking in all the things I should be expecting to see. The area was already in normal color after the effect had faded long ago, but I wanted to be sure.

Seeing in Black and White

So, I laid back down with the intention of trying to get the head rush. I shielded my eyes in shadow, and waited for them to relax and get comfortable, and then waiting a moment, quickly sat up and stared at the area I knew had colorful flowers, a bright red car, and tons of green grass. I made sure I would focus only in one area, trying to stare out to infinity, much as you’d do for those 3D posters, though I was more trying to keep my eyes in a relaxed state because I wanted them in focus.

The preparation this time around took merely a minute or two. The head-rush was again weak from sitting up quickly. I turned in the direction I had planned and opened my eyes.

It’d worked.

The effect returned just as before, but lasted this time about 20 seconds and the effect was just as strong until I couldn’t help myself and look at the astounding detail in scene around me, which caused the effect to fade.

Since I had more time to study the scene, this is when I actually noticed the reds within the black’n’white image in my head. The B/W effect seemed more pronounced when I didn’t move my eyes, relaxing them.

When I turned to look at other things, color would seep in, and if I held my eyes relaxed in the same spot, the color would fade back out partly, much the same way as you can make objects in your blind spot vanish by holding your vision still long enough. That same kind of fading away was what I saw, but with color.

I suspect the effect is caused less by the head rush and more by the eyes being exposed and conditioned to bright light (even with the eyes closed, or maybe the red light through the eyelids saturates the cones like a red filter, though I did not see a green after image). When the eyes are opened, there’s a whole rush of visual information, and I suspect the brain is compensating for the overload by taking in shapes, detail, and tone and then overlaying color after the signal settles. I wasn’t aware that visual processing of color was an independent process.

This led me to two very interesting side thoughts.

One, I’ve always wondered if while under hypnosis people really saw things but said they didn’t, or whether their honestly perceived it. I now know it’s possible to perceive things differently than the visual input as actually providing.

Two, the black and white image was astonishingly detailed in greyscale, much like an Ansel Adams image. Being able to produce this effect on demand to view how a scene might be photographed in black and white is a fantastic tool to have in one’s photographic arsenal.

I hope science doesn’t declare this is bad for you, because I’m going to do it again!

[UPDATE: I can’t get it to happen inside, seems bright sunlight is required.]

Invisible Drive on OS X

The hard drive icon on my OS X’s Finder was no longer appearing on my desktop; here’s how I fixed it.

I happened to sign on to my desktop Mac and noticed something very strange, the Harddisk icon was no longer on the desktop.

Other clever tricks for looking at the file systems showed the file was most certainly present, although Finder operations were treating the volume as if the hard disk was hidden or invisible. The drive was there when I used terminal and did $ ls -l /Volumes

Finder Preferences showed that icons should be shown, but just the drive icon wasn’t appearing.

Then I found this aritcle, which suggested firing up the Script Editor and running this script:

tell application “System Events”
set visible of disk “NameofDisk” to true
end tell
tell application “Finder” to quit
delay 1
tell application “Finder” to launch

I believe I got myself into trouble by accident when I did the last disk repair using Disk Warrior or Disk Utility. Somehow the operation marked the drive as invisible. Undoing it was as simple as asking the system to make it visible again.