# Not enough host controller resources for new device state.

## Edweirdo

I have a brand new MacMini that I built Gentoo on from scratch.  It has a keyword accepted gentoo-sources-4.3.0 kernel (config.gz).  When I plug in a bunch of external USB hard drives I get the error message:

```

Not enough host controller resources for new device state.

can't set config #1, error -12

```

And any drive after that, making all the other drives not available.  Most everything is USB 3.0, I have all the drives connected to powered USB hubs and then connected to the computer.  14 Seems to be the magic number, when I connect the 14th one (out of 21), I start getting the message.

Google searches suggested turning off xHCI, which turns of USB completely, essentially, so that doesn't help.

I didn't find a kernel bug related to this, so I'm hoping I'm just missing something simple.

----------

## khayyam

 *Edweirdo wrote:*   

> 
> 
> ```
> Not enough host controller resources for new device state. can't set config #1, error -12
> ```
> ...

 

Edweirdo ... is that message from kmesg/usb or some other service, ie, udev? It might be worth posting the actual error from dmesg in full.

best ... khay

----------

## Edweirdo

It is from USB.  Here is the full message:

```

Nov 28 11:05:00 snusnu kernel: [  358.590742] usb 1-2.4.1: New USB device found, idVendor=1058, idProduct=1110

Nov 28 11:05:00 snusnu kernel: [  358.590745] usb 1-2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

Nov 28 11:05:00 snusnu kernel: [  358.590747] usb 1-2.4.1: Product: My Book 1110

Nov 28 11:05:00 snusnu kernel: [  358.590749] usb 1-2.4.1: Manufacturer: Western Digital

Nov 28 11:05:00 snusnu kernel: [  358.590750] usb 1-2.4.1: SerialNumber: 574D415A4131303539373236

Nov 28 11:05:00 snusnu kernel: [  358.591478] usb 1-2.4.1: Not enough host controller resources for new device state.

Nov 28 11:05:00 snusnu kernel: [  358.591491] usb 1-2.4.1: can't set config #1, error -12

```

----------

## khayyam

 *Edweirdo wrote:*   

> Google searches suggested turning off xHCI, which turns of USB completely, essentially, so that doesn't help.

 

Edweirdo ... my search pretty much turned up the same (ie, this). Does your kernel also have EHCI enabled, as disabling XHCI in the bios should force its use ... or is that not the case in your experience?

The analysis in the above linked post does seem likely, and the FIXME (in the code) suggests that the programmer was aware that '#define COMP_ENOMEM 7' (xhci.h) may be too low. I'd suggest a proper bug report to lkml, or contacting the author.

best ... khay

----------

## krinn

The lack of resource might not comes from the driver lack of resources but from the host resources that are exhaust.

Like any usb version, usb3 also have a limit to power, and if your host have too many devices attach to it, you may get the error it cannot power them all.

that's better handling than usb2 driver (last time i saw it, they might have update it for better handling) that allow you to plug any, and randomly enable this or that device as it don't have enough power to handle them all.

Are all your hubs self powered?

I won't be a surprise that you have some low/bad powered hubs. See https://en.wikipedia.org/wiki/USB_hub#Power that show a real example of such bad powered hub.

----------

## Edweirdo

It is a MacMini, so there is no BIOS available to turn off anything.  I do have ECHI on, I haven't tried turning that off.

I do have 2 powered USB hubs, but after some experimenting, it seems that one is a USB 2.0 hub.  I'm going replace that with a powered USB 3.0 hub to see if it helps.

I did have all this connected to an old MacMini with an older kernel, but I believe I was probably mostly USB 2.0 at that point, and that is why it was working.

----------

## khayyam

 *Edweirdo wrote:*   

> It is a MacMini, so there is no BIOS available to turn off anything.  I do have ECHI on, I haven't tried turning that off.

 

Edweirdo ... my bad, wasn't paying attention ... every USB3 port consists of a XHCI and EHCI controller, so you should be able to disable XHCI in the kernel and have EHCI be used.

best ... khay

----------

## Edweirdo

When I exclude xHCI, I get no USB devices at all.

```

# lsusb

unable to initialize libusb: -99

```

----------

## Edweirdo

So, just to add additional information to this for the next person searching for a solution to this:

I grep'ed the kernel source for the error message and found the following:

```

static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,

                struct usb_device *udev, u32 *cmd_status)

{

...

        case COMP_ENOMEM:

                dev_warn(&udev->dev,

                         "Not enough host controller resources for new device state.\n");

                ret = -ENOMEM;

                /* FIXME: can we allocate more resources for the HC? */

                break;

...

}

```

It is my guess from my 0 seconds of kernel development that UDEV has allocated a certain amount of memory/resource for the USB devices and I have reached that limit.  Instead of allocating more memory/resources when needed, the programmer decided that would be better left for someone else to do.  So, until someone else does, we're out of luck.

Ed

----------

