blob: 9b14cc6d476fd51959e05d94d3d73445a5c19117 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Module Name:
common.h
Environment:
User mode
--*/
#ifndef __VHIDMINI_COMMON_H__
#define __VHIDMINI_COMMON_H__
//
// Custom control codes are defined here. They are to be used for sideband
// communication with the hid minidriver. These control codes are sent to
// the hid minidriver using Hid_SetFeature() API to a custom collection
// defined especially to handle such requests.
//
#define HIDMINI_CONTROL_CODE_SET_ATTRIBUTES 0x00
#define HIDMINI_CONTROL_CODE_DUMMY1 0x01
#define HIDMINI_CONTROL_CODE_DUMMY2 0x02
//
// This is the report id of the collection to which the control codes are sent
//
#define CONTROL_COLLECTION_REPORT_ID 0x01
#define TEST_COLLECTION_REPORT_ID 0x02
#define MAXIMUM_STRING_LENGTH (126 * sizeof(WCHAR))
#define VHIDMINI_MANUFACTURER_STRING L"UMDF Virtual hidmini device Manufacturer string"
#define VHIDMINI_PRODUCT_STRING L"UMDF Virtual hidmini device Product string"
#define VHIDMINI_SERIAL_NUMBER_STRING L"UMDF Virtual hidmini device Serial Number string"
#define VHIDMINI_DEVICE_STRING L"UMDF Virtual hidmini device"
#define VHIDMINI_DEVICE_STRING_INDEX 5
#include <pshpack1.h>
typedef struct _MY_DEVICE_ATTRIBUTES {
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} MY_DEVICE_ATTRIBUTES, *PMY_DEVICE_ATTRIBUTES;
typedef struct _HIDMINI_CONTROL_INFO {
//
//report ID of the collection to which the control request is sent
//
UCHAR ReportId;
//
// One byte control code (user-defined) for communication with hid
// mini driver
//
UCHAR ControlCode;
//
// This union contains input data for the control request.
//
union {
MY_DEVICE_ATTRIBUTES Attributes;
struct {
ULONG Dummy1;
ULONG Dummy2;
} Dummy;
} u;
} HIDMINI_CONTROL_INFO, * PHIDMINI_CONTROL_INFO;
//
// input from device to system
//
typedef struct _HIDMINI_INPUT_REPORT {
UCHAR ReportId;
UCHAR Data;
} HIDMINI_INPUT_REPORT, *PHIDMINI_INPUT_REPORT;
//
// output to device from system
//
typedef struct _HIDMINI_OUTPUT_REPORT {
UCHAR ReportId;
UCHAR Data;
USHORT Pad1;
ULONG Pad2;
} HIDMINI_OUTPUT_REPORT, *PHIDMINI_OUTPUT_REPORT;
#include <poppack.h>
//
// SetFeature request requires that the feature report buffer size be exactly
// same as the size of report described in the hid report descriptor (
// excluding the report ID). Since HIDMINI_CONTROL_INFO includes report ID,
// we subtract one from the size.
//
#define FEATURE_REPORT_SIZE_CB ((USHORT)(sizeof(HIDMINI_CONTROL_INFO) - 1))
#define INPUT_REPORT_SIZE_CB ((USHORT)(sizeof(HIDMINI_INPUT_REPORT) - 1))
#define OUTPUT_REPORT_SIZE_CB ((USHORT)(sizeof(HIDMINI_OUTPUT_REPORT) - 1))
#endif //__VHIDMINI_COMMON_H__
|