Deattach usb device

Hello Guys!
I have a TL-WR902ACv4 router with OpenWRT 23.05.4 installed

I need to reconnect programmatically usb modem. I found a solution using udisks (udisks --deattach), but usdisks is not presented in OpenWRT. Is there some another solution to do it?

There is uhubctl

Thanks! But there is another problem.
It says that my device status is power off, i cant connect to its panel, but LED on modem still working and when I turn it on again my ip dont change.
Have you any ideas?

Does running uhubctl promise power control?
Does modem go dark when power is removed?
What modem?

uhubctl
uhubctl -a0
uhubctl
lsusb
uhubctl -a1
uhubctl
lsusb
  • Device Name: Yota Modem
  • FW version: D07C_Yota_V048

No, LED on modem is still working



root@OpenWrt:~# uhubctl
Current status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1376:4e61 Marvell Mobile Composite Device Bus Mobile Composite Device Bus]
root@OpenWrt:~# uhubctl -a 0 -l 1
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1376:4e61 Marvell Mobile Composite Device Bus Mobile Composite Device Bus]
Sent power off request
New status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0000 off
root@OpenWrt:~# uhubctl
Current status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0000 off
root@OpenWrt:~# lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller
Bus 001 Device 013: ID 1376:4e61 Marvell Mobile Composite Device Bus
Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller
root@OpenWrt:~# uhubctl -a 1 -l 1
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0000 off
Sent power on request
New status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1376:4e61]
root@OpenWrt:~# uhubctl
Current status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1376:4e61 Marvell Mobile Composite Device Bus Mobile Composite Device Bus]
root@OpenWrt:~# lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller
Bus 001 Device 014: ID 1376:4e61 Marvell Mobile Composite Device Bus
Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller

Seriously? You flip exactly other port.

I have a single physical usb2 port that i need to flip, hub2 is usb1.1
Anyway when I run uhubctl -a 0 -l 2 i get:

root@OpenWrt:~# uhubctl -a 0 -l 2
Current status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power
Sent power off request
New status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power

And my modem's control panel still working. So -l 1 is correct

I asked to do all at once.
Could happen power bit is fake and usb is fed from psu directly.

root@OpenWrt:~# uhubctl -a 0
Error: changing port state for multiple hubs at once is not supported.
Use -l to limit operation to one hub!
1 Like

Get all off and check if reconnecting device inficates it ispowered.

I can get all off only one by one. And hub2 is still powered according uhubctl output:

root@OpenWrt:~# uhubctl -a 0 -l 1
Current status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1376:4e61 Marvell Mobile Composite Device Bus Mobile Composite Device Bus]
Sent power off request
New status for hub 1 [1d6b:0002 Linux 5.15.162 ehci_hcd EHCI Host Controller 101c0000.ehci, USB 2.00, 1 ports, ppps]
  Port 1: 0000 off
root@OpenWrt:~# uhubctl -a 0 -l 2
Current status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power
Sent power off request
New status for hub 2 [1d6b:0001 Linux 5.15.162 ohci_hcd Generic Platform OHCI controller 101c1000.ohci, USB 1.10, 1 ports, ppps]
  Port 1: 0100 power

After that if I physically unplug and plug my modem, LED on it turns on again

Turns out power bits are fake...

If present may help:
/sys/bus/usb/devices/*/reset
(i think this is what udisk does)
/sys/bus/usb/devices/*/authorized

There is something wrong with your modem. They work years unattended