Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Linux

Misinterpretation of Standard Causing USB Disconnects On Resume In Linux 280

hypnosec writes "According to a new revelation by Sarah Sharp, misinterpretation of the USB 2.0 standard may have been the culprit behind USB disconnects on resume in Linux all along rather than cheap and buggy devices. According to Sharp the USB core is to blame for the disconnections rather than the devices themselves as the core doesn't wait long enough for the devices to transition from a 'resume state to U0.' The USB 2.0 standard states that system software that handles USB must provide for 10ms resume recovery time (TRSMRCY) during which it shouldn't attempt a connection to the device connected to that particular bus segment."
This discussion has been archived. No new comments can be posted.

Misinterpretation of Standard Causing USB Disconnects On Resume In Linux

Comments Filter:
  • by Anonymous Coward on Thursday August 22, 2013 @09:05PM (#44650385)

    Clearly the whole thing is broken, and we should transition to a newer, more open and transparent system than even open source.

    I will call it OPENER Source. You aren't just able to read the source, you're required to read it!

  • Update (Score:5, Informative)

    by Anonymous Coward on Thursday August 22, 2013 @09:08PM (#44650399)

    "Update: Looks like this is an xHCI specific issue, and probably not the cause of the USB device disconnects under EHCI. "

  • linux has bugs? (Score:5, Interesting)

    by Anonymous Coward on Thursday August 22, 2013 @09:13PM (#44650441)

    Could have fooled me, I end up spending upwards of 3 months a year fixing bugs in the base os that we ship to run our appliance on. Some of the linux subsystems still read like they were written in someone's basement even after a decade of most of the maintainers being paid a yearly salary to maintain it. God forbid you actually fix some of the crap and post fixes though that are more than ten lines long.. Its a fine way to get blacklisted.

    • Re: (Score:3, Insightful)

      Strange. I'll admit that Linux has some drivers that are full of bugs, but the ones that are most full of bugs seem to be ones thrown over the wall by large hardware vendors. You know the ones - the drivers with 20000-line C files, that create 2000 checkpatch warnings. Those drivers were written by salaried employees, not sitting in their basement.
    • Re:linux has bugs? (Score:4, Insightful)

      by minus9 ( 106327 ) on Friday August 23, 2013 @02:41AM (#44652001) Homepage

      Yet you still choose it as the base OS to run your appliance on. Presumably it's still better than any of the alternatives.

      All software has bugs. I'm sure plenty of device drivers written in brightly lit offices by people with smart haircuts and shiny shoes have some absolutely horrific code too. I doubt which floor you work on has any significant effect.

  • not surprising (Score:2, Interesting)

    by angryargus ( 559948 )

    Power Management has worked well on Windows for 15+ years. I'm still waiting for Linux's first year, so problem on Linux are with the kernel and/or the drivers.

    • Re:not surprising (Score:4, Informative)

      by Anonymous Coward on Thursday August 22, 2013 @09:34PM (#44650587)

      You just said power management worked well on windows 98 and 95.

      I am calling you a liar.

      • You flipped the switch or hit the power button, it turned on, flip/hit it again, it went off. What didn't work right?

    • Re:not surprising (Score:5, Informative)

      by TheGavster ( 774657 ) on Thursday August 22, 2013 @09:36PM (#44650599) Homepage

      15+ years is a stretch. Even in the 2006-07 era at the end of XP's development, there were brand new machines that couldn't return from sleep correctly. It was particularly vexing since a lot of them were laptops factory configured to sleep when left unattended. I will say that I haven't had any complaints with S3 sleep since the advent of Windows 7, however.

      • by DG ( 989 )

        I've got an XP laptop that instantly BSODs the second you close the lid.

        So yeah, myth busted.

        DG

        • Re: (Score:3, Insightful)

          by Barsteward ( 969998 )
          i've got a laptop that blue screens when you pull out the power cord.

          If i remember correctly a lot of the power management problems are due to the manufacturers not implementing the standards correctly, they implemented them to the broken Windows implementation in order to keep WIndows working.
      • Have a couple of Acer laptops running Windows 7 with displays that frequently (always?) don't come up out of sleep. The solution is to close the laptop and open it again, but this is obviously quite a pain. Linux actually performs better in this regard on the one. THe other one is my wife's so it isn't running Linux.

        • by philip.paradis ( 2580427 ) on Thursday August 22, 2013 @10:15PM (#44650815)

          THe other one is my wife's so it isn't running Linux.

          My wife's laptop is running Debian 7. What's up with your wife? :)

          • THe other one is my wife's so it isn't running Linux.

            My wife's laptop is running Debian 7. What's up with your wife? :)

            My guess is his is not imaginary.

            • Re: (Score:2, Offtopic)

              Oh heavens, it must be happening again. I'm obviously experiencing a relapse of those terrible hallucinations that have plagued me for years. Oddly enough, they seem to be at their worst when I'm at home. I've had visions of a beautiful woman in my house, with two beautiful little girls running around as well. I know, I should seek medical attention immediately, as this could be a sign of a serious condition. Speaking of conditions, my sense of reality is so distorted that I've come to believe my fictitious

              • by KGIII ( 973947 )

                Wait... I thought you said she was beautiful? ;)

                I'm just screwing with you - she's a wonderful looking woman and has good taste in operating systems as well assuming she uses it because she likes to and not because it pleases you. Then again, doing it for the latter reason isn't horrific or anything but I'm an idealist I guess. (Which is why I no longer have a wife.)

              • by Alsee ( 515537 ) on Friday August 23, 2013 @06:20AM (#44652711) Homepage

                Oh heavens, it must be happening again. I'm obviously experiencing a relapse of those terrible hallucinations that have plagued me for years.
                Oh, wait, she's real after all. [palegray.net]

                Dude, you posted a photo of a laptop sitting on the armrest of an empty couch ;)

                -

        • Re: not surprising (Score:5, Interesting)

          by FireFury03 ( 653718 ) <<slashdot> <at> <nexusuk.org>> on Friday August 23, 2013 @02:07AM (#44651879) Homepage

          FWIW, I now have a policy of avoiding Acer like the plague and advising my customers to do the same, owing to their appealing customer support when advised that an entire product line had a bios bug.

          http://www.nexusuk.org/~steve/acer.xhtml [nexusuk.org]

          TL;DR: one of their lines of laptops has a dsdt bug, I informed them, they weren't interested. I even sent them a patch, still not interested (and decided that completely ignoring my emails was the best approach). To this date they haven't released an updated bios.

          • Sadly, most companies won't allow the customer to talk directly to engineering.
            • Sadly, most companies won't allow the customer to talk directly to engineering.

              I didn't want to talk directly to engineering, I just wanted someone to pass the patch on to the right people and get a fixed BIOS to a defective product line. Instead they thought it was better customer service to thrown my emails into the bitbucket. That's the kind of customer service that gets a company onto my blacklist.

          • I share the same policy. I bought one and only one Acer in my life. It was the first Acer I bought and is the last. Early on it would not sleep under Linux so I took at look at the BIOS. That thing was so sloppily coded! The batteries that Acer shipped with the laptop also had a manufacturing flaw that caused them to fail prematurely. Batteries degrade over time progressively but these would one day perform at 90% original specs and the next day perform the best brick impression. I owned two Acer-approved b

        • FWIW, I now have a policy of avoiding Acer like the plague and advising my customers to do the same, owing to their appealing customer support when advised that an entire product line had a bios bug.

          http://www.nexusuk.org/~steve/acer.xhtml [nexusuk.org]

          TL;DR: one of their lines of laptops has a dsdt bug, I informed them, they weren't interested. I even sent them a patch, still not interested (and decided that completely ignoring my emails was the best approach). To this date they haven't released an updated bios.

      • Re: (Score:2, Informative)

        by angryargus ( 559948 )

        There's a big difference between Windows where problems are a corner case, vs. Linux where success is a corner case. But the point still remains that I've used sleep and hibernate on most of my Windows machines without really fearing problems or data loss (I'll still save any progress before initiating it, though thanks to Office 97 I'm in the habit of saving regularly regardless), but I can't think of even bothering to try such a thing on Linux (nor can even of the people I know who love Linux enough to a

    • Re:not surprising (Score:4, Informative)

      by Qzukk ( 229616 ) on Thursday August 22, 2013 @09:42PM (#44650623) Journal

      Spoken like someone who's never had to reboot a computer from coma mode.

    • by dltaylor ( 7510 ) on Thursday August 22, 2013 @09:50PM (#44650657)

      Far too many vendors are only willing to provide chip documentation under a Non-Disclosure Agreement (NDA), which prevents a knowlege-, as opposed to empirical-based Linux driver. This allows them to kludge around chip deficiencies in a Windows driver without the user being aware of any issues. Even Intel has started making it harder to get the real manuals for their CPUs and bridges (they used to ALL be published on Intel's FTP and HTTP sites). Frequently, in System-on-Chip (SoC) implementations, even the CHIP vendors don't know anything; they just pass along whatever quick and dirty proof of concept the designers of some feature of the chip provided and call it a "working driver", while it is nothing that would pass even a cursory QA process.

      The first Linux code I wrote was a "quirk" handler for a parallel ATA PCI chip that came up programmed to the same default I/O addresses as the South Bridge's internal ports, and a BIOS that didn't properly perform PCI enumeration on it, since it already had PCI addresses.

      • Far to many companies are prepared to buy chips with documentation under NDA. I would expect engineers who specify these chips to be sacked by a sensible manufacturer.
    • Power management ?

      It's worked well for years on Linux. Only problems I ever had were involving nVidia workaround drivers and sleep.

    • by jamesh ( 87723 )

      My Windows 7 laptop will regularly not come out of sleep, requiring a battery removal to resolve. This occurs more often when I'm packing up and unplug something while it's going to sleep. Typically this happens after about 3 weeks since last reboot, which really sucks because it only has to get to a month and it gets rebooted to install updates anyway.

      The other annoying thing it does is when it wakes up it still thinks it has the external monitor attached (the VGA/DVI monitor only - the USB attached ones a

  • by AdamHaun ( 43173 ) on Thursday August 22, 2013 @09:31PM (#44650567) Journal

    Sarah's Google+ post has an update:

    Update: Looks like this is an xHCI specific issue, and probably not the cause of the USB device disconnects under EHCI. To everyone who commented with other USB issues (none of which really sounded related), please email the linux-usb mailing list with a description of your issue.

  • USB sucks (Score:5, Informative)

    by Skapare ( 16644 ) on Thursday August 22, 2013 @09:34PM (#44650583) Homepage

    USB as a whole is already a silly design, having all these silly details and ambiguities. For example, where it has a minimum time (10ms in this case), it should also have a maximum time (for example 50ms). Devices should be able to communicate after that maximum time or they are broken. Actually, there should be a maximum time when powered up ... how is a minimum even useful for anything.

    This only needs to specify controller communication, not device function. For example a hard drive might take several seconds to spin up and get in sync. But the controller should be able to do basic communication in 50ms, even if all it can say about the actual hard drive is "spinning up but not ready". USB has a lot of other stuff that is far from the KISS principle.

    • Welcome to EE (Score:5, Insightful)

      by Ignacio ( 1465 ) on Thursday August 22, 2013 @09:44PM (#44650637)

      The 10ms is for the software. The flip side of this is that the hardware has a maximum of 10ms to get its shit together so that it can be connected to. And 10ms is forever in hardware.

      • by jamesh ( 87723 )

        The 10ms is for the software. The flip side of this is that the hardware has a maximum of 10ms to get its shit together so that it can be connected to. And 10ms is forever in hardware.

        Dear Linux kernel, i'll be ready when my disk is done spinning up. kthanksbye

        • by Ignacio ( 1465 ) on Thursday August 22, 2013 @09:59PM (#44650723)

          The 10ms is for the software. The flip side of this is that the hardware has a maximum of 10ms to get its shit together so that it can be connected to. And 10ms is forever in hardware.

          Dear Linux kernel, i'll be ready when my disk is done spinning up. kthanksbye

          Dear USB hard drive, that's fine, but don't go and disconnect from the USB bus in the meantime. Forever waiting, Linux kernel.

      • And 10ms is forever in hardware.

        Not if the hardware is composed of a microprocessor, and the hardware holds the CPU in reset for 2 ms waiting for the crystal to stabilize before letting it run.

        The 10 ms is for the DEVICE to get it's shit together. Coming out of suspend, the host starts sending SOF's, and must not send anything else to the device for 10 ms. The DEVICE is required to be ready for communications from the host after this 10 ms period.

      • Comment removed based on user account deletion
        • by Alsee ( 515537 )

          Atleast with the case of xHCI the 10ms is actually a minimum for both -- the specs do not indicate a maximum for the hardware to resume at all.

          That's not how specifications work. Both sides are required to obey the spec for things to work. A minimum for one side is a maximum for the other side.

          It's like we have a lunch break specification. The specification says that on a lunch break he must wait a minimum 30 minutes before sending the employee more work to do. This means the employee has a maximum 30 minutes to finish lunch.

          What is happening here is that the employer (the computer) is obeying the spec. It's waiting the required minimum time, then

    • by skids ( 119237 )

      You're pulling your punches. USB was a completely half-ass standard to start with, and then was continually modified with half-ass frankenstein additions to provide features that were already in competing bus technologies, once its designers finally had to admit that those features were actually useful.

      Anyway it is not much of a surprise that things can slip in the USB area. There are only a few developers who are both talented enough to work do it right and also have the patience for wasting their talent

      • well, you CAN plug a usb male connector into an rj45 jack.

        it won't work, but it will fit just fine.

        (stupid oversight. the last 15 or so years, cable and connector designers have been pretty idiotic. don't get me started on that rant..)

        • Have done that. These days I also find myself inserting an USB device to an HDMI port as they look similar enough.
      • by tlhIngan ( 30335 )

        You're pulling your punches. USB was a completely half-ass standard to start with, and then was continually modified with half-ass frankenstein additions to provide features that were already in competing bus technologies, once its designers finally had to admit that those features were actually useful.

        Anyway it is not much of a surprise that things can slip in the USB area. There are only a few developers who are both talented enough to work do it right and also have the patience for wasting their talent m

      • As someone whose computer experience predates the birth of USB by many years, I find all the criticism of USB to be a hoot. I mean, sure, it's a mess compared with an ideal system, but oh my lord it's so much better than the mess we had before I don't even know what to say. When peripheral interconnects are so good that we resort to complaining about USB, it's a better world than I could have dreamed of 25 years ago.

        • When peripheral interconnects are so good that we resort to complaining about USB, it's a better world than I could have dreamed of 25 years ago.

          USB basically works now because a lot of very bright kernel developers have been beating it into submission since the late 90's.

          I remember pre USB, with my DIN keyboard and RS-232 mouse, parallel Epson compatible printer, 10 Base T ethernet and floppy drive. They all worked just fine.

          I also remember when USB started taking over and one had to keep PS2 keyboards an

    • by sl149q ( 1537343 )

      In the best of all worlds, devices should treat it as a maximum and hosts should treat it as a minimum.

      • In the SPEC, devices are required to treat it as a maximum and the host is required to treat it as a minimum. Any device which isn't ready for communications after 10 ms are broken, and any host that attempts communications before 10 ms is broken. This isn't an area of the spec that's in any way vague.

        • Agreed.

          Do we think that Sarah will receive some trademarked swearing because of this?
          http://news.techeye.net/chips/linus-torvalds-and-intel-woman-in-sweary-spat
          http://linux.slashdot.org/story/13/07/15/2316219/kernel-dev-tells-linus-torvalds-to-stop-using-abusive-language

          I'm beginning to wonder if Sharp is a MS or Apple plant, sent into linux kernel work to sow seeds of antagonism and self-destruction.
    • USB as a whole is already a silly design, having all these silly details and ambiguities. For example, where it has a minimum time (10ms in this case), it should also have a maximum time (for example 50ms). Devices should be able to communicate after that maximum time or they are broken. Actually, there should be a maximum time when powered up ... how is a minimum even useful for anything.

      There is a maximum time, which is 10ms. According to the spec, the kernel has to wait 10ms for the device to be ready. Say you have different kernels waiting 10, 20, 50 and 100 ms. A device that is ready after 15ms works on 3 kernels, but not on all 4, therefore it is broken. Actually, the device must be ready in 10ms, or it is broken.

      "Minimum time the kernel has to wait" = "Maximum time the device is allowed to take to get ready".

  • by billstewart ( 78916 ) on Thursday August 22, 2013 @09:34PM (#44650585) Journal

    Unfortunately, the article's referring to the "misinterpretation" passively, not saying directly who the author is asserting misinterpreted the spec, but I think from context it seems to be saying "misinterpreted by Linux", as opposed to "misinterpreted by lots of cheapo USB devices". It's bad that Linux does that, but it's certainly easier to fix in one place in Linux than going out to lots of vendors putting out equipment with very low profit margins and hope they'll all do the right thing.

    I was also a bit confused as to when the article was referring to microseconds (s) vs. milliseconds (ms); I found it surprising that it seemed to be saying that most of the devices responded in under a microsecond, while others were over 10ms.

    • I have used Linux in the past as a rough guideline to determine what something ambiguous means. The assumption is that the devices work in Linux and have been tested somewhat, therefore how Linux does things is a better first approximation of what I should do than just guessing. I also hedged this by looking at xBSD code which is easier to understand.

      A lot of times when it's safest to just try and figure out what Windows does because there are countless devices that only support the commands that Windows

  • by UltraZelda64 ( 2309504 ) on Thursday August 22, 2013 @09:38PM (#44650609)

    Back in the mid-1990s to the mid-2000s when I used Windows, I realized sleep mode was a complete joke, unreliable, and just stopped using it by the time I upgraded to Windows XP or shortly after. In Linux, I am still not a fan of waiting for the damn thing to "wake up" for 5-10 seconds before it will even accept my password, so the only component that ever even enters standby on my machines is the moniter (and this has been the case for over a decade, even dating back to my last years in Windows). Windows, Linux--doesn't matter what the OS is, not putting the system into standby makes the whole experience much smoother, faster and hassle-free.

    On the other hand, though--it is a good thing this was fixed for those laptop users out there.

    • My 8 year old laptop running Windows XP usually wakes up in under 5 seconds from sleep.
      When it was brand new it would last around 5 hours with the lid shut and turned on (it consumed around 10 - 12W idle with the screen off, with a 65Wh batter). On standby it would last weeks

      Standby support for a laptop is mandatory..

      • My several-year-old laptop running Xubuntu *boots* in about 5 seconds.

        Even now it lasts weeks when powered down. It consumes about 0 watts when powered down.

        Standby support is only mandatory for OSes that take a rediculously long time to boot.

        • Not true.

          Standby is there for when you want to leave your desktop applications open and have the benefits of using less energy while you eat dinner or take a walk. Hibernation is great if you need that 0 watts of draw, but don't want to have to have all your programs closed down and to have to start from scratch.

          • Hibernation is also good for those laptops which blink a LED while on suspend, and when that happens in the dark when you're sleeping, you can see the whole damn room pulsing. Hibernation puts the machine off, and if you pull the power cord off too, you usually are left with no lights. Ahh.
        • How long does it take Ubuntu to load all the applications you had previously open in the same state you left them?

      • My problem is that I'm impatient: 5 seconds is too too for me to wait for a machine plugged into a wall outlet to become responsive, and all of my computers to date have been desktop machines. But I agree with you that standby is very important on a laptop.

        I have never owned a laptop myself, but I likely will end up buying one at some point and have been considering what I will be doing as far as power management goes. I'm considering running the system 24/7 without the battery (to conserve it) and plugged

    • by ledow ( 319597 )

      To be honest, back in the 1990's - 2000's this was a problem. But so was a lot of other stuff.

      I'm no Windows fan, but I have had Windows XP and Windows 7 laptops for the last 6-7 years. Both basically live their lives in standby or hibernate and a full boot or BIOS screen means I forgot to charge it.

      They got turned on in the morning to check websites before work. Put into suspend. Taken to work. Opened and used for 8+ hours. Put into suspend. Taken home. Gamed/browsed on for the next 8 hours. Put i

      • Try pm-suspend-hybrid, this will initiate a normal hibernate: copy ram to disk as usual, but at the end it won't shutdown, but go into suspend. Result: If you come back, its instant on; but if the power ran out or was unplugged, your state is still saved and you return from hibernation.

        People still unplug their stuff or let the batteries run out so don't expect that scenario until a memory technology that keeps its state without power (such as mram) becomes the norm.

  • by kriston ( 7886 ) on Thursday August 22, 2013 @09:52PM (#44650679) Homepage Journal

    So I can close my laptop now instead of carrying it around like a sort of open pizza box for fear of never having a working mouse until the next reboot? How annoying to start a meeting by rebooting a Linux laptop.

    • by Yoda222 ( 943886 )
      Why do you need a mouse ?
      • by tlhIngan ( 30335 ) <slashdot&worf,net> on Thursday August 22, 2013 @11:55PM (#44651403)

        Why do you need a mouse ?

        Because most laptops generally have terrible pointing devices. If they have touchpads, they're usually far too tiny to be useful (Apple ones excluded - why can't others put big ass touchpads on their laptops?)

        The rubber trackpoint ones are nice for PCs, though the rubber tips wear down way too quickly and you end up with a slippery lump in short order.

        And practically all are pathetic at scrolling. Unless it's an Apple trackpad where the double finger scroll works (once you fix the ()#@% scroll direction).

        Life's just generally easier with an external pointing device.

    • by paskie ( 539112 )

      Not sure why would you fear for never having a working mouse until the next reboot, but besides that, may I kindly suggest configuring your laptop not to go to sleep when the lid closes? It really doesn't have to do that if you don't wish it to.

      • by kriston ( 7886 )

        That's the obvious solution, but, really, my computer should not lose the ability to be controlled by a USB device just because it went to sleep when the lid was closed. My Windows laptop has done this successfully for, like, fifteen years now?

      • by _merlin ( 160982 )

        may I kindly suggest configuring your laptop not to go to sleep when the lid closes? It really doesn't have to do that if you don't wish it to

        No you may not. I want it to spin down the disk for shock resistance while it's in my bag, and cut its power consumption so I'll have a useful amount of battery left when I get to wherever I'm going. I'm not going to shut down, because I don't want to lose where I was in all my applications. This is as bad as Microsoft IIS "it's not a bug - it's a feature" spin.

  • Unless the USB is on. It does not wake in time. Craptastic.
  • It explains a lot! (Score:4, Insightful)

    by gagol ( 583737 ) on Thursday August 22, 2013 @10:35PM (#44650949)
    That is why my laptop sd-card reader is not working when I close the lid... until reboot. F!*$&%" usb...
  • You might as well try to tell the Sun not to set tonight.

You are always doing something marginal when the boss drops by your desk.

Working...