Score:0

How to cut electricity to USB dongle

gi flag

is the Huawei E3372 LTE USB stick unlocked, I have a sim inserted in the dongle. The thing is to completely turn off the device to change the external IP of the sim. When I unplug and plug again the dongle it gets a new IP for example: I have the 37.29.232.115 (I get with https://wtfismyip.com/text) and when manually disconnect to the usb port and connect again I have a new IP 37.29.241.237. Can I do this from command line? I have tried usb_modeswitch, uhubctl, echo suspend > /sys/bus/usb/devices/x-x/power/level and a lot of things but I never get to cut the electricity in the dongle.

This is some command I tried. Also I tried to add in the config files some lines for the hub to get recognized but never sucessfully. sudo uhubctl -a off -p 2 -l 3-4 No compatible smart hubs detected at location 3-4! Run with -h to get usage info. There were permission problems while accessing USB. To fix this, run this tool as root using 'sudo uhubctl', or add one or more udev rules like below to file '/etc/udev/rules.d/52-usb.rules': SUBSYSTEM=="usb", ATTR{idVendor}=="2001", MODE="0666" then run 'sudo udevadm trigger --attr-match=subsystem=usb

Also when I do lsusb -t

luis@xx-xx-xx-3:/sys/bus/usb/devices$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 4: Dev 17, If 0, Class=Communications, Driver=cdc_ether, 480M
    |__ Port 4: Dev 17, If 1, Class=CDC Data, Driver=cdc_ether, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
    |__ Port 4: Dev 12, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

I know is the bus 03. port 4. but when I go to the directory and do ls I get a lot of things folders inside the folders, like this:

luis@xx-xx-xx-3:/sys/bus/usb/devices/3-4$ ls
3-4:1.0            bConfigurationValue  bMaxPacketSize0     configuration  driver         ltm_capable   product    speed      version
3-4:1.1            bDeviceClass         bMaxPower           descriptors    ep_00          manufacturer  quirks     subsystem
authorized         bDeviceProtocol      bNumConfigurations  dev            firmware_node  maxchild      removable  tx_lanes
avoid_reset_quirk  bDeviceSubClass      bNumInterfaces      devnum         idProduct      port          remove     uevent
bcdDevice          bmAttributes         busnum              devpath        idVendor       power         rx_lanes   urbnum

I dont know why appears a lot of folders what does it mean? and if I go back i get also the sames folders:

luis@xx-xx-xx-3:/sys/bus/usb/devices$ ls
1-0:1.0  1-4  1-4:1.0  2-0:1.0  3-0:1.0  3-2  3-2:1.0  3-2:1.1  3-4  3-4:1.0  3-4:1.1  4-0:1.0  usb1  usb2  usb3  usb4

I also tried usbreset and it works fine but doesnt cut the electricity. Can you help me? I use Ubuntu 20.04.3 LTS

chili555 avatar
cn flag
Is this managed by Network Manager? `sudo ls /etc/NetworkManager/system-connections` If so, set a static IP in NM.
Luis Flores Ferri avatar
gi flag
Is not about set a static IP is about change the SIM IP, the external IP no the networmanager IP, I got it thanky for the fast answer.
Score:0
gi flag

I got it, with bind and unbind the USB the electricity doesnt cut, but the external IP changes, sudo echo 'bus-port' > /sys/bus/usb/drivers/usb/unbind sudo echo 'bus-port' > /sys/bus/usb/drivers/usb/bind

With this it changes the IP ^^ . Thank you all.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.