使用BeagleBone Black内核> = 3.8来关闭/打开USB电源 [英] Turn USB power off/on with BeagleBone Black kernel >= 3.8
问题描述
我需要:
- 关闭->睡眠几秒钟->打开beaglebone black的USB电源
能够通过硬件重置连接到USB的设备(华为E220调制解调器)
to be able to hardware-reset a device that is connected to USB (Huawei E220 Modem)
已经尝试过软重置(使用unbind/bind并使用授权0/1),但是软件重置不足以使设备再次正常工作;该设备存在一些奇怪的错误,该错误是由长时间使用(连接几天后)触发的.
Already tried soft-reset (with unbind/bind and with authorize 0/1), but software reset is not enough to make the device to work well again; the device has some weird bug, that is triggered by a long-time usage (after a few days connected).
使用/sys/debug/omap_mux找到了许多答案,但是该设备在新内核中已不存在.
Many answers were found using /sys/debug/omap_mux, but this device does not exist anymore in new kernels.
由于这个问题花了两天时间才能得到可行的答案,所以我决定将其与答案一起发布在这里,因此对其他人可能有用.
Since this question took a pair of days to get a workable answer, I decided to post it here, with the answer, so it may be useful for others.
推荐答案
感谢我的朋友Cleiton Bueno http://cleitonbueno.wordpress.com/为我找到了解决方案:
Thanks to my friend Cleiton Bueno http://cleitonbueno.wordpress.com/ that found this solution for me:
先决条件:
- apt-get install devmem2
解决问题的代码:
devmem2 0x47401c60 b 0x00
sleep 1
echo "usb1" > /sys/bus/usb/drivers/usb/unbind
sleep 20
echo "usb1" > /sys/bus/usb/drivers/usb/bind
sleep 1
devmem2 0x47401c60 b 0x01
"devmem2"命令负责直接访问beaglebone的GPIO3_13,它控制用于打开/关闭USB端口的IC.
The "devmem2" command is responsible to direct access GPIO3_13 of the beaglebone, that controls the IC that powers on/off the USB port.
"unbind/bind"命令负责告诉USB驱动程序在通电后重新扫描"端口.
The "unbind/bind" commands are responsible to tell the usb driver to "rescan" the port after the power.
这篇关于使用BeagleBone Black内核> = 3.8来关闭/打开USB电源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!