- USB0 驱动是否加载
a,USB0 host
cat /sys/devices/platform/soc/usbc0/usb_host
b,USB0 device
cat /sys/devices/platform/soc/usbc0/usb_device
c,获取USB0当前角色
cat /sys/devices/platform/soc/usbc0/otg_role
- USB1驱动加载
a,加载
echo 1 > /sys/devices/platform/soc/5200000.ehci1-controller/ehci_enable
echo 1 > /sys/devices/platform/soc/5200000.ohci1-controller/ohci_enable
b,卸载
echo 0 > /sys/devices/platform/soc/5200000.ehci1-controller/ehci_enable
echo 0 > /sys/devices/platform/soc/5200000.ohci1-controller/ohci_enable
-
USB做mass storage
dd if=/dev/zero of=/dev/a.bin bs=1M count=100
mount -t configfs none /sys/kernel/config
mkdir /sys/kernel/config/usb_gadget/g1
echo “0x18d1” > /sys/kernel/config/usb_gadget/g1/idVendor
echo “0x0001” > /sys/kernel/config/usb_gadget/g1/idProduct
mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409
mkdir /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0
echo /dev/a.bin > /sys/kernel/config/usb_gadget/g1/functions/mass_sto
rage.usb0/lun.0/file
mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1
echo 0xc0 > /sys/kernel/config/usb_gadget/g1/configs/c.1/bmAttributes
echo 500 > /sys/kernel/config/usb_gadget/g1/configs/c.1/MaxPower
mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409
ln -s /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0/ /sys/kernel/config/usb_gadget/g1/configs/c.1/
ls /sys/class/udc/ |xargs echo > /sys/kernel/config/usb_gadget/g1/UDC -
USB做CDROM