Fixing USB configuration 101



  • I had to share this gem that I wrote for my blog, I still can't believe it.

    [QUOTE]A few weeks ago I tried to get into this Lunix thing, as any nerd
    needs at least a +2 Lunix Skillz, which basically consists of being
    able to chat on IRC and copy/pasting text. So I downloaded Damn Small Linux and burnt it to a CD.

    I popped it in the drive and rebooted... several times, since the boot menu went too fast for me to press the 'edit BIOS' button in time. Eventually I set it to boot from CD first and got DSL working. It all went well and I spent a day being a Lunix nerd.

    It was coming back to Windows XP when the real (copy/pasting aside) problems started.

    The first problem was that for whatever reason it wouldn't boot up until I set the BIOS back to how it was, but I only found the second, more serious, problem a week or two later. DSL had changed the USB configuration and hadn't put it back.

    When my printer stopped working and my flash drive wouldn't connect, I knew there was a problem, and there was only one major change since the hundreds of other times I'd used these devices.

    When I talked to Patrick about the problem, he suggested doing a System Restore, as that should fix it right up... pity I turned that feature off to save a bit of space.

    I had no idea how to fix it aside from reinstalling Windows, until today when my mother (who is completely computer illiterate) had somehow got the printer working. My USB drive worked too, it was a miracle. But the question was, how did she do it?

    There was a power failure yesterday while the computer was on.[/QUOTE]

    WTF? 



  • If Linux somehow messed up your USB ports (which I doubt), you should get them to reset by unplugging your computer and pressing the power button (to discharge everything). I've only seen this happen with network cards though - and only when hibernating Windows and then going to Linux.

    BTW, if your motherboard is Asrock, it might be that your USB ports are dying - I've seen that happen on 2 Asrock boards lately, and there were some reports about it in a few forums I attend.



  • [quote user="ender"]If Linux somehow messed up your USB ports (which I doubt), you should get them to reset by unplugging your computer and pressing the power button (to discharge everything). I've only seen this happen with network cards though - and only when hibernating Windows and then going to Linux.[/quote]

    Hmmm, that must be why a sudden power outage fixed it

    [quote user="ender"]BTW, if your motherboard is
    Asrock, it might be that your USB ports are dying - I've seen that
    happen on 2 Asrock boards lately, and there were some reports about it
    in a few forums I attend.
    [/quote]

    I should check it, I had to replace it only a little while ago because of BIOS problems. If I lost the USB ports on that computer, I'd probably have to replace it because it is really out of date now and I use USB a lot.



  • [quote user="Einsidler"]

    A few weeks ago I tried to get into this Lunix thing,

    [/quote]

    What the hell is "Lunix"?

    And what's so mysterious about a power cycle solving an electronics problem?

     



  • [quote user="Thanny"]What the hell is "Lunix"?[/quote]This.



  • [quote user="ender"][quote user="Thanny"]What the hell is "Lunix"?[/quote]This.[/quote]
    Also, as in this case, a slang term for Linux. I guess because a lot of Linux proponents are or seem to be loonies.


    Wallsy.



  • [quote user="ender"]If Linux somehow messed up your USB ports...[/quote]

    Oh... I like this attitude - I see it really often :)

    I'll try to not sound as *nix fanboy, but here's the situation:

    - Windows runs ok
    - Booting Linux, which changes config, when needed, runs ok
    - Booting Windows, which can't reconfigure USB properly => "if Linux messed up your ports"

    Am I the only one seeing seeing problems in Windows hardware support?

    (Going back to /. to bash M$.... errr... not really ;) )
    ((Oh - also Lunix is properly included in *nix-es :) ))
     



  • [quote user="viraptor"]

    [quote user="ender"]If Linux somehow messed up your USB ports...[/quote]

    Oh... I like this attitude - I see it really often :)

    I'll try to not sound as *nix fanboy, but here's the situation:

    - Windows runs ok
    - Booting Linux, which changes config, when needed, runs ok
    - Booting Windows, which can't reconfigure USB properly => "if Linux messed up your ports"

    Am I the only one seeing seeing problems in Windows hardware support?

    (Going back to /. to bash M$.... errr... not really ;) )
    ((Oh - also Lunix is properly included in *nix-es :) ))
     

    [/quote]

    Right, blame Microsoft! They should take into account booting the same computer into other OSes and messing with BIOS/hardware settings! They are also responsible for a user shutting off important services like System Restore to 'free up some space'.

    Geez. Think about it before you say it...

     



  • [quote user="MasterPlanSoftware"]

    Right, blame Microsoft! They should take into account booting the same computer into other OSes and messing with BIOS/hardware settings!

    [/quote]

    Hmmm..... Yes? Bad drivers can also make mess in hardware settings. Win. should be able to recover without problems on next reboot. Welcome to P&P and year > 2000.

    [quote user="MasterPlanSoftware"]

    They are also responsible for a user shutting off important services like System Restore to 'free up some space'.

    [/quote]

    Did I say that?... Damn - I've got to get some sleep - seems, that you've heard something I don't remember saying ;)

    [quote user="MasterPlanSoftware"]

    Geez. Think about it before you say it...

    [/quote]

    ...... done.



  • huh?

    There is no USB configuration to change. For Windows or for DSL (or any linux for that matter).

    You are experiencing an unrelated issue, which might have been something you did in the BIOS but didn't realize what the implications were.

     1) If you can't configure your BIOS correctly so that it always tries the CD-ROM first, then the hard drive, then either a) your bios is fucked b) you don't know what you're doing

     2) There is no reason to turn on Legacy USB keyboard/mouse support if you're using Linux or Windows XP. (You didn't mention it but I think you probably did, thinking you needed it for DSL for some reason). Both OSs properly support a "real" USB keyboard. The exception might be GRUB and NTLDR... if you need to operate those menus then I just reboot and temporarily enable it, then disable it later. I mention this because some BIOS/motherboards will sometimes screw up your USB when you change that setting.

     3) Lots of USB implementations suck. In general. Keep a known, working USB add-on PCI card with you at all times and a powered hub. This can circumvent a lot of issues.
     



  • So anyway. I get this feeling that you really don't understand quite
    how USB works or how operating systems talk to it. It definitely isn't
    the fault of Windows or "Lunix", as there are no "settings" on a USB
    host to change that are saved between reboots at the OS level. DSL didn't do jack.

    USB
    hosts are one three standards: OHCI, UHCI, or ECHI (USB 2.0). The OS
    enumerates PCI devices and looks for devices that are reporting one of
    these three compatible PCI-IDs that corresponds to the host driver
    chip, and begins to talk to it using one of the three standards. There
    is no firmware, no remembered settings, no card or chipset specific
    dialects ... that's it. It enumerates the device USB tree and begins
    listening for messages, sending control messages, and loading up
    device-specific drivers when necessary.

    What the BIOS does to
    initialize the particular USB implementation on your motherboard is a
    different story, outside of the scope of the OS. I am sure this is where
    you did something to mess it up. Or your motherboard just decided to be fucked for awhile until a power issue set it right.
     



  • hk0: what about network cards? If I hibernate Windows, and then boot to Linux, the network card won't work no matter what I try, unless I unplug the power and network cables before booting to Linux.



  • [quote user="ender"]If I hibernate Windows, and then boot to Linux, the network card won't work no matter what I try, unless I unplug the power and network cables before booting to Linux.[/quote]

    Got something similar on my box. But what also worked, was resetting the router - it was just going nuts after I hibernated win. No idea why. Might be something wrong about putting ethernet card to sleep, or about not releasing dhcp, but these are just wild guesses.



  • [quote user="viraptor"][quote user="MasterPlanSoftware"]

    Right, blame Microsoft! They should take into account booting the same computer into other OSes and messing with BIOS/hardware settings!

    [/quote]

    Hmmm..... Yes? Bad drivers can also make mess in hardware settings. Win. should be able to recover without problems on next reboot. Welcome to P&P and year > 2000

    [quote user="MasterPlanSoftware"]

    They are also responsible for a user shutting off important services like System Restore to 'free up some space'.

    [/quote]

    Did I say that?... Damn - I've got to get some sleep - seems, that you've heard something I don't remember saying ;)

    [quote user="MasterPlanSoftware"]

    Geez. Think about it before you say it...

    [/quote]

    ...... done.

    [/quote]

     

     

    You obviously have a few misconceptions about how windows and operating systems in general work with hardware. hk0 does a very good job at explaining this, which is good, since I dont have the time or patience to go into that much detail.

    If anything was changed when booting linux, you certainly cannot blame Windows... Or P&P and the year 2000. That just makes you sound ridiculous. P&P works fine, IF you know what you are doing.

    But I don't think there WAS a problem, which is what I was saying in my second point. Obviously we are not dealing with someone who has maintained his system, and has disabled something essential like system restore. People who do these kinds of things bring misery upon themselves. Microsoft cannot be blamed here.

    So when you are attacking windows, make sure it is based on a professional setup and user, and there is some factual basis.



  • Just throwing out an idea here,

    The network card is different from many peripherals in that it's usually running even when the "computer" is turned off (particularly for on-board PHYs).  Unlike most hardware, you can't assume that the network card is in any kind of state at power on, since the state doesn't reset at power off (it keeps running).

    This sounds to me like a problem with the Linux driver.  It may not be properly resetting the network card.  Considering how many network cards and drivers there are, you'd really have to know what card/driver you're using.

    Considering you're using hibernate, perhaps Windows isn't properly closing the card.  After all, it expects the card to be in an identical state when it wakes up.  If this is the case, Windows is making as bad of an error as the Linux driver.

    Morale of the story: hibernating between two operating systems is horribly error prone.  Avoid it. 



  • [quote user="Wallsy"][quote user="ender"][quote user="Thanny"]What the hell is "Lunix"?[/quote]This.[/quote]
    Also, as in this case, a slang term for Linux. I guess because a lot of Linux proponents are or seem to be loonies.
    [/quote]
     

    Actually, Lunix is slang for UNIXy operating systems, Linux being one of them (Linux + UNIX = Lunix)

    </late> 



  • [quote user="MasterPlanSoftware"]

    You obviously have a few misconceptions about how windows and operating systems in general work with hardware. hk0 does a very good job at explaining this, which is good, since I dont have the time or patience to go into that much detail.

    [/quote]

    I know hardware communication, not USB though, so no idea how that one works. I didn't even say I knew that. I was just ridiculing the "doesn't work - it must've been linux" quotes, because people are more likely to criticize something they don't know, rather than something that's not working. Other stories, from my friends from this week only: "windows cd doesn't boot - it must be grub in mbr - how to clean mbr?", "I lost connection, it must be the linux on my hub, how to reboot it?", etc.

    + yes. I expect system to setup devices properly after it's out of hibernation. So far only had problems with it on win. - try unpluging usb-stick in w2k when hibernated :) boom! (can't write to device messages showing up randomly untill next reboot)

    [quote user="MasterPlanSoftware"]If anything was changed when booting linux, you certainly cannot blame Windows...[/quote]

    If it can't reinit a device after hibernation - I do and I will blame any system that can't do it. So far I've run into 1 only.

    [quote user="MasterPlanSoftware"]...has disabled something essential like system restore. People who do these kinds of things bring misery upon themselves. Microsoft cannot be blamed here.[/quote]

    Agreed. "Load, aim foot, shoot" at it's best :)



  • [quote user="Wallsy"][quote user="ender"][quote user="Thanny"]What the hell is "Lunix"?[/quote]This.[/quote]

    Also, as in this case, a slang term for Linux. I guess because a lot of Linux proponents are or seem to be loonies.





    Wallsy.

    [/quote]

     

    Also famously used by Jeff K, which is mentioned briefly on wikipedia: http://en.wikipedia.org/wiki/Lunix



  • [quote user="gxti"]

    [quote user="Wallsy"][quote user="ender"][quote user="Thanny"]What the hell is "Lunix"?[/quote]This.[/quote]
    Also, as in this case, a slang term for Linux. I guess because a lot of Linux proponents are or seem to be loonies.
    [/quote]
     

    Actually, Lunix is slang for UNIXy operating systems, Linux being one of them (Linux + UNIX = Lunix)

    </late> 

    [/quote]

    The most common term for that is *NIX, since almost every UNIX variant has a name ending in IX, and most of them end in NIX.



  • [quote user="viraptor"]

    [quote user="ender"]If I hibernate Windows, and then boot to Linux, the network card won't work no matter what I try, unless I unplug the power and network cables before booting to Linux.[/quote]

    Got something similar on my box. But what also worked, was resetting the router - it was just going nuts after I hibernated win. No idea why. Might be something wrong about putting ethernet card to sleep, or about not releasing dhcp, but these are just wild guesses.

    [/quote]

     As other have mentioned, it's because hardware isn't set to a good state during hibernate. Network cards with wake-on-LAN are still active even when you are hibernating or the machine is off. This is so the computer can be woken up via the network. Hibernating the computer doesn't put the card back to it's power-on state; it leaves it in an intermediate or active state. The linux driver sounds like it is not happy with this and refuses to initialize the card, or can't communicate with it in order to do so (there is hidden state for the "active" driver in Windows stuck in the hibernation file, which it may need to send commands, and it can't just guess). There might be an a module option for the driver that forces it to reset the card through some means (check the output of modinfo -p your_driver). The same situation will probably occur if you hibernate in Linux and boot into Windows. And even if it did work in either case, going back again and waking up the hibernated OS could cause crashes or driver errors, requiring a reboot.

    Removing the power from the whole computer will cause the card to turn off for real, and it will come back on in a base state. Removing the network cord is probably not necessary (try it).

     
    As to why resetting the router helps... sounds like you've got linux and windows trying to compete for IP leases from the same MAC address which is confusing the DHCP server. It's like as if the same computer asked for a new IP (or the same one), twice, from the same MAC address. If it gives you a address, it'd probably screw ARP for a little bit until it times out, and NAT might be messed up. Or it might refuse to give you an address, claiming you already asked for one. Which isn't good either... no DHCP for you.

    Definitely should release your DHCP before rebooting into another OS using the same interface.
     



  • [quote user="MasterPlanSoftware"]

    P&P works fine, IF you know what you are doing.

    [/quote]

    Um, no. P&P works fine, IF the minimum-wage immigrant worker who wrote your driver knew what he was doing.  If he didn't, you're screwed.



  • [quote user="hk0"]Removing the power from the whole computer will cause the card to turn off for real, and it will come back on in a base state. Removing the network cord is probably not necessary (try it).[/quote]It is necessary, I tried.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.