zoukankan      html  css  js  c++  java
  • Configfs使用

    Requirements
    In order for this to work configfs must be available, so CONFIGFS_FS must be
    ‘y’ or ‘m’ in .config. As of this writing USB_LIBCOMPOSITE selects CONFIGFS_FS.
    CONFIG_FS:
    (1)modprobe libcomposite 
    (2)mount none $CONFIGFS_HOME -t configfs
    (3)创建gadgets
      mkdir $CONFIGS_HOME_/usb_gadget/g1 
      cd $CONFIGFS_HOME/usb_gadget/g1
      echo > idVendor
      echo > idProduct 
      mkdir strings/0x409
      echo > strings/0x409/serialnumber
      echo > strings/0x409/manufacturer 
      echo > strings/0x409/product 
    (4)创建配置
    	mkdir configs/
    	mkdir configs/c.1   // where can be any string which is legal in a filesystem and the
    	is the configuration’s number, e.g.
    	mkdir configs/c.1/strings/0x409 //Each configuration also needs its strings, so a subdirectory must be created
    	for each language, e.g.:
    	mkdir configs/c.1/strings/0x409
    	echo > configs/c.1/strings/0x409/configuration
    	echo 120 > configs/c.1/MaxPower
    (5)创建functions 
    	mkdir functions/. 
    	where corresponds to one of allowed function names and instance name
    is an arbitrary string allowed in a filesystem, e.g.:
    mkdir functions/ncm.usb0 # usb_f_ncm.ko gets loaded with request_module()
        一些attributes 
    (6)functions assonciating the configrations 
    	ln -s functions/ncm.usb0 configs/c.1
    (7) 使能gadget 
    	./configs/c.1/ncm.usb0 -> ../../../../usb_gadget/g1/functions/ncm.usb0
    	Such a gadget must be finally enabled so that the USB host can enumerate it.
    In order to enable the gadget it must be bound to a UDC (USB Device Controller).
        ls /sys/class/udc/*
    	echo s3c-hsotg > UDC
    (8) 禁止the gadget 
        echo “” > UDC
    (9)清除配置
    	rm configfs/c.1/ncm.usb0 
    	rmdir configs/./strings/  
    	rmdir configs/. 
    	rmdir functions/. 
    	rmdir strings/  
    	rmdir g1  
    // 
    gadget有它的config组,它有一些属性(idVendor,idProduct等)和默认子组(配置、函数、字符串)。
    写入属性会导致信息存储在适当的位置。在配置、函数和字符串子组中
    用户可以创建子组来表示配置、功能,
    以及给定语言中的字符串组。
    用户在配置中创建配置和功能
    创建指向函数的符号链接。当
    gadget的UDC属性被写入,这意味着绑定gadget
    去UDC。drivers/usb/gadget/configfs.c中的代码进行迭代
    所有的配置,并且在每个配置中迭代所有
    函数并绑定它们。这样整个小工具就被绑定了
    小工具的配置组
    小工具的默认组(配置、函数、字符串)
    将函数与配置相关联(符号链接)
    每个USB功能都有自己的想法
    已配置,因此定义了特定函数的配置组
    在函数实现文件drivers/usb/gadget/f*.c中。
    函数的代码的编写方式如下:
    usb_get_function_instance(),它反过来调用request_模块。因此,
    只要modprobe正常工作,特定函数的模块就会自动加载。请注意,反之亦然:
    当一个小工具被禁用并被拆除后,模块仍然被加载。
    
    
    What:		/config/usb-gadget/gadget/functions/uvc.name/control/header/name
    Date:		Dec 2014
    KernelVersion:	3.20
    Description:	Specific control header descriptors  // control value 的header 
    
    
    
    
    
    
    
      
    

      

    一勤天下无难事。
  • 相关阅读:
    天地图专题六:复杂操作,天地图上标注点的连线以及模拟点击事件
    天地图专题五:在天地图上绘制电子区域并保存数据
    天地图专题四:在天地图上显示运行轨迹
    天地图专题三:根据标注点的范围确定天地图的中心点和缩放级别
    天地图专题二:在天地图上循环显示标注点以及悬停显示信息窗口
    天地图专题一:加载天地图
    从百度地图批量获取中国县级以上行政区划边界坐标
    【百度地图API】如何获取行政区域的边界? (转载)
    高德地图api之location定位
    url中的空格
  • 原文地址:https://www.cnblogs.com/nowroot/p/14105828.html
Copyright © 2011-2022 走看看