最終更新:2023-04-24 (月) 12:21:13 (383d)
Linux/USBガジェット/configfs
configfsを使ってLinux USBガジェットを設定するAPI
概要
- A userspace API for creation of arbitrary USB composite devices using reusable kernel gadget function drivers.
- Supports all major existing gadget functions except FunctionFS and mass storage in Linux 3.11
- Linux 3.13 added conversion of FunctionFS and mass storage
- CONFIG_USB_CONFIGFS
ドキュメント
- kernel.org/doc/Documentation/usb/gadget_configfs.txt
- kernel.org/doc/Documentation/usb/gadget_configfs.rst
- https://www.kernel.org/doc/html/latest/usb/gadget_configfs.html
資料
- USB gadget composed with configfs
- Kernel USB Gadget Configfs Interface
- Make your own USB gadget
- USB and the Real World
- Tame the USB gadgets talkative beast
- Modern USB Gadget with Custom USB Functions...
ABI
依存
フィールドの定義
ディレクトリ構造
例
modprobe libcomposite mount none cfg -t configfs mkdir cfg/usb_gadget/g1 cd cfg/usb_gadget/g1 #デバイスの設定 echo "0x05e8" > idVendor echo "0xa4a1" > idProduct ... #ファンクションの設定 mkdir functions/acm.GS0 mkdir functions/acm.GS1 mkdir functions/ecm.usb0 #コンフィグレーションの設定 ...
有効化
$ echo <udc name> > UDC
無効化
$ echo "" > UDC
Linux/USBガジェット/ファンクション
作成
mkdir functions/acm.GS0 mkdir functions/acm.GS1 mkdir functions/ecm.usb0
一覧
- DECLARE_USB_FUNCTION_INIT
name gser CONFIG_USB_CONFIGFS_SERIAL Linux 3.11 acm CONFIG_USB_CONFIGFS_ACM? Linux 3.11 obex CONFIG_USB_CONFIGFS_OBEX? ncm CONFIG_USB_CONFIGFS_NCM? ecm CONFIG_USB_CONFIGFS_ECM? geth CONFIG_USB_CONFIGFS_ECM_SUBSET? rndis CONFIG_USB_CONFIGFS_RNDIS? Linux 3.11 eem CONFIG_USB_CONFIGFS_EEM? mass_storage CONFIG_USB_CONFIGFS_MASS_STORAGE Linux 3.13 CONFIG_USB_CONFIGFS_F_LB_SS? Linux 3.14 ffs CONFIG_USB_CONFIGFS_F_FS Linux 3.14 uac1 CONFIG_USB_CONFIGFS_F_UAC1 Linux 3.19 uac1_legacy CONFIG_USB_CONFIGFS_F_UAC1_LEGACY Linux 4.13 uac2 CONFIG_USB_CONFIGFS_F_UAC2? Linux 3.19 midi CONFIG_USB_CONFIGFS_F_MIDI? Linux 3.19 hid CONFIG_USB_CONFIGFS_F_HID Linux 3.19 uvc CONFIG_USB_CONFIGFS_F_UVC? Linux 4.0 printer CONFIG_USB_CONFIGFS_F_PRINTER? Linux 4.1 phonet
ソースコード
ライブラリ
- gadgetd?
FunctionFS
- delegate function implementation to userspace.
- configfs:usb_gadget/gadget/functionffs/ffs.ptp
実装に使ってる構造体
config_item_type? config_item? ディレクトリ config_group? ディレクトリ configfs_item_operations configfs_attribute? ファイル
- usb_function_instance?
実装に使ってる関数
- usb_os_desc_prepare_interf_dir?