您尚未登录。

楼主 #1 2021-02-19 17:35:47

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

主线Linux用shell命令切换 OTG(分享)tiny200/licheepi nano|zero均可以使用

dts配置:

&usb_otg {
        dr_mode = "otg"; /* 三个可选项: otg / host / peripheral */
        status = "okay";
};
##切换到host模式:
# echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
# [  117.758152] phy phy-1c13400.phy.0: Changing dr_mode to 1
[  118.414817] usb 1-1: new high-speed USB device number 3 using musb-hdrc
[  118.598193] usb-storage 1-1:1.0: USB Mass Storage device detected
[  118.611789] scsi host0: usb-storage 1-1:1.0
[  119.686198] scsi 0:0:0:0: Direct-Access     Mass     Storage Device   1.00 PQ: 0 ANSI: 0 CCS
[  119.703976] sd 0:0:0:0: [sda] 3842048 512-byte logical blocks: (1.97 GB/1.83 GiB)
[  119.725260] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  119.739844] sd 0:0:0:0: [sda] Write Protect is off
[  119.771819] sd 0:0:0:0: [sda] No Caching mode page found
[  119.777288] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  119.801571]  sda: sda1 sda2 sda3
[  119.817224] sd 0:0:0:0: [sda] Attached SCSI removable disk

#
##切换到device模式:
# echo peripheral > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
[  123.880272] phy phy-1c13400.phy.0: Changing dr_mode to 2
# [  123.890905] usb 1-1: USB disconnect, device number 3

最近编辑记录 raspberryman (2021-02-19 17:39:26)

离线

楼主 #2 2021-02-19 17:36:18

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

Re: 主线Linux用shell命令切换 OTG(分享)tiny200/licheepi nano|zero均可以使用

占坑

离线

楼主 #3 2021-02-19 17:38:55

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

Re: 主线Linux用shell命令切换 OTG(分享)tiny200/licheepi nano|zero均可以使用

占坑

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn