Results 1 to 9 of 9

Thread: Is there a way to logically unplug and replug a USB device to achieve the same result

  1. #1
    Join Date
    Sep 2012
    Location
    North West England, UK
    Beans
    72
    Distro
    Ubuntu 14.04 Trusty Tahr

    Is there a way to logically unplug and replug a USB device to achieve the same result

    Hi, not sure whether what I'm seeking here has an appropriate equivalent in linux...

    I have a USB DVB-S2 adapter, have the firmware files in /lib/firmware. I'm periodically seeing issues that look like the device isn't responding properly and when I've unplugged and replugged the USB cable the issue is reset and I'm back to normal. I'm still debugging and am new'ish to linux so am wondering whether there is a more appropriate way to do what I'm doing or whether a physical disconnection/reconnection is the only method?

    I realise any DVB issues are more specialised that this group is intended for so I'll save those and post where appropriate so I guess I'm looking for a generic command set that would work for a variety of usb connected device types?

    Thanks all,

    K

  2. #2
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    6,559
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    KillerKelvUK; Hi !

    When ready to disconnect the usb devices do you "safely remove drive" them. Either from the file manager or from the terminal ?

    In order not to produce file errors, the devices MUST be unmounted; linux uses a cache for file operations, this cache is not written to disk until the device is "unmounted".

    Terminal method I use:
    Code:
    ls /media  ##gives the device identifier(s) ->8023-774f
    sudo umount /media/8023-774f

    hope this helps
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubutu'n !

  3. #3
    Join Date
    Jan 2007
    Beans
    6,542
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    Quote Originally Posted by Bashing-om View Post
    When ready to disconnect the usb devices do you "safely remove drive" them. Either from the file manager or from the terminal ?
    DVB is a digital video standard, so the OP isn't talking about a storage device here. I doubt a TV tuner would be mounted in /media would it?

  4. #4
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    6,559
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    oopps -- that is jumping to a erroronious conclusion !

    Good you are reading ..
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubutu'n !

  5. #5
    Join Date
    Sep 2012
    Location
    North West England, UK
    Beans
    72
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    Hi both, thanks for the interest...my devices are, to the best of my knowledge, only present in the /dev tree. I believe they are /dev/dvb/adapator0/...

  6. #6
    Join Date
    Sep 2012
    Location
    North West England, UK
    Beans
    72
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    Okay so have been reading more on this subject and I've not yet worked up the courage to start playing round...partly because I can't get my dvb device connected inside a VirtualBox so am doing this all on production.

    Is the solution I'm looking for to simply unload the firmware from the device? I've had to ensure the correct .fw files are located within /lib/firmware and when the device is connected the dmesg output shows that it needs to load said .fw file to enable it. Is there a way for me to force unload and reload the firmware...is this modprobe?

  7. #7
    Join Date
    Jul 2009
    Beans
    403
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    It's easy enough to remove the device with this, but it doesn't appear to be possible to rescan the usb bus to detect it again.
    Code:
    echo 1 | sudo tee /sys/bus/usb/devices/usb1/remove
    which would be the preferred way as it only affects a single device.

    Where as the below works fine but it causes everything on the bus to first be removed.
    Code:
    echo "00:1a.0" | sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
    echo "00:1a.0" | sudo tee /sys/bus/pci/drivers/ehci_hcd/bind
    'ehci_hcd' is the driver for the usb hub, it may be ohci or xhci depending on your hardware.

    The other method involves building a small C application which may be the best method.
    Mark your thread as [SOLVED], use Thread Tools on forum page.

  8. #8
    Join Date
    Sep 2012
    Location
    North West England, UK
    Beans
    72
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    @btindie, thank you I'll give the C application a try, appreciate the help.

    K

  9. #9
    Join Date
    Sep 2012
    Location
    North West England, UK
    Beans
    72
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Is there a way to logically unplug and replug a USB device to achieve the same re

    @btindia, kudos...the c application did exactly what I needed it to. No more pot-holing under the desk to unplug/replug my dvb box

Bookmarks

Posting Permissions

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