I think what you want to do is prevent the connection of USB Mass Storage Devices.
I found this answer which is untested by me and not terribly recent, but I can see that the referenced kext is still in the location described:
a quote from the Leopard security configuration guide:
48 Chapter 3 Protecting the System Through Hardware
Removing USB Support Software
Use the following instructions to remove USB mass storage device input/output support such as USB Flash drives and external USB hard drives.
The removal of this kernel extension only affects USB mass storage devices. It does not
affect other USB devices such as a USB printer, mouse, or keyboard. This task requires
you to have administrator privileges.
Important: Repeat these instructions every time a system update is installed.
To remove kernel extensions for specific hardware:
- Open the /System/Library/Extensions folder.
- To remove support for USB mass storage devices, drag the following file to the Trash:
IOUSBMassStorageClass.kext
- Open Terminal and enter the following command:
$ sudo touch /System/Library/Extensions
The touch command changes the modified date of the /System/Library/Extensions
folder. When the folder has a new modified date, the Extension cache files
(located in /System/Library/) are deleted and rebuilt by Mac OS X.
- Choose Finder > Secure Empty Trash to delete the file.
- Restart the system.
Source: https://discussions.apple.com/thread/2105022?start=0&tstart=0
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!
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.
Best Answer
Update:
There are two ways to reset a USB:
I saw a similar scenario solved by putting a momentary switch in-line with the USB +5V line on the USB cable (usually the red connector). When the engineer wanted to reset the device (simulate removing then reinserting the device), he would depress (held it for a second or two) the switch cutting power to the USB device. When the released it, power would be restored re-powering the device and the computer would reload it.
The advantage this had over doing something on Terminal was that it affected only the device in question and not all devices on the entire USB bus.
Doing a quick search, I was able to find pre-made switches that accomplish this for less than $10 USD
For a less "cludgy" solution, you could get a USB hub with individual power switches like the Sabrent 4 Port.