Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How can I turn off the power of a USB port?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
crocket
Apprentice
Apprentice


Joined: 29 Apr 2017
Posts: 208

PostPosted: Tue Mar 26, 2019 9:31 am    Post subject: How can I turn off the power of a USB port? Reply with quote

I have a USB microphone that I want to remain turned off most of the time.
Can linux turn a USB port on and off?
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21765
Location: here

PostPosted: Tue Mar 26, 2019 1:15 pm    Post subject: Reply with quote

You can try with
Code:
# echo 0 > /sys/bus/usb/devices/7-1/power/autosuspend_delay_ms
# echo auto > /sys/bus/usb/devices/7-1/power/control
# echo 7-1 > /sys/bus/usb/drivers/usb/unbind

how 7-1 is <bus>.<port>.<port> then you can check with lsusb -t (also with dmesg usb-storage 7-1:1.0: USB Mass Storage device detected)
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
crocket
Apprentice
Apprentice


Joined: 29 Apr 2017
Posts: 208

PostPosted: Tue Mar 26, 2019 2:48 pm    Post subject: Reply with quote

fedeliallalinea wrote:
You can try with
Code:
# echo 0 > /sys/bus/usb/devices/7-1/power/autosuspend_delay_ms
# echo auto > /sys/bus/usb/devices/7-1/power/control
# echo 7-1 > /sys/bus/usb/drivers/usb/unbind

how 7-1 is <bus>.<port>.<port> then you can check with lsusb -t (also with dmesg usb-storage 7-1:1.0: USB Mass Storage device detected)


I figured out that a USB hub must support per-port power switching. My desktop computer's internal USB hubs don't support it. Raspberry Pi 3 B+ supports per-port power switching in all its USB ports.
I can use uhubctl to turn on and off USB ports.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum