News for hackers. Stuff that matters.
Re:Linux may have been causing USB disconnects by Jugurtha on Thursday August 22, 2013 @06:49AM (#6256317)
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.
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.

Re:Linux may have been causing USB disconnects by alexchamberlain on Thursday August 22, 2013 @07:00AM (#6256348)
That's not entirely fair; standards are full of hard coded values.
Re:Linux may have been causing USB disconnects by masklinn on Thursday August 22, 2013 @08:05AM (#6256589)
In fact the 7-14 table mentioned in TFAA is literally a table of magic values to hard-code: it's a big table listing all the timings of section 7 and their minimum and maximum values (either one of which may be absent)
Re:Linux may have been causing USB disconnects by adestefan on Thursday August 22, 2013 @07:06AM (#6256371)
Especially timer values.
Re:Linux may have been causing USB disconnects by zwdr on Thursday August 22, 2013 @08:00AM (#6256567)
USB 3.0 uses interrupts, but if you're trying that with 2.0 you're gonna have to wait for those interrupts a _long_ time.
Re:Linux may have been causing USB disconnects by JoeAltmaier on Thursday August 22, 2013 @07:26AM (#6256430)
Agreed. There's no reason to slavishly imitate a spec, when you can be more generous or better yet just test and wait.

Embedded programmers know this; you can't ship working appliances without dealing with these issues.

Re:Linux may have been causing USB disconnects by barrkel on Thursday August 22, 2013 @08:20AM (#6256625)
There's no reason to slavishly imitate a spec

You're forgetting the feeling of smug virtuousness you get when you end up being incompatible because you're more technically correct (the best kind) than the other components you're interacting with.

You get to say the other guys are all wrong, wage wars against them, blacklists, all the usual religious crap etc.