很多linux嵌入式系统都有USB接口,那么如何使用USB接口呢?
首先,linux的底层驱动要支持,在linux kernal目录下可以找到对应的dts文件,(device tree)
usb0: usb@ee520000{compatible = "myusb,musb";status = "disabled";reg = <0xEE520000 0x1000 /* usb0 base address */0xEEF90000 0x1000>; /* ahb sys base address */reg-names = "system", "control";/* <usb0 int>, <usb0_dma_int> */dr_mode = "otg";multipoint = <1>;...
};
其次,使用时需要设置usb的模式,比如设置为otg模式,在Qt下执行指令:
echo otg > /sys/devices/platform/soc/ee520000.usb/musb-hdrc.0/mode