6

I've got a 2012 11" i7 MBA. This is a great little machine but one thing has been driving be absolutely batty about it... The USB ports work well for the most part, but inevitably I will plug in a USB device (could be anything. Thumb drive, USB serial port, JTAG cable, USB2 or USB3 device, doesn't matter) and it will power up (LEDs blink, etc.) but the device is not recognized by the Mac.

Looking at dmesg, I see this:

USBF:    126826.226    AppleUSBXHCI[0xffffff80d5636000]::WaitForCMD (Enable Slot Command) - Command failed: -1009 (num interrupts: 93582187, num primary: 46791094, inactive:0, unavailable:0, is controller available:1)
USBF:    126826.226    AppleUSBXHCI[0xffffff80d5636000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000700a0 ERDP: 002043d0
USBF:    126826.226    AppleUSBXHCI[0xffffff80d5636000]::UIMCreateControlEndpoint 2 - Run out of device slots, returning: e0004045
USBF:    126826.226    AppleUSBHubPort[0xffffff8015ddce00]::DoConfigureDeviceZero  Port 1 of hub at 0x14000000.  Cannot create USB device (kIOUSBDeviceCountExceeded)
The USB stack is not able to enumerate the device at Port 1 of hub at 0x14000000 because the USB hardware ran out of device slots

At this point the USB port is kaput. Unpugging/replugging the same device or another will show similar messages. The only solution seems to be a reboot. Putting the Mac to sleep doesn't help.

I've got the USB logging driver installed to try to help diagnose the issue but I am not seeing anything that I could call a smoking gun, and trying to reload the USB kexts does not help either.

This issue was present on my old 2011 MBA as well, and the issue has persisted from 10.7 to 10.9. Both ports will eventually do this, which makes me believe that it isn't a physical port issue since one port is on a separate I/O board and the other is on the main logic board. I've tried to connect the device through an external USB2 and USB3 hub (tried both) and the problem will eventually occur in these situations as well.

I'm fairly technically savvy, but not necessarily at my best on OSX. I can gather more information if someone were to help me determine what data is appropriate to help debug the problem. I've also done the usual NVRAM/SMC resets, fix permissions, etc... doesn't help.

Has anyone else run into this? What information could I provide to help diagnose the issue? Does anyone know of a way to fully reset the XHCI controller in this situation to try and recover without needing the reboot?

Edit 20140217

Adding the bounty certainly got this question the attention I felt it needed! Thank you for all of the answers so far, but I think that there are some important misconceptions that I'd like to address:

  1. I didn't migrate my account from the older MacBook Air. Brand new install
  2. The problem occurs with pretty much any device. USB keys (no cables here!), JTAG adapters, USB3 drives
  3. The problem occurs with or without USB2 or USB3 hubs
  4. If the problem occurs with a device on a hub, unplugging the hub and plugging the device directly into the Mac doesn't help
  5. If the problem occurs without a hub, plugging the device into a USB2 or USB3 hub doesn't help
  6. Once the problem occurs, logging out / switching to a different (new) user doesn't make the problem go away for the new user or the old user.

I develop electronic hardware and software for a living, including USB 3.0 devices. I'm familiar with USB root port drivers, but not at all familiar with low level (kernel) development on OSX.

I'm fairly certain that this is a device driver problem simply due to the nature of how it manifests itself. From a clean boot, things work great. Unplug/replug and it might still work great. Unplug/replug will eventually cause the problem to show up, and at that point ANY USB device in that port will not work. Reboot and things work great again.

1
  • This sounds like a typical case of a defect Logic Board. If you're out of your warranty period you will have bad luck, as Logic Boards easily cost 800+ dollars. You can always try to make an appointment at a Genius Bar and let them run some diagnostics. They mostly go farther than your normal hardware test. Good luck! Feb 16, 2014 at 18:12

3 Answers 3

5
+100

Good news: you don't have any problems with your hardware. Or software, permissions, etc.

The issue is, believe it or not, exactly what the error message says:

the USB hardware ran out of device slots

You're probably under the impression that something like 127 USB devices can be used with a single controller, since that's what all the marketing material says. But that's actually only true in a single very specific and probably mostly theoretical configuration. USB devices support, at a maximum, five connections in a tiered-star hierarchy. Hubs are not passthrough devices, so they count against this number, as do any internal components which use the USB bus, and any devices which use more than one device profile (even if it's only a single physical connection).

How could I know you don't have a problem with your hardware though?
Why, because I have the same machine, and I was able to reproduce the error!

screenshot


If the issue seems to be sporadic you're probably running into a couple of other issues too:

  • Crappy, incompatible chipsets in hubs, since the standard has no enforcement.

  • Insufficient power: faster USB speeds require more power than slower ones.
    If a device has the ability to fall back to a slower speed (rather than error due to insufficient power), it will do so, taking anything on the same bus with it.

If you don't want to see this error again:

  • Throw out any USB hubs and cables you are currently using. Dead serious.

  • Drop the $40-$80 for two to four of these, plus however many of these you need.
    Most USB 3 cables should be fine.

  • Especially considering all the devices you mention are high-speed and not very error tolerant, you should never rely on bus power, and make sure the (Yep, a wall wart for each hub and device. Exceptions: keyboards, mice, etc.

  • That last point is especially true on the 11' MBA, which ships with a measly 45W power adapter, and the computer basically needs all of that even with only a moderate CPU load. If you have this cash, consider buying a 60W or 85W adapter.

  • In practice max, devices/hub connected on a single hub is 2 + another hub.

  • Always use 4-port hubs, not 7-port. 7-port hubs are just two controllers in a chain.
    But you don't know which ports connect to the first hub or the second!
    (Without looking in System Profiler.)

  • If in doubt, prefer the USB port on the logic board (right). There's a remote possibility there's interference in the I/O board. Luckily, that isn't an expensive part.

Follow those steps and I basically guarantee this issue will go away.


Edit: the hardware/kernel development perspective

To answer to the clarification that this is a developer question.

So: The log snippet posted does indicate what I addressed above: too many USB 3.0 devices connected to the root XHCI hub.

(The QS77 chipset supports 4, and there are 2 in use inside the machine.)

To "reset the XHCI controller" (technically its a kernel, not controller, issue):

sudo kextunload -b com.apple.driver.AppleUSBXHCI
sudo kextload -b com.apple.driver.AppleUSBXHCI

however, that's not going to do anything if this is happening with USB 2 devices as well, in which case that its:

sudo kextunload -b com.apple.driver.AppleUSBEHCI
sudo kextload -b com.apple.driver.AppleUSBEHCI

and if its both, well, neither of those.

When I say I can reproduce the issue, I mean that if I overload the XHCI bus like in the log snippet, I get the same error message. And I wasn't assuming necessarily you were using a bad hub — it equally that you might need to get a good one, because the root hub has too many connections.

Beyond that, however, I think we're getting into the realm of a wiki question to the effect of:

How do I debug the kernel and device drivers on Mac OS X?

As thats more the issue, nothing to do with the MacBook Air per se or even necessarily USB.

I might try my hand at writing one (not really my expertise but I've done it a few times) But it'll probably be a few days for that. Meanwhile, take a look at:

man 8 kext_logging and sudo sysctl -w debug.kextlog=0xlogspec

kextstat | grep USB

The IOUSBFamily source.


9
  • Thank you for your detailed answer, but I think you're assuming that the problem occurs when I use external hubs / chain hubs together. I've updated my question to include more detail, in particular the fact that USB thumb drives (no cables) and low-speed and externally-powered equipment (JTAG/serial adapters, etc.) still exhibit the issue. Excellent catch on the power supply, but I do have the bigger (85W) adapter. Problem occurs whether it's plugged in to AC power or not.
    – akohlsmith
    Feb 17, 2014 at 17:07
  • One other thing... you mention that you can recreate the issue. How are you doing it? Do you require a reboot to clear the error?
    – akohlsmith
    Feb 17, 2014 at 17:08
  • Ok, yeah, this was definitely written towards a power user/tinkerer, not a developer. Feb 18, 2014 at 2:46
  • "The log snippet posted does indicate what I addressed above: too many USB 3.0 devices connected to the root XHCI hub." -- doesn't this indicate a driver bug? I don't have more than one device plugged into the port (and it's not a hub)... isn't the driver forgetting to clean up after itself?
    – akohlsmith
    Feb 18, 2014 at 4:51
  • Its certainly possible; Apple doesn't honestly care that much about third party device support. Although I'm not familiar enough (you'd probably know better) with how USB hot-plug is supposed to work vis-a-vis making slots re-available. I do know, that (for instance) storage devices are supposed to send dismount message (due to HFS - on Windows/FAT/NTFS this isn't needed) or the system may not deregister the device (the "improperly disconnected" message seen if you don't 'eject'). But I'd have to see a lot more that four lines from system.log to really say. Feb 18, 2014 at 5:16
1

Would I be safe assuming that you migrated the OS off your old Mac onto the new MBA and that you have upgraded the OS rather than done a clean re-install? Or perhaps migrated users or apps.

I suspect an extremely low level OS problem. If you have an external drive then put a brand new OS install on it and boot from that for a few days and see if the problem disappears. If it does then do a clean install on your MBA and migrate nothing, copy your data, and install only your most necessary apps from install media rather than your old OS. It could well be you have some nasty or broken app that is causing the problem so add them back slowly and always from brand new install files.

1
  • I've edited my question to address your assumptions. Unfortunately no, this Mac was a brand new install, not a migration from my older MBA. There wasn't anything copied over, no settings or any applications.
    – akohlsmith
    Feb 17, 2014 at 17:09
1

definitely software.

easy fix would be to:

do a time machine backup then format your hard drive and then to reinstall your os.

when this is done create a new account

when the account is set up, start migration tool and select your home folder, and try to skip anything unimportant

done, this should almost certainly fix your issue permanently

(diskmaker x) a great utility to create a bootable mavericks drive so you don't have to download mountain lion first! if going with this approach use alt instead of cmd+R

2
  • I appreciate your taking the time to answer, but I would like to know how you are certain that it is a software issue (I suspect it is as well). Also, if it is a software issue, is there an easy way to reinstall just the specific subsection (XHCI drivers?) that would be causing the issue?
    – akohlsmith
    Feb 17, 2014 at 17:12
  • the way i am certain is that technology is often not complicated, if a reboot seems to fix the issue for a while, then it mot certainly is software, specially if you feel so yourself. also no problem regarding my time, I'm happy to help! easy way to renstall the specific subsection.. I'm afraid i don't know, however just reinstalling everything is so easy that thats almost my go to approach, done right, and it would take, 30min to reinstall then just transfer your data back, just make sure to use the migration tool approach
    – Macmaniman
    Feb 18, 2014 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .