主线Linux用shell命令切换 OTG

&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

你可能感兴趣的:(Linux驱动,全志s3,linux,运维,服务器)