News for hackers. Stuff that matters.
Re:Linux may have been causing USB disconnects by exDM69 on Thursday August 22, 2013 @08:08AM (#6256597)
> Well, that's why you don't hardcode a magic value, nor do you continuously poll the state of a device and rely instead on interrupts: That's what they're made for.

There was a mention about this in the OP. There were no interrupts for this state transition in USB prior to USB3. "The Intel xHCI host, unlike the EHCI host, actually gives an interrupt when the port fully transitions to the active state."

In addition, a lot of hardware initialization is based on delays and polling by design.

Re:Linux may have been causing USB disconnects by Jugurtha on Thursday August 22, 2013 @06:28PM (#6260506)
I'm not familiar with the USB spec. It happened I did tear-downs of flashdrives to find-out which ucontroller there is and try to dump stuff, etc... (For anyone interested, look up VID:PID and Google some microcontroller chip. It's a fascinating world where Russians are very present).

Your second comment about a lot of hw initialization being based on polling gives place to an "a fortiori": Why cascade this necessary evil to software. It's true, in the beginning, writing code for microcontrollers, you avoid working with interrupts. You work with assembly language, and get a bit lazy and hard-code delays (and even then, I'd choose a longer delay than the one specified as "max" in the datasheet : it's not like a chip not performing as well as is written in a datasheet never happened, so I take my precautions).

But then battery life reminds you of bad code practice: This continuous polling is draining. (And you put the uc to sleep :) )

Even more, if the application's involving sensors there's no way around using interrupts. Unless the thing is powered by a wall-socket, but even then, you get your consciousness preventing you from sleeping at night thinking about that horrible, barbarian code you put in there.

But then again, I don't know the USB spec and this may change so it's cool. And they have come a long way.