USB Gadget
+ -

USB Gadget-Source/Sink驱动

2025-09-11 0 0

关于同步传输的示例在f_sourcesink.c中。其编译后依旧位于usb_f_ss_lb.ko中

应用可以通过如下代码来创建设备

root@ATK-IMX6U:/lib/modules/4.1.15# cat fs_lc.sh 
#!/bin/bash
modprobe libcomposite
modprobe usb_f_ss_lb
mount -t configfs none /sys/kernel/config

mkdir -p /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1

echo "0x1d6b" > idVendor
echo "0x2d01" > idProduct
echo "0x200"  > bcdUSB

mkdir configs/c.1
#mkdir configs/c.2

mkdir strings/0x409
mkdir configs/c.1/strings/0x409

echo "0123456789" > strings/0x409/serialnumber
echo "usbzh.com" > strings/0x409/manufacturer
echo "USBZH Gadget" > strings/0x409/product

echo "Conf 1" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower

mkdir functions/SourceSink.0
#mkdir functions/Loopback.0

#ln -s functions/Loopback.0 configs/c.2
ln -s functions/SourceSink.0 configs/c.1

# Enable the gadget
udc=$(ls /sys/class/udc/)
echo "$udc" > UDC

创建的设备有1个接口描述符

  • 接口0-alt0
    • bulk端点in-0x81
    • bulk端点out-0x01
  • 接口0-alt1
    • bulk端点in-0x81
    • bulk端点out-0x01
    • 同步端点in-0x82
    • 同步端点out-0x02
      故选择接品alt1时,可以使用同步端点。

其usb描述符信息如下:

=========================== USB Port3 ===========================

Connection Status        : 0x01 (Device is connected)
Port Chain               : 2-3
Properties               : 0x00
 IsUserConnectable       : no
 PortIsDebugCapable      : no
 PortHasMultiCompanions  : no
 PortConnectorIsTypeC    : no
ConnectionIndex          : 0x03 (Port 3)

      ========================== Summary =========================
Vendor ID                : 0x1D6B (The Linux Foundation)
Product ID               : 0x2D01
Manufacturer String      : The Linux Foundation
Product String           : USBZH Gadget
Serial                   : 0123456789
USB Version              : 2.0
Port maximum Speed       : High-Speed
Device maximum Speed     : High-Speed
Device Connection Speed  : High-Speed
Self powered             : no
Demanded Current         : 120 mA
Used Endpoints           : 3

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Friendly Name            : USBZH Gadget
Device Description       : USBZH Gadget
Device Path 1            : \\?\USB#VID_1D6B&PID_2D01#0123456789#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Device Path 2            : \\?\USB#VID_1D6B&PID_2D01#0123456789#{95ea06b3-7817-4897-8e39-5875cf494374}
Device Path 3            : \\?\USB#VID_1D6B&PID_2D01#0123456789#{dee824ef-729b-4a0e-9c14-b7117d33a817} (GUID_DEVINTERFACE_WINUSB)
Kernel Name              : \Device\USBPDO-8
Device ID                : USB\VID_1D6B&PID_2D01\0123456789
Hardware IDs             : USB\VID_1D6B&PID_2D01&REV_0401 USB\VID_1D6B&PID_2D01
Driver KeyName           : {88bae032-5a81-49f0-bc3d-a4ff138216d6}\0013 (GUID_DEVCLASS_USBDEVICE)
Driver                   : \SystemRoot\System32\drivers\WinUsb.sys (Version: 10.0.18362.1  Date: 2019-03-19  Company: Microsoft Corporation)
Driver Inf               : C:\Windows\inf\oem99.inf
Legacy BusType           : PNPBus
Class                    : USBDevice
Class GUID               : {88bae032-5a81-49f0-bc3d-a4ff138216d6} (GUID_DEVCLASS_USBDEVICE)
Service                  : WinUSB
Enumerator               : USB
Location Info            : Port_#0003.Hub_#0001
Address                  : 3
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(3), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS03)
Container ID             : {0be54a71-2522-59e9-85e7-a7f773826dc9}
Manufacturer Info        : Linux Foundation
Capabilities             : 0x14 (Removable, UniqueID)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
EnhancedPowerMgmtEnabled : 0
Power State              : D0 (supported: D0, D3, wake from D0)

        +++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\1D6B2D010401
 osvc                    : REG_BINARY 00 00

        ---------------- Connection Information ---------------
Connection Index         : 0x03 (Port 3)
Connection Status        : 0x01 (DeviceConnected)
Current Config Value     : 0x01 (Configuration 1)
Device Address           : 0x31 (49)
Is Hub                   : 0x00 (no)
Device Bus Speed         : 0x02 (High-Speed)
Number of open Pipes     : 0x02 (2 pipes to data endpoints)
Pipe[0]                  : EndpointID=1  Direction=IN   ScheduleOffset=0  Type=Bulk  wMaxPacketSize=0x200   bInterval=0  
Pipe[1]                  : EndpointID=1  Direction=OUT  ScheduleOffset=0  Type=Bulk  wMaxPacketSize=0x200   bInterval=0  
Data (HexDump)           : 03 00 00 00 12 01 00 02 00 00 00 40 6B 1D 01 2D   ...........@k..-
                           01 04 01 02 03 01 01 02 00 31 00 02 00 00 00 01   .........1......
                           00 00 00 07 05 81 02 00 02 00 00 00 00 00 07 05   ................
                           01 02 00 02 00 00 00 00 00                        .........

        --------------- Connection Information V2 -------------
Connection Index         : 0x03 (3)
Length                   : 0x10 (16 bytes)
SupportedUsbProtocols    : 0x03
 Usb110                  : 1 (yes, port supports USB 1.1)
 Usb200                  : 1 (yes, port supports USB 2.0)
 Usb300                  : 0 (no, port not supports USB 3.0)
 ReservedMBZ             : 0x00
Flags                    : 0x00
 DevIsOpAtSsOrHigher     : 0 (Device is not operating at SuperSpeed or higher)
 DevIsSsCapOrHigher      : 0 (Device is not SuperSpeed capable or higher)
 DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
 DevIsSsPlusCapOrHigher  : 0 (Device is not SuperSpeedPlus capable or higher)
 ReservedMBZ             : 0x00
Data (HexDump)           : 03 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00   ................

    ---------------------- Device Descriptor ----------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x200 (USB Version 2.0)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 bytes)
idVendor                 : 0x1D6B (The Linux Foundation)
idProduct                : 0x2D01
bcdDevice                : 0x0401
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "usbzh.com"
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "USBZH Gadget"
iSerialNumber            : 0x03 (String Descriptor 3)
 Language 0x0409         : "0123456789"
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 00 02 00 00 00 40 6B 1D 01 2D 01 04 01 02   .......@k..-....
                           03 01                                             ..

    ------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x0045 (69 bytes)
bNumInterfaces           : 0x01 (1 Interface)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x04 (String Descriptor 4)
 Language 0x0409         : "Conf 1"
bmAttributes             : 0x80
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x00 (no)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x3C (120 mA)
Data (HexDump)           : 09 02 45 00 01 01 04 80 3C 09 04 00 00 02 FF 00   ..E.....<.......
                           00 00 07 05 81 02 00 02 00 07 05 01 02 00 02 00   ................
                           09 04 00 01 04 FF 00 00 00 07 05 81 02 00 02 00   ................
                           07 05 01 02 00 02 00 07 05 82 01 00 04 04 07 05   ................
                           02 01 00 04 04                                    .....

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 00 02 FF 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)
Data (HexDump)           : 07 05 81 02 00 02 00                              .......

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)
Data (HexDump)           : 07 05 01 02 00 02 00                              .......

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x04 (4 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 01 04 FF 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)
Data (HexDump)           : 07 05 81 02 00 02 00                              .......

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)
Data (HexDump)           : 07 05 01 02 00 02 00                              .......

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
bmAttributes             : 0x01 (TransferType=Isochronous  SyncType=None  EndpointType=Data)
wMaxPacketSize           : 0x0400
 Bits 15..13             : 0x00 (reserved, must be zero)
 Bits 12..11             : 0x00 (0 additional transactions per microframe -> allows 1..1024 bytes per packet)
 Bits 10..0              : 0x400 (1024 bytes per packet)
bInterval                : 0x04 (8 microframes -> 1 ms)
Data (HexDump)           : 07 05 82 01 00 04 04                              .......

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x02 (Direction=OUT EndpointID=2)
bmAttributes             : 0x01 (TransferType=Isochronous  SyncType=None  EndpointType=Data)
wMaxPacketSize           : 0x0400
 Bits 15..13             : 0x00 (reserved, must be zero)
 Bits 12..11             : 0x00 (0 additional transactions per microframe -> allows 1..1024 bytes per packet)
 Bits 10..0              : 0x400 (1024 bytes per packet)
bInterval                : 0x04 (8 microframes -> 1 ms)
Data (HexDump)           : 07 05 02 01 00 04 04                              .......

    --------- Device Qualifier Descriptor (for Full-Speed) --------
bLength                  : 0x0A (10 bytes)
bDescriptorType          : 0x06 (Device_qualifier Descriptor)
bcdUSB                   : 0x200 (USB Version 2.0)bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 Bytes)
bNumConfigurations       : 0x01 (1 other-speed configuration)
bReserved                : 0x00
Data (HexDump)           : 0A 06 00 02 00 00 00 40 01 00                     .......@..

    ------------ Other Speed Configuration Descriptor -------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x07 (Other_speed_configuration Descriptor)
wTotalLength             : 0x0045 (69 bytes)
bNumInterfaces           : 0x01 (1 Interface)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x04 (String Descriptor 4)
 Language 0x0409         : "Conf 1"
bmAttributes             : 0x80
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x00 (no)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x3C (120 mA)
Data (HexDump)           : 09 07 45 00 01 01 04 80 3C 09 04 00 00 02 FF 00   ..E.....<.......
                           00 00 07 05 01 02 40 00 00 07 05 81 02 40 00 00   ......@......@..
                           09 04 00 01 04 FF 00 00 00 07 05 01 02 40 00 00   .............@..
                           07 05 81 02 40 00 00 07 05 02 01 FF 03 04 07 05   ....@...........
                           82 01 FF 03 04                                    .....

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 00 02 FF 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 01 02 40 00 00                              ....@..

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 81 02 40 00 00                              ....@..

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x04 (4 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 01 04 FF 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 01 02 40 00 00                              ....@..

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 81 02 40 00 00                              ....@..

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x02 (Direction=OUT EndpointID=2)
bmAttributes             : 0x01 (TransferType=Isochronous  SyncType=None  EndpointType=Data)
wMaxPacketSize           : 0x03FF (1023 bytes)
bInterval                : 0x04 (4 ms)
Data (HexDump)           : 07 05 02 01 FF 03 04                              .......

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
bmAttributes             : 0x01 (TransferType=Isochronous  SyncType=None  EndpointType=Data)
wMaxPacketSize           : 0x03FF (1023 bytes)
bInterval                : 0x04 (4 ms)
Data (HexDump)           : 07 05 82 01 FF 03 04                              .......

      -------------------- String Descriptors -------------------
             ------ String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)
Data (HexDump)           : 04 03 09 04                                       ....
             ------ String Descriptor 1 ------
bLength                  : 0x14 (20 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "usbzh.com"
Data (HexDump)           : 14 03 75 00 73 00 62 00 7A 00 68 00 2E 00 63 00   ..u.s.b.z.h...c.
                           6F 00 6D 00                                       o.m.
             ------ String Descriptor 2 ------
bLength                  : 0x1A (26 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USBZH Gadget"
Data (HexDump)           : 1A 03 55 00 53 00 42 00 5A 00 48 00 20 00 47 00   ..U.S.B.Z.H. .G.
                           61 00 64 00 67 00 65 00 74 00                     a.d.g.e.t.
             ------ String Descriptor 3 ------
bLength                  : 0x16 (22 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "0123456789"
Data (HexDump)           : 16 03 30 00 31 00 32 00 33 00 34 00 35 00 36 00   ..0.1.2.3.4.5.6.
                           37 00 38 00 39 00                                 7.8.9.
             ------ String Descriptor 4 ------
bLength                  : 0x0E (14 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Conf 1"
Data (HexDump)           : 0E 03 43 00 6F 00 6E 00 66 00 20 00 31 00         ..C.o.n.f. .1.

0 篇笔记 写笔记

UVC 等时传输中的URB_ISOCH_TRANSFER
通过UVC规范可知,视频图像数据的读取可使用两种端点传输方式,分别为:BULK 块/批量传输方式ISO 等时/同步传输方式在Windows内核中,USB数据的读取是通过URB来进行传输的,其结构体是一个大大的共用体,根据数据传输的方式对应其不同的结构体,其内容如下:typedef _Struct_s......
UVC等时传输中的dwMaxPayloadTransferSize
UVC的视频流接口控制请求的数据大小可为26字节,34字节和48字节,其分别对应的是UVC的1.0,1,1和UVC1.5版本。在其整个视频流控制接口参数偏移地址22处的字段为一4字节的dwMaxPayloadTransferSize,根据其字段解释为“指定设备在单个有效负载传输中可以传输或接收的最大......
USB 等时/同步传输、块传输与转换设置在UVC摄像头驱动中的探讨
最近在Windows10 x64环境下,开发了一个虚拟UVC摄像头驱动。确切的来说这不是摄像头驱动,而是一个虚拟USB总线驱动。使用该虚拟总线驱动使用应用软件通过IOCTL控制总线子设备的创建与卸载。框架设计驱动安装完成后,是一个单纯的USB虚拟总线。应用软件通过发送自定义IOCTL码IOCTL......
USB 同步/等时传输方式
USB协议规定了四种传输类型:控制传输、批量传输、同步传输、中断传输。等时传输也有“同步传输”的叫法,一般用于要求数据连续、实时且数据量大的场合,其对传输延时十分敏感,类似用于USB摄像设备,USB语音设备等等。同步事务没有握手包。当一个同步传输中有多个事务时,最后一个事务之前的事务的数据长......
USB超高速 同步传输
正如USB2.0一样,超速同步传输类型是用来支持想要能容忍错误,周期性的轮询服务的传输流。超速跟USB2.0一样不发送起始帧,但是时序信息要通过同步时间戳包(ITP)被发送给设备。这个规格的协议层章详细描述了用来完成同步传输的包,总线事务和事务处理流程。也描述了怎么样传送时序信息给设备。超速同步传输......
基于UVC规范的USB摄像头数据传输模式的总结
根据UVC(USB VIDEO CLASS)规范,UVC视频数据传输方式支持:同步传输即ISO传输批量传输即BULK传输但是不同的操作系统对UVC规范的支持不一定是全量支持的:Windows操作系统对于windows操作系统,对UVC版本的支持情况如下:UVC 版本Windows ......
手动分析使用BUSHOUND抓取同步传输的URB
BUSHOUND大家太熟了,使用它来进行数据抓包那不太太方便。但在BUSHOUND的抓取配置项中,有一个叫了URB的东西,我相信大家都没有选中过,因为一般来说,对WINDOWS USB驱动开发人员来说都不一定有用,更何况大家也只是用来抓取一下几个数据的输入输出,更没有必要进行USB的分析了。本人今天......
USB 同步传输端点的数据包PID序列及额外传输端点大小
对于同步传输:如果输入端点提供的负载数据小于端点描述符指定的最大负载数据,则主机端将不再该端点提供进一步的输入事务。这是因为所对USB设备来说,所有的数据传输都是由主机发起的。对于数据输入IN事务,虽然数据的传输方向为设备端到主机,但是该事务却是由主机发起。由于设备的输入端点提供的负载数据小于该......
USB摄像头同步传输的完成后URB参数
这几天不是闲来无事,一个工作的任务就是对手中一个USB摄像头进行驱动开发,并进行视频格式的转换。通过分析该USB摄像头可知,其采用的是同步传输,所以本人在开发的驱动中,使用同步的URB进行下发请求数据,然后在完成例程中获取数据。同步传输的URB本人在 手动分析使用BUSHOUND抓取同步传输的URB......
UAC麦克风同步传输的URB分析
之前写过同步传输的UVC摄像头的URB,文章名称为:手动分析使用BUSHOUND抓取同步传输的URB 。今天恰好手中有一个UVC麦克风,所以也拿来分析。也许和之前的文章有所重复,但是因为侧重点的不同,也许会有意想不到的小收获取。言归正转,我们知道,在UAC音频规范中,数据的传输不像UVC摄像头那样,......
USB摄像头同步传输H264遇到的花屏问题
以往拿到的摄像头数据传输都是批量传输,本人也只在音频驱动的开发中使用了同步传输。这次突然拿到一个摄像头,数据采用的是同步传输,本以为很简单的代码移植,却没有想到还是遇到了一个坑,自己花费了大力气来排查,在这期间自己也看了大量的资料,今天在这里做一个简单的总结。以前的摄像头拿到的USB摄像头如批量传......
USB2.0 同步传输数据包PID序列
同步传输方式分为全速模式和高速模式,低速模式不存在同步传输。全速传输模式下的数据包PID序列全速模式下的同步传输数据方式只使用DATA0包,因此接收方在接收数据时只会收到DATA0数据包。高速传输模式下的数据包PID序列高速模式下的数据包序列根据一个微帧中的事务个数不同,采用不同的数据包序列,使......
UAC音频设备的同步传输(同步、自适应、异步)模式区分
USB定义了四种数据传输,分别为控制传输,中断传输、批量传输和同步传输。其中同步传输按端点的配置可分为同步方式,自适应方式和异步方式。这是通过端点描述符的bEndpointType的bit3-2的值来进行配置的。bEndpointType的bit3-2传输方式00无同步0......
USB2.0低速、全速、高速模式四种传输模式速宽对比
USB 数据传输通过事务来实现。事务在帧的主机控制时间间隔内进行。事务的长度和频率取决于端点使用的传输类型。可以在一个帧中发送的传输类型和帧长度由 USB 的指定速度定义。低速模式下控制传输、中断传输、批量传输、同步传输对比低速帧速率为1ms传输类型最大传输长度每帧的传输次数最大理......
USB传输模式选择及各传输特性对比
通用串行总线 (USB) 传输类型是指主机和设备端点之间使用的通信模式。传输类型决定了用于与端点通信的事务的频率和长度。传输类型还可以分配一个循环冗余校验和 (CRC),以对每个传输的数据包进行验证。传输类型由设备设置,并在枚举过程中与主机通信。USB分为四种传输模式,分别为中断传输模式,控制传输......
关注公众号
  • HID人机交互
  • Linux&USB
  • UAC音频
  • CDC
  • TYPE-C
  • USB规范
  • USB大容量存储
  • USB百科
  • USB周边
  • UVC摄像头
  • Windows系统USB
  • 音视频博客
  • 取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

    打开支付宝扫一扫,即可进行扫码打赏哦

    您的支持,是我们前进的动力!