关于配置android configfs gadgets的补充说明

    了解了怎样配置android configfs gadgets,是不是我们就可以直接照搬到我们的平台就直接可以用了呢,显然是可以的,但是有些需要注意的地方,不然还是有问题的,这个在原文中,也提醒说明了哪些注意的地方,但是我们还是单独拿出来说明下:


stop adbd
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/c.1/ffs.adb
start adbd
#Had to set this property early because userspace expect us to be done with state changes in 1 second.
setprop sys.usb.state ${sys.usb.config}
#Add this 2 second wait/delay to calm things down after adbd restart and before we enable UDC.
wait /dev/socket/waiting
#Replace "ci_hdrc.0" with your platform UDC driver as found in /sys/class/udc/
write /config/usb_gadget/g1/UDC ci_hdrc.0

1.提前设置sys.usb.state

#Had to set this property early because userspace expect us to be done with state changes in 1 second.
setprop sys.usb.state ${sys.usb.config}

用户空间期望能在1s内设置state完成

2.延时2秒时间

#Add this 2 second wait/delay to calm things down after adbd restart and before we enable UDC.
wait /dev/socket/waiting

能够在restart adbd之后,enable UDC之前,延时2s。

3.替换ci_hdrc.0值

#Replace "ci_hdrc.0" with your platform UDC driver as found in /sys/class/udc/
write /config/usb_gadget/g1/UDC ci_hdrc.0

这个是跟具体的usb硬件配置相关,我们必须根据具有的板配置,我们可以查看/sys/class/udc/

eg:
# busybox ls /sys/class/udc/                                                   
ff400000.dwc2_a

则我们需要把有 ci_hdrc.0出现的地方,都替换为ff400000.dwc2_a, 如果是在android系统,可以使用${sys.usb.controller}代替。
# getprop sys.usb.controller                                    
ff400000.dwc2_a

你可能感兴趣的:(linux模块移植,android)