1

I have a USB ethernet card that works well with Ubuntu 18.04. Now I need to find a way to turn it on and off with command.

I tried the command sudo ip l s dev enx00249b450d4d down (enx00249b450d4d is the name of the interface), but nothing changes.

I also installed net-tools and tried the command sudo ifconfig enx00249b450d4d down, but had no luck either.

I searched the internet but the information about Ubuntu 18 is still scarce. Any idea?

T. Wu
  • 21
  • so it's a usb dongle that turns into an ethernet port? would turning off the usb port it's plugged into be an acceptable solution? – tatsu Apr 11 '19 at 08:11
  • Yes that solution is also acceptable. Could you provide more details? – T. Wu Apr 11 '19 at 14:41
  • well lets run though theses steps : https://linuxhint.com/list-usb-devices-linux/ start with the first suggested command (lsusb) and edit your post to inlcude the output it gives you. – tatsu Apr 11 '19 at 14:44

1 Answers1

0

you can do like so :

First, run lsusb.

The output should be like:

Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 2232:1020  
Bus 002 Device 009: ID 0bc2:a013 Seagate RSS LLC 
Bus 002 Device 003: ID 0a5c:219c Broadcom Corp. 

In the output, find the device number of the port to be disabled. For example, the Seagate drive in the example has Device 009 - that is its device number. Then the id will be usb[device number] - such as usb9

Then, disable USB wake-up (do this only once):

Be sure to replace X in usbX with the device number.

echo disabled | sudo tee /sys/bus/usb/devices/usbX/power/wakeup 

Then turn it off:

echo suspend | sudo tee /sys/bus/usb/devices/usbX/power/level

Undo this:

echo enabled | sudo tee /sys/bus/usb/devices/usbX/power/wakeup
echo on | sudo tee /sys/bus/usb/devices/usbX/power/level

source : https://askubuntu.com/a/750455/307184

tatsu
  • 3,107
  • Thank you for the information. I tried the command echo disabled | sudo tee /sys/bus/usb/devices/usb4/power/wakeup, but it returned "No such file or directory disabled" – T. Wu Apr 12 '19 at 01:29
  • do cd /sys/bus/usb/devices/ and ls – tatsu Apr 12 '19 at 06:04
  • cd /sys/bus/usb/devices/ and ls returns
    1-0:1.0  1-1:1.0  1-2      1-8      1-8:1.1  2-3      usb1
    1-1      1-1:1.1  1-2:1.0  1-8:1.0  2-0:1.0  2-3:1.0  usb2
    
    – T. Wu Apr 12 '19 at 06:48
  • see? there is no usb4. I don't know why you got that number but you need to find the right number. – tatsu Apr 12 '19 at 08:40