HID Report Descriptor




グローバルアイテムのタイプ @ USB complete 12-3

Usage Pageデータの使い方または機能の定義

HID Usage Tables,10/28/2004,Version 1.12

 3.1 HID Usage Table Conventions 
   32'hxxxx ::= { Usage Page(16bit) , Usage ID(16bit) } 
 3.3 Usages and Units 
 When declaring Units for a main item, 
 the Logical Minimum, Logical Maximum, Physical Minimum, Physical Maximum, and Unit Exponent items must also be declared. 
 3.4 Usage Types 
  control type( LC(Linear Control),OOC(On/Off Control),MC(Momentary Control)など)により, 
  Logical Min - Maxの範囲設定例と動作概要の説明 
 3.4.1 Usage Types (Controls) 
   Linear Control(LC) 
   On/Off Control(OOC) 
   Momentary Control(MC) 
   One Shot Control(OSC) 
   Re-trigger Control(RTC) 
 3.4.2 Usage Types (Data) 
Type Flags Description
Selector (Sel)ArrayContained in a Named Array (NAry).
Static Value (SV)Constant, Variable, AbsoluteA read-only multiple-bit value.
Static Flag (SF)Constant, Variable, AbsoluteA read-only single-bit value.
Dynamic Value (DV)Data, Variable, AbsoluteA read/write multiple-bit value.
Dynamic Flag (DF)Data, Variable, AbsoluteA read/write single-bit value.
 4 Generic Desktop Page (0x01) 
 |* Usage ID |* Usage Name |* Usage Type |* Section8 Hut1_12.pdf 
 4.3.1 Resolution Multiplier 

Effective Resolutiuon Multiplierは,以下の式で求められる.{( ( \frac{RMV - LMin}{LMax - LMin} * (PMax - PMin))  + PMin) * 10^{UnitExponent}}
where RMV = Resolution Multiplier Value, LMin = Logical Minimum, LMax = Logical Maximum, ssPMin = Physical Minimum, and PMax = Physical Maximum

Collection (Logical) 
Usage Page Generic Desktop (0x01) 
Usage Resolution Multiplier (0x48) 
Logical Minimum 0 
Logical Maximum 15 
Physical Minimum 1 
Physical Maximum 16 
Report Size 4 
Report Count 1 
Feature (Data, Var, Abs)		<- featureコマンドで, 1-16を受け付ける.  

Usage Page Generic Desktop (0x01) 
Usage (Wheel) (0x38) 
Logical Minimum -127 
Logical Maximum 127 
Report Count 1 
Report Size 8 
Input (Data, Var, Rel) 
End Collection 

*参考-usb.orgの仕様から HID Report Descriptorを消化してみる.

Usage Page (Generic Desktop),
Usage (Keyboard),
Collection (Application),
  Report Size (1),			
  Report Count (8),			
  Usage Page (Key Codes),	// KeyCodeを示すことを宣言
  Usage Minimum (224),		//ID224-231を size=1(bit) x 8個 に割り当てる.
  Usage Maximum (231),		//
  Logical Minimum (0),		//押下状態0/1を定義
  Logical Maximum (1),		//
  Input (Data, Variable, Absolute),     ;Modifier byte

  Report Count (1),			
  Report Size (8),			
  Input (Constant), ;Reserved byte

  Report Count (5),			// 5個
  Report Size (1),			// 1bit
  Usage Page (LEDs),		// 
  Usage Minimum (1),		// 1~5
  Usage Maximum (5),		// 
  Output (Data, Variable, Absolute),    ;LED report

  Report Count (1),			
  Report Size (3),			
  Output (Constant),                    ;LED report padding

  Report Count (6),		// 6個
  Report Size (8),			// 8bitサイズ
  Logical Minimum (0),		// 0~
  Logical Maximum(255),		// 255
  Usage Page (Key Codes),	// KeyCodeを示すことを宣言
  Usage Minimum (0),		// 0~
  Usage Maximum (255),		// 255 このUsage min/maxと冒頭のmin/maxでかなり意味が違う気がする. Array型だからいいように把握してくれるのかな..
  Input (Data, Array),		// 反映. 
End Collection

1バイト目でUsage Min/Maxを指定しているのは,下記押下状態を通知するためと考えられる(未確認)

Usage ID(Dec)Usage ID(Hex)Usage Name
224E0Keyboard LeftControl
225E1Keyboard LeftShift
226E2Keyboard LeftAlt
227E3Keyboard Left GUI
228E4Keyboard RightControl
229E5Keyboard RightShift
230E6Keyboard RightAlt
231E7Keyboard Right GUI

Usage(LED)'s valueは以下のとおり.これをデバイス側で受けて,LEDのon/off制御をおこなう..のだろう.

01Num Lock
02Caps Lock
03Scroll Lock