USB - 通过configfs配置Linux USB Gadget

本文详细介绍了如何在Linux中使用configfs来配置USBgadget,包括创建gadget、配置功能、指定接口和设置属性,以及如何与USBHost交互并实现动态功能管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux USB gadget configured through configfs

Overview

USB Linux 小工具是一种具有 UDC(USB 设备控制器)的设备,可连接到 USB 主机,以扩展其附加功能,如串行端口或大容量存储功能。

A USB Linux Gadget is a device which has a UDC (USB Device Controller) and can be connected to a USB Host to extend it with additional functions like a serial port or a mass storage capability.

主机将gadget视为一组配置,每个配置都包含若干接口,从gadget的角度看,这些接口被称为功能,每个功能代表一个串行连接或 SCSI 磁盘等。

A gadget is seen by its host as a set of configurations, each of which contains a number of interfaces which, from the gadget's perspective, are known as functions, each function representing e.g. a serial connection or a SCSI disk.

Linux 为gadget提供了许多功能。

Linux provides a number of functions for gadgets to use.

创建gadget意味着要决定有哪些配置,以及每个配置将提供哪些功能。

Creating a gadget means deciding what configurations there will be and which functions each configuration will provide.

Configfs(请参阅 Configfs - 用户空间驱动的内核对象配置)可以很好地将上述决定告知内核。本文档将介绍如何做到这一点。 (Configfs - Userspace-driven Kernel Object Configuration — The Linux Kernel documentation)

Configfs (please see Configfs - Userspace-driven Kernel Object Configuration) lends itself nicely for the purpose of telling the kernel about the above mentioned decision. This document is about how to do it.

Configfs(请参阅 Configfs - 用户空间驱动的内核对象配置)可以很好地将上述决定告知内核。本文档将介绍如何做到这一点。

本文还将介绍如何将 configfs 集成到gadget中。

It also describes how configfs integration into gadget is designed.

Requirements

为使其正常工作,configfs 必须可用,因此 .config 中的 CONFIGFS_FS 必须为 "y "或 "m"。目前,USB_LIBCOMPOSITE 选择 CONFIGFS_FS。

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 CONF

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值