본문 바로가기
Programming 개발은 구글로/C#[WPF]

C#[WPF] HID(휴먼 인터페이스 장치)에 대하여

by 40대직장인 2022. 4. 2.

HID(Human Interface Device)

: HID는 휴먼 인터페이스 장치로 인간이 데이터를 입력하거나 출력을 제공하여 전자 정보 시스템과 상호 작용하는 방법입니다.

 

HID는 사람이 작동하는 컴퓨터 장비의 표준입니다.

이 표준 덕분에 추가 소프트웨어나 드라이버 없이 쉽게 사용할 수 있습니다.

 

'장치 관리자'로 확인해보면, 아래처럼 휴먼 인터페이스 장치들을 확인할 수 있습니다.

 

 

<카피 장인의 장치 관리자 정보>

 

 

휴먼 인터페이스 장치는 입력 장치의 설치 프로세스를 단순화하기 위해 만들어진 표준입니다.

 

HID 이전에는 각 입력 장치 유형에 대해 몇 가지 프로토콜이 있었습니다.

이런 프로토콜은 디바이스가 마우스 및 키보드에 대해 엄격하게 정의된 프로토콜만 활용할 수 있습니다.

하드웨어 혁신을 위해서는 기존 프로토콜에서 데이터를 오버로드하거나 고유한 특수 드라이버를 사용하여 비표준 하드웨어를 만들어야 했습니다. 

 

이에 비해 HID 호환장치는 장치의 모든 작업을 포함하는 "데이터 패킷"이 포함되어 있습니다.

예를 들면, 키보드에는 각 Key에 맞는 값이 설정이 되어 있습니다.

이 키를 누르면 해당 작업의 대상이 패킷에 저장되어 있는 위치를 컴퓨터에 알려주고 실행합니다.

 

HID는 인간이 컴퓨터 시스템의 작동을 제어하기 위해 사용하는 장치의 대부분을 제시하고 있습니다.

 


 

USB-HID Class Spec

 

http://www.usb.org/developers/devclass_docs/HID1_11.pdf

 

 

Human Interface Devices (HID) is a device class definition to replace PS/2-style connectors with a generic USB driver to support HID devices such as keyboards, mice, game controllers, and so on. Prior to HID, devices could only utilize strictly-defined protocols for mice and keyboards. Hardware innovation required either overloading data in an existing protocol or creating non-standard hardware with its own specialized driver. HID provided support for these "boot mode" devices while adding support for hardware innovation through extensible, standardized and easily-programmable interfaces.

 

To develop Human Interface Devices (HID), you need these headers:

  • hidclass.h
  • hidpddi.h
  • hidpi.h
  • hidport.h
  • hidsdi.h
  • hidspicx.h
  • kbdmou.h
  • ntdd8042.h
  • vhf.h

 

HID 통신에서 데이터 송수신 시 사용되는 hidsdi.h 파일은 꼭 살펴보기 바랍니다.

 

hidsdi.h 

		[DllImport("hid.dll", SetLastError = true)]
		private static extern bool HidD_GetInputReport(
			SafeFileHandle HidDeviceObject,
			IntPtr ReportBuffer,
			int ReportBufferLength
			);

		[DllImport("hid.dll", SetLastError = true)]
		private static extern bool HidD_SetOutputReport(
			SafeFileHandle HidDeviceObject,
			IntPtr ReportBuffer,
			int ReportBufferLength
			);

 

관련 글: HID 통신 모니터링 프로그램

2022.04.14 - [분류 전체보기] - [HID] HID 통신 모니터링 프로그램

 

 

댓글