On 27 March 2013 18:35, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 27 Mar 2013, David Linares wrote: > >> Thanks Alan. I understand, but the USB cable is plugged into an AC/DC >> adaptor which can provide an output of 1A. After breaking out an USB >> cable, I measured that the consumption of my board is around 130mA >> (nothing connected to the hub). Then I measured with the dongle >> plugged in. The real consumption of the wireless adapter is around >> 210mA. The whole thing draws around 340mA > > Ah, okay. Then maybe this isn't a power issue. > >> Today, I did some further tests *without* any wireless adapter. So, I >> have got the device plugged in into a main power socket via USB >> (delivering up to 1A), the root hub, and the 2-port hub and nothing >> else USB-wise. >> The problem still happens from time to time. The 2-port hub sometimes >> says it will give 500mA to its children and sometimes it gives only >> 100mA (because of a corrupted hubstatus mentioned earlier). >> Now that there is nothing connected on the hub, I am just wondering >> how come the hub is not always detected in the same way at each boot. >> Also, should it be detected as "self powered" ( >> http://lxr.free-electrons.com/source/drivers/usb/core/hub.c#L1543 ) or >> not ( http://lxr.free-electrons.com/source/drivers/usb/core/hub.c#L1538 >> )? > > It sounds like the hub is rather flaky. Also, it should always > describe itself as bus-powered, never as self-powered. Maybe you > should try using a different kind of hub. > Please correct me if I am wrong. On my iMX25 board, I have got a 1-port root_hub which will provide 500mA max to its unique child. Now that's where I am getting confused. Its child, a 2-port hub, will then be bus-powered. But if it is, it won't provide these 500mA shared between the 2 ports. It will only provide 100mA per port, right? But for me to be able to plug my wireless dongle, in the code, I guess I will need to have "hub->mA_per_port = 500;" and therefore have the USB_DEVICE_SELF_POWERED bit set in the hubstatus. Is that correct? Because otherwise, my dongle will always pass the test "if (c->desc.bMaxPower * 2 > udev->bus_mA)" if this udev->bus_mA is set to 100mA and always end up in insufficient power. >> I forgot to mention that this issue where the hub is not detected as >> "self-powered external hub" is quite hard to reproduce. It happens 1 >> out of 20 tries. > > This could even be a loose electrical connection, silly as that seems. Yes, that could very well be. I will inspect that tomorrow > > You never posted any usbmon results. If you could see the actual data > sent by the hub when it's not working, you might get a better idea of > where the problem is. True. Didn't get a chance to do this experiment yet. As you can read, I am still having some difficulties understanding how it should work in practice and who gives which power :-) Will do that tomorrow too. Thanks again. > >> Thanks a lot Alan and everybody else. I really appreciate the support >> and understanding you are providing. > > You're welcome. > > Alan Stern > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html