Results 1 to 7 of 7

Thread: Command to mimic unplug/plug of usb dongle?

  1. #1
    Junior Member g1ic7h's Avatar
    Join Date
    Jul 2007
    Posts
    73

    Question Command to mimic unplug/plug of usb dongle?

    I'm looking for a command to use in a script to mimic unplug and replug a usb wifi dongle.
    With my old card types, I used:
    Code:
    pccardctl eject
    pccardctl insert
    Usb equivalent???
    "A teacher is never a giver of truth; he is a guide, a pointer to the truth that the student must discover for himself." - Bruce Lee

  2. #2
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Quote Originally Posted by g1ic7h View Post
    I'm looking for a command to use in a script to mimic unplug and replug a usb wifi dongle.
    With my old card types, I used:
    Code:
    pccardctl eject
    pccardctl insert
    Usb equivalent???
    google + usb eject command line linux = first result .
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  3. #3
    Junior Member g1ic7h's Avatar
    Join Date
    Jul 2007
    Posts
    73

    Default

    google + usb eject command line linux = first result .
    Um...I do know how to search, And have for that matter.
    I have been here almost as long as you
    I have read the eject, umont, mount help as well...I maybe missing something but I am not trying to eject a jump drive.
    "A teacher is never a giver of truth; he is a guide, a pointer to the truth that the student must discover for himself." - Bruce Lee

  4. #4
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Quote Originally Posted by g1ic7h View Post
    Um...I do know how to search, And have for that matter.
    I have been here almost as long as you
    I have read the eject, umont, mount help as well...I maybe missing something but I am not trying to eject a jump drive.
    No one is questioning your length of time on/within the forums.
    Now as for the above, if you want to remove a drive you can unmount it with umount. If you get an error while trying to do so then you can issue the command fuser with the device id to find out why the drive was not unmounted from the previous command. I mean basically asking how to remove the drive (it is assumed that you want to do so in a safe manner) one can issue the umount command. When you use the gui to do so that is all that is happening. It uses umount to disconnect the specified drive.
    Again both of those are command that are discussed ad nauseum in the link I provided.
    If that is not what you are after then please post back with a bit more detail so that I can help you.
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  5. #5
    Junior Member g1ic7h's Avatar
    Join Date
    Jul 2007
    Posts
    73

    Default

    My bad, I thought my question was a direct one.
    I am familiar with ejecting a pen/jump drive and doing so safely.

    To be more specific, I need to reset a usb based wifi dongle
    the equivalent of manually unplugging/replugging it.

    with my old SRC 300 card i achieved this by issuing:
    pccardctl eject
    pccardctl insert

    As this is my first usb based wifi device, I am unsure of the proper syntax to use
    to achieve the same effect. If there is one? My reason for asking is as follows:
    I'm running BT4pre in vmware player tools installed
    My dongle is a Alfa 36h...seems to hang alot (no pattern) tried both drivers r8187 & rtl8187
    works well when first plugged in with either but, for some reason, after working with it for a while, ifconfig commands hang
    for minutes at a time??? a reboot is necessary to correct. I have tried rmmod then modprobe to no avail.
    I am not asking anyone too search for me (been looking for days now)...if you have a fix or a tip...better yet a solution or know the cause, please drop a line.

    I do thank you for your time assisting me, archangel.
    "A teacher is never a giver of truth; he is a guide, a pointer to the truth that the student must discover for himself." - Bruce Lee

  6. #6
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Generally taking the device "down" is the same as umount , at this point it can be removed from the plug. So # ifconfig athx down (where athx is the device name) will effectively shut the device down. Where as up will cause the interface to become active. Generally for usb sticks et. al.
    The reasoning behind using a "safe eject" or whatever is due to data being read/or written to the stick can become corrupted due to being unplugged before being turned off.

    EDIT: I typed the text here above a while ago but forgot to submit it. Now I see your edit as well.
    Generally in vmware one needs to give the virtual machine access to the usb devices before they will show up in the guest system.
    As such I am wondering if vmware is somehow losing control of the device to your host os.
    If there is some sort of usb auto polling that is stealing the usb device back from the vmware software.
    I believe that windows will do this sometimes. It will scan for changes in hardware devices and since it "finds" the usb device plugged in and it is not activated it will, activate it. Not sure if this is the reason but it may be. If you are using windows you can set up a hardware profile so that you can plug the adapter in and it will not be activated by windows. This might solve the problem.
    Also check out some of the threads here on your card to find out if others are having/ have had similar issues.
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  7. #7
    Junior Member g1ic7h's Avatar
    Join Date
    Jul 2007
    Posts
    73

    Default

    I have checked threads here for similar issues with not luck.
    I don't think vmware is losing control to my host OS... at least vmware is still showing connected to guest OS(bt4pre) and XP can not find the device So I think vmware is working as it should.
    I have no trouble switching the dongle back and forth between the host/guest OS's via the vmware player controls.
    Some thing else I just noticed, when ifconfig hangs so will iwconfig
    At this point, if I unplug the device, ifconfig/iwconfig command completes and unhangs and vmware releases control as well.
    Upon replugging the device, vmware will reconnect the device to the guest OS as it should( per my settings ) but BT4pre is still mucked up and issuing a iwconfig shows no device??? No matter how many times I disconnect/reconnect the device, BT4 no longer sees it.
    So, I tried rmmod rtl8187 and modprobe rtl8187 to reload driver...no luck, iwconfig still shows no device.
    Only a full reboot of BT4 in vmware will correct.

    Having realized this, if a manual unplug/replug will not fix, My idea of a script for this obviously will fail as well.
    Back to the drawing board.

    I am starting to remember why I put the alfa card back in its box and on the shelf, when testing it with BT2. Doing the same flaky crap after two years...really a shame, I like this card.
    "A teacher is never a giver of truth; he is a guide, a pointer to the truth that the student must discover for himself." - Bruce Lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •