现代电子技术2025,Vol.48Issue(2) :46-50.DOI:10.16652/j.issn.1004-373x.2025.02.008

Gadget Configfs的研究及在USB虚拟串口的应用

Research on Gadget Configfs and its application in USB virtual serial port

张怡 鲍爱达 郭鑫 刘昕沂
现代电子技术2025,Vol.48Issue(2) :46-50.DOI:10.16652/j.issn.1004-373x.2025.02.008

Gadget Configfs的研究及在USB虚拟串口的应用

Research on Gadget Configfs and its application in USB virtual serial port

张怡 1鲍爱达 1郭鑫 2刘昕沂1
扫码查看

作者信息

  • 1. 中北大学 仪器与电子学院,山西 太原 030051
  • 2. 中北大学 信息与通信工程学院,山西 太原 030051
  • 折叠

摘要

针对Linux下通过USB Gadget框架将USB接口模拟成其他USB设备时存在设备配置信息修改不方便的问题,可以使用Configfs动态配置USB设备.文中介绍了USB Gadget的框架与原理,重点分析了Configfs的主要数据结构和内部实现机制,给出了使用Configfs在用户模式配置USB设备的具体方法,并在I.MX6ULL平台上将Gadget功能驱动层已有的串口功能驱动程序使用Configfs进行配置后,实现了将USB接口虚拟成USB串口设备.经过测试,虚拟串口设备传输正常,为开发人员在USB Gadget下使用Configfs配置USB设备提供了参考.

Abstract

In allusion to the problem of inconvenient modification of device configuration information when simulating USB interfaces to other USB devices by means of the USB Gadget framework under Linux,Configfs can be used to configure USB devices dynamically.The framework and principle of USB Gadget is introduced,and the main data structure and internal mechanism of Configfs is analyzed stressly.A specific method for configuring USB devices in user mode using Configfs is provided.After configuring the existing serial port function driver program of the Gadget function driver layer on the I.MX6ULL platform using Configfs,the USB interface was virtualized into a USB serial port device.The testing results show that the virtual serial device transmission is normal,providing a reference for developers to configure USB devices using Configfs under USB Gadget.

关键词

虚拟串口/USB/Gadget/Configfs/Linux/串口设备/I.MX6ULL

Key words

virtual serial port/USB Gadget/Configfs/Linux/serial port device/I.MX6ULL

引用本文复制引用

出版年

2025
现代电子技术
陕西电子杂志社

现代电子技术

北大核心
影响因子:0.417
ISSN:1004-373X
段落导航相关论文