最終更新:2015-03-26 (木) 04:08:28 (3318d)
Windows/HID
http://msdn.microsoft.com/en-us/library/windows/hardware/ff539952(v=vs.85).aspx
MSDNライブラリ
- Windows Desktop App Development
- Windows Driver Development
- Device and Driver Technologies
- Human Interface Devices
- http://msdn.microsoft.com/en-us/library/ff543301(VS.85).aspx
- https://msdn.microsoft.com/en-us/library/windows/hardware/ff543301(v=vs.85).aspx
短縮URL
メモ
- システムのキーボードやポインティングデバイスに関しては、WindowsはInputおよびOutputレポートへの排他的アクセス権を持っている。
- API関数経由でレポートを取り出そうとするとAccess Deniedとなる。
- Raw InputかDirectInputを使って取り出せる。
HID/レポートの送受信
- Windowsでレポート用のバッファを確保するときは、たとえレポートID0x00のみを使用する場合もレポートID分1バイトを加えた分を確保しなければならない。
- 書き込むときもバッファの先頭にレポートIDを入れる。
ドライバ
HID
SPB
- SPBCx.sys? -> HIDI2C.sys -> HIDCLASS.sys?
API
Device Discovery and Setup
- The following list identifies HID API that an application can use to: identify properties of a HID device, and, to establish communication with that device. In addition, an application can use some of these API to identify a Top Level Collection.
- HidD_GetAttributes
- HidD_GetHidGuid
- HidD_GetIndexedString?
- HidD_GetManufacturerString?
- HidD_GetPhysicalDescriptor?
- HidD_GetPreparsedData
- HidD_GetProductString?
- HidD_GetSerialNumberString?
- HidD_GetNumInputBuffers?
- HidD_SetNumInputBuffers?
Data Movement
- The following list identifies HID API that an application can use to move data back and forth between the app and a selected device.
Report Creation and Interpretation
- HID parser API (HidP_*)
- レポートディスクリプタのパースを行う。
- レポートのサイズとかがわからない(汎用デバイスに対応する場合)に使う。
HIDClass Support Routines
hidsdi.h
- HidD_FlushQueue?
- HidD_FreePreparsedData?
- HidD_GetAttributes
- HidD_GetFeature
- HidD_GetHidGuid
- HidD_GetIndexedString?
- HidD_GetInputReport - returns an input reports from a top-level collection.
- HidD_GetManufacturerString?
- HidD_GetNumInputBuffers?
- HidD_GetPhysicalDescriptor?
- HidD_GetPreparsedData
- HidD_GetProductString?
- HidD_GetSerialNumberString?
- HidD_SetFeature
- HidD_SetNumInputBuffers?
- HidD_SetOutputReport - sends an output report to a top-level collection.
hidpi.h (HID parser API)
- HidP_GetButtonCaps?
- HidP_GetButtons?
- HidP_GetButtonsEx?
- HidP_GetCaps
- HidP_GetData?
- HidP_GetExtendedAttributes?
- HidP_GetLinkCollectionNodes?
- HidP_GetScaledUsageValue?
- HidP_GetSpecificButtonCaps?
- HidP_GetSpecificValueCaps?
- HidP_GetUsages?
- HidP_GetUsagesEx?
- HidP_GetUsageValue?
- HidP_GetUsageValueArray?
- HidP_GetValueCaps
- HidP_InitializeReportForID
- HidP_IsSameUsageAndPage?
- HidP_MaxDataListLength?
- HidP_MaxUsageListLength?
- HidP_SetButtons?
- HidP_SetData?
- HidP_SetScaledUsageValue?
- HidP_SetUsages?
- HidP_SetUsageValue?
- HidP_SetUsageValueArray?
- HidP_TranslateUsagesToI8042ScanCodes?
- HidP_UnsetButtons?
- HidP_UnsetUsages?
- HidP_UsageAndPageListDifference?
- HidP_UsageListDifference?
- HidRegisterMinidriver?
関連DLL
手順
- HidD_GetHidGuid
- SetupDiGetClassDevs - 指定されたクラスに所属するすべてのデバイスが含まれている1つのデバイス情報セットを返します。
- SetupDiEnumDeviceInterfaces - デバイス情報セットのデバイスインターフェイスを表すコンテキスト構造体を返します。
- SetupDiGetDeviceInterfaceDetail - 指定されたデバイスインターフェイスに関する詳細情報を返します。
- CreateFile
- HidD_GetAttributes
- HidD_GetPreparsedData
- HidP_GetCaps
- ReadFile/WriteFile/DeviceIoControl
- CloseHandle
例
Raw Input
- Usage PageとUsage IDを指定してWM_INPUTとしてウィンドウメッセージを受信。
デバイスプロトコルAPI
- Windows 8.1のWindowsストアアプリ用API (WinRT)
- Windows.Devices.HumanInterfaceDevice?
ポート
- USB
- Bluetooth
- PS/2
- I2C (HIDI2C.sys)
- Windows 8 and later
- Microsoft provides support for HID over I2C devices on SoC systems that support Simple Peripheral Bus (SPB) and general-purpose I/O (GPIO).
- http://msdn.microsoft.com/en-us/library/windows/hardware/jj127208(v=vs.85).aspx
Windows Hardware Dev Center
Human Interface Devices (目次)
HID Clients Supported in Windows
- http://msdn.microsoft.com/en-us/library/windows/hardware/jj126194(v=vs.85).aspx
Usage Page Usage Windows 7 Windows 8 Notes Access Mode 0x0001 0x0001 - 0x0002 Yes Yes Mouse class driver and mapper driver. Exclusive 0x0001 0x0004 - 0x0005 Yes Yes Game Controllers* Shared 0x0001 0x0006 - 0x0007 Yes Yes Keyboard / Keypad class driver and mapper driver. Exclusive 0x0001 0x000C No Yes Flight Mode Switch Shared 0x0001 0x0080 Yes Yes System Controls (Power) Shared 0x000C 0x0001 Yes Yes Consumer Controls (HIDServ.dll) Shared 0x000D 0x0002 Yes Yes Pen Device Exclusive 0x000D 0x0004 Yes Yes Touch Screen Exclusive 0x0020 Multiple No Yes Sensors Shared 0x0084 0x004 Yes Yes HID UPS Battery Shared
Opening HID collections (hid.dll)
- HidD_GetHidGuid
- SetupDiGetClassDevs
- SetupDiEnumDeviceInterfaces
- SetupDiGetDeviceInterfaceDetail
- CreateFile
build?
- http://channel9.msdn.com/Events/Build/2013/2-924b (Apps for HID Devices)
- http://code.msdn.microsoft.com/windowsapps/Sample-motion-sensor-39bea694/