How to turning OFF and ON power to USB port in jetson nano

Hi! I’m using Huawei 4G dongle in jetson nano. Due to bad network signal, my dongle state changed to “no network available”, then unplug and plug it back my dongle works back to a normal state.

dmesg when physically plugged out usb

[Wed Apr 22 23:00:47 2020] usb 1-2.2: USB disconnect, device number 6
[Wed Apr 22 23:00:47 2020] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[Wed Apr 22 23:00:47 2020] option 1-2.2:1.0: device disconnected
[Wed Apr 22 23:00:47 2020] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[Wed Apr 22 23:00:47 2020] option 1-2.2:1.1: device disconnected
[Wed Apr 22 23:00:47 2020] option 1-2.2:1.2: device disconnected
So, can you suggest me a solution to cut off power to a USB port without touching hardware physically?

dmesg when physically plugged in usb

[Wed Apr 22 23:02:05 2020] usb 1-2.2: new high-speed USB device number 7 using tegra-xusb
[Wed Apr 22 23:02:05 2020] usb 1-2.2: New USB device found, idVendor=12d1, idProduct=14fe
[Wed Apr 22 23:02:05 2020] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Wed Apr 22 23:02:05 2020] usb 1-2.2: Product: HUAWEI_MOBILE
[Wed Apr 22 23:02:05 2020] usb 1-2.2: Manufacturer: HUAWEI_MOBILE
[Wed Apr 22 23:02:05 2020] usb 1-2.2: SerialNumber: 0123456789ABCDEF
[Wed Apr 22 23:02:05 2020] usb-storage 1-2.2:1.0: USB Mass Storage device detected
[Wed Apr 22 23:02:05 2020] scsi host0: usb-storage 1-2.2:1.0
[Wed Apr 22 23:02:06 2020] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:02:06 2020] scsi 0:0:0:1: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:02:06 2020] sd 0:0:0:1: [sda] Attached SCSI removable disk
[Wed Apr 22 23:02:06 2020] usb 1-2.2: USB disconnect, device number 7
[Wed Apr 22 23:02:07 2020] usb 1-2.2: new high-speed USB device number 8 using tegra-xusb
[Wed Apr 22 23:02:07 2020] usb 1-2.2: New USB device found, idVendor=12d1, idProduct=1506
[Wed Apr 22 23:02:07 2020] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Wed Apr 22 23:02:07 2020] usb 1-2.2: Product: HUAWEI_MOBILE
[Wed Apr 22 23:02:07 2020] usb 1-2.2: Manufacturer: HUAWEI_MOBILE
[Wed Apr 22 23:02:07 2020] option 1-2.2:1.0: GSM modem (1-port) converter detected
[Wed Apr 22 23:02:07 2020] usb 1-2.2: GSM modem (1-port) converter now attached to ttyUSB0
[Wed Apr 22 23:02:07 2020] option 1-2.2:1.1: GSM modem (1-port) converter detected
[Wed Apr 22 23:02:07 2020] usb 1-2.2: GSM modem (1-port) converter now attached to ttyUSB1
[Wed Apr 22 23:02:07 2020] option 1-2.2:1.2: GSM modem (1-port) converter detected
[Wed Apr 22 23:02:07 2020] usb-storage 1-2.2:1.3: USB Mass Storage device detected
[Wed Apr 22 23:02:07 2020] scsi host0: usb-storage 1-2.2:1.3
[Wed Apr 22 23:02:07 2020] usb-storage 1-2.2:1.4: USB Mass Storage device detected
[Wed Apr 22 23:02:07 2020] scsi host1: usb-storage 1-2.2:1.4
[Wed Apr 22 23:02:08 2020] scsi 1:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:02:08 2020] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:02:08 2020] sd 1:0:0:0: [sda] Attached SCSI removable disk

Also i tried using bind and unbind option from some suggestions of other forums.
But which has dmesg output different from physical unplug device dmesg.

dmesg when using unbind usb

[Wed Apr 22 23:09:34 2020] option1 ttyUSB0: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[Wed Apr 22 23:09:35 2020] option1 ttyUSB0: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[Wed Apr 22 23:09:35 2020] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[Wed Apr 22 23:09:35 2020] option 1-2.2:1.0: device disconnected
[Wed Apr 22 23:09:35 2020] option1 ttyUSB1: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[Wed Apr 22 23:09:35 2020] option1 ttyUSB1: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[Wed Apr 22 23:09:35 2020] option1 ttyUSB1: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[Wed Apr 22 23:09:35 2020] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[Wed Apr 22 23:09:35 2020] option 1-2.2:1.1: device disconnected
[Wed Apr 22 23:09:35 2020] option 1-2.2:1.2: device disconnected

dmesg when using bind usb

[Wed Apr 22 23:10:23 2020] option 1-2.2:1.0: GSM modem (1-port) converter detected
[Wed Apr 22 23:10:23 2020] usb 1-2.2: GSM modem (1-port) converter now attached to ttyUSB0
[Wed Apr 22 23:10:23 2020] option 1-2.2:1.1: GSM modem (1-port) converter detected
[Wed Apr 22 23:10:23 2020] usb 1-2.2: GSM modem (1-port) converter now attached to ttyUSB1
[Wed Apr 22 23:10:23 2020] option 1-2.2:1.2: GSM modem (1-port) converter detected
[Wed Apr 22 23:10:23 2020] usb-storage 1-2.2:1.3: USB Mass Storage device detected
[Wed Apr 22 23:10:23 2020] scsi host0: usb-storage 1-2.2:1.3
[Wed Apr 22 23:10:23 2020] usb-storage 1-2.2:1.4: USB Mass Storage device detected
[Wed Apr 22 23:10:23 2020] scsi host1: usb-storage 1-2.2:1.4
[Wed Apr 22 23:10:24 2020] scsi 1:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:10:24 2020] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[Wed Apr 22 23:10:24 2020] sd 1:0:0:0: [sda] Attached SCSI removable disk

Because of this my dongle does not recognise the network again.
So, can you suggest me a solution to cut off power to a USB port without touching hardware physically?

Hi,
Please check
https://elinux.org/L4T_Jetson/r32.3.x_patch
[Jetson Nano]Power control

You can power-cycle the USB ports by executing the application.