USB2.0规范
+ -

USB接口电源描述符

2025-02-05 5 0

USB接口电源描述符(USB Interface Power Descriptor)的类型ID为8

struct _INTERFACE_POWER_DESCRIPTOR_STRUCT 
{ 
    BYTE bLength;           //描述符的字节数大小 
    BYTE bDescriptorType;   //描述符类型编号,为0x08 
    BYTE bCapabilitiesFlags ;           
    WORD EventNotification;   
    WORD D1LatencyTime;  
    WORD D2LatencyTime;      
    WORD D3LatencyTime;      
    BTYE PowerUnit;
    WORD D0PowerConsumption;          
    WORD D1PowerConsumption;      
    WORD D2PowerConsumption;      
}

上面结构体必须1字节对齐

  • bCapabilitiesFlags:

    • BIT0:D0
    • BIT1:D1
    • BIT2:D2
    • BIT3:D3
    • BIT4:WakeD1
    • BIT5:WakeD2
  • PowerUnit:

    • 0:0.001 mW
    • 1:0.01 mW
    • 2:0.1mW
    • 3:1mW
    • 4:10mW
    • 5:100mW
    • 6:1W

该描述符分析来源于以下代码:

__int64 __fastcall myInterfacePowerDescriptor(unsigned __int8 *a1)
{
  __int64 v2; // rcx
  const char *v3; // rax
  const char *v4; // r8

  myPrintf("\r\n        ------------------ Power Descriptor -------------------\r\n");
  myPrintf("bLength                  : 0x%02X (%u bytes)\r\n", *a1, *a1);
  LOBYTE(v2) = a1[1];
  v3 = (const char *)sub_1400243D0(v2);
  myPrintf("bDescriptorType          : 0x%02X (%s)\r\n", a1[1], v3);
  myPrintf("bCapabilitiesFlags       : 0x%02X (", a1[2]);
  if ( (a1[2] & 0x20) != 0 )
    myPrintf("WakeD2 ");
  if ( (a1[2] & 0x10) != 0 )
    myPrintf("WakeD1 ");
  if ( (a1[2] & 8) != 0 )
    myPrintf("D3 ");
  if ( (a1[2] & 4) != 0 )
    myPrintf("D2 ");
  if ( (a1[2] & 2) != 0 )
    myPrintf("D1 ");
  if ( (a1[2] & 1) != 0 )
    myPrintf("D0 ");
  myPrintf(")\r\n");
  myPrintf("EventNotification        : 0x%04X\r\n", *((unsigned __int16 *)a1 + 2));
  myPrintf("D1LatencyTime            : 0x%04X\r\n", *((unsigned __int16 *)a1 + 3));
  myPrintf("D2LatencyTime            : 0x%04X\r\n", *((unsigned __int16 *)a1 + 4));
  myPrintf("D3LatencyTime            : 0x%04X\r\n", *((unsigned __int16 *)a1 + 5));
  if ( a1[12] >= 7u )
    v4 = "?";
  else
    v4 = dumpUnit[a1[12]];
  myPrintf("PowerUnit                : 0x%02X (%s)\r\n", a1[12], v4);
  myPrintf("D0PowerConsumption       : 0x%04X (%5d)\r\n", *((unsigned __int16 *)a1 + 7), *((unsigned __int16 *)a1 + 7));
  myPrintf("D1PowerConsumption       : 0x%04X (%5d)\r\n", *((unsigned __int16 *)a1 + 8), *((unsigned __int16 *)a1 + 8));
  myPrintf("D2PowerConsumption       : 0x%04X (%5d)\r\n", *((unsigned __int16 *)a1 + 9), *((unsigned __int16 *)a1 + 9));
  return HexDump(a1);
}
HID人机交互QQ群:564808376    UAC音频QQ群:218581009    UVC相机QQ群:331552032    BOT&UASP大容量存储QQ群:258159197    STC-USB单片机QQ群:315457461    USB技术交流QQ群2:580684376    USB技术交流QQ群:952873936   

0 篇笔记 写笔记

USB接口电源描述符
USB接口电源描述符(USB Interface Power Descriptor)的类型ID为8struct _INTERFACE_POWER_DESCRIPTOR_STRUCT { BYTE bLength; //描述符的字节数大小 BYTE bDes......
关注公众号
  • HID人机交互
  • Linux&USB
  • UAC音频
  • TYPE-C
  • USB规范
  • USB大容量存储
  • USB百科
  • USB周边
  • UVC摄像头
  • Windows系统USB
  • 音视频博客
  • 取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

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

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