USB 버스용 커널 모드 스틸 이미지 드라이버는 여러 인터럽트, 대량 IN 및 대량 OUT 엔드포인트와 함께 단일 제어 엔드포인트를 지원합니다. The control and interrupt endpoints are accessible using I/O control codes and DeviceIoControl. The bulk endpoints are accessible using ReadFile and WriteFile.
Before calling DeviceIoControl, ReadFile, or WriteFile, you must call CreateFile (all described in the Microsoft Windows SDK documentation) to obtain a device handle. For devices that support no more than one of each endpoint type (control, interrupt, bulk IN, bulk OUT), a single call to CreateFile opens transfer pipes to each endpoint.
For devices that support multiple interrupt or bulk endpoints, a single call to CreateFile opens transfer pipes to the highest-numbered endpoint of each type. 다른 엔드포인트를 사용하려면 다음을 수행해야 합니다.
Call DeviceIoControl, specifying an I/O control code of IOCTL_GET_PIPE_CONFIGURATION, to determine a port's endpoint index numbers (that is, indexes into the returned USBSCAN_PIPE_INFORMATION structure array). Note that these index numbers are not the endpoint numbers described in the Universal Serial Bus Specification.
Append a backslash and the endpoint's index number to the port name returned by IStiDeviceControl::GetMyDevicePortName when calling CreateFile.
예를 들어 디바이스(포트 이름이 "usbscan0"인 디바이스)에 다음과 같이 인덱스 번호가 있는 각 형식(인터럽트, bulk IN, bulk OUT)의 두 개의 엔드포인트가 있다고 가정합니다.
| Index | Type | Endpoint# |
|---|---|---|
| 0 | Interrupt | 0x01 |
| 1 | Bulk IN | 0x82 |
| 2 | Bulk IN | 0x83 |
| 3 | Bulk OUT | 0x04 |
| 4 | Bulk OUT | 0x05 |
| 5 | Interrupt | 0x06 |
If you call CreateFile with a port name of "usbscan0", the function opens transfer pipes to endpoints with index values of 2, 4, and 5, as well as the control endpoint.
If you call CreateFile with a port name of "usbscan0\1", the function opens transfer pipes to endpoints with index values of 1, 4, and 5, as well as the control endpoint.
For this device, if you want to use interrupt endpoint 0, bulk IN endpoint 1, and bulk OUT endpoint 3, call CreateFile three times, specifying port names of "usbscan0\0", "usbscan0\1", and "usbscan0\3". 이렇게 하면 세 개의 디바이스 핸들이 만들어집니다. Whenever a subsequent call to DeviceIoControl, ReadFile, or WriteFile is made, the device handle associated with the desired pipe should be specified.
Because only one control endpoint is supported, specifying any I/O control code that uses the control pipe causes the driver to use the proper endpoint, regardless of which endpoint (if any) was specified to CreateFile.
모든 I/O 컨트롤 코드에 대한 설명은 USB 스틸 이미지 I/O 컨트롤 코드를 참조하세요.
커널 모드 USB 드라이버는 패키지 또는 메시지 프로토콜을 구현하지 않습니다. 읽기 작업에는 특정 패킷 맞춤이 필요하지 않지만 읽기 요청이 최대 패킷 크기 경계에 맞춰진 경우 더 나은 성능을 달성할 수 있습니다. The maximum packet size can be obtained using the IOCTL_GET_CHANNEL_ALIGN_RQST I/O control code.