]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.c
EmbeddedPkg/Drivers: add virtual keyboard driver
[mirror_edk2.git] / EmbeddedPkg / Drivers / VirtualKeyboardDxe / ComponentName.c
CommitLineData
1df5fb2d
HZ
1/** @file\r
2\r
3Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
4Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>\r
5\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions\r
8of the BSD License which accompanies this distribution. The\r
9full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include "VirtualKeyboard.h"\r
18\r
19//\r
20// EFI Component Name Protocol\r
21//\r
22GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gVirtualKeyboardComponentName = {\r
23 VirtualKeyboardComponentNameGetDriverName,\r
24 VirtualKeyboardComponentNameGetControllerName,\r
25 "eng"\r
26};\r
27\r
28//\r
29// EFI Component Name 2 Protocol\r
30//\r
31GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVirtualKeyboardComponentName2 = {\r
32 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) VirtualKeyboardComponentNameGetDriverName,\r
33 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) VirtualKeyboardComponentNameGetControllerName,\r
34 "en"\r
35};\r
36\r
37\r
38GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVirtualKeyboardDriverNameTable[] = {\r
39 {\r
40 "eng;en",\r
41 L"Virtual Keyboard Driver"\r
42 },\r
43 {\r
44 "zh-CHS",\r
45 L"虚拟键盘驱动程序"\r
46 },\r
47 {\r
48 NULL,\r
49 NULL\r
50 }\r
51};\r
52\r
53/**\r
54 Retrieves a Unicode string that is the user readable name of the driver.\r
55\r
56 This function retrieves the user readable name of a driver in the form of a\r
57 Unicode string. If the driver specified by This has a user readable name in\r
58 the language specified by Language, then a pointer to the driver name is\r
59 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
60 by This does not support the language specified by Language,\r
61 then EFI_UNSUPPORTED is returned.\r
62\r
63 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
64 EFI_COMPONENT_NAME_PROTOCOL instance.\r
65\r
66 @param Language[in] A pointer to a Null-terminated ASCII string\r
67 array indicating the language. This is the\r
68 language of the driver name that the caller is\r
69 requesting, and it must match one of the\r
70 languages specified in SupportedLanguages. The\r
71 number of languages supported by a driver is up\r
72 to the driver writer. Language is specified\r
73 in RFC 4646 or ISO 639-2 language code format.\r
74\r
75 @param DriverName[out] A pointer to the Unicode string to return.\r
76 This Unicode string is the name of the\r
77 driver specified by This in the language\r
78 specified by Language.\r
79\r
80 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
81 This and the language specified by Language was\r
82 returned in DriverName.\r
83\r
84 @retval EFI_INVALID_PARAMETER Language is NULL.\r
85\r
86 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
87\r
88 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
89 the language specified by Language.\r
90\r
91**/\r
92EFI_STATUS\r
93EFIAPI\r
94VirtualKeyboardComponentNameGetDriverName (\r
95 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
96 IN CHAR8 *Language,\r
97 OUT CHAR16 **DriverName\r
98 )\r
99{\r
100 return LookupUnicodeString2 (\r
101 Language,\r
102 This->SupportedLanguages,\r
103 mVirtualKeyboardDriverNameTable,\r
104 DriverName,\r
105 (BOOLEAN)(This == &gVirtualKeyboardComponentName)\r
106 );\r
107}\r
108\r
109/**\r
110 Retrieves a Unicode string that is the user readable name of the controller\r
111 that is being managed by a driver.\r
112\r
113 This function retrieves the user readable name of the controller specified by\r
114 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
115 driver specified by This has a user readable name in the language specified by\r
116 Language, then a pointer to the controller name is returned in ControllerName,\r
117 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
118 managing the controller specified by ControllerHandle and ChildHandle,\r
119 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
120 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
121\r
122 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
123 EFI_COMPONENT_NAME_PROTOCOL instance.\r
124\r
125 @param ControllerHandle[in] The handle of a controller that the driver\r
126 specified by This is managing. This handle\r
127 specifies the controller whose name is to be\r
128 returned.\r
129\r
130 @param ChildHandle[in] The handle of the child controller to retrieve\r
131 the name of. This is an optional parameter that\r
132 may be NULL. It will be NULL for device\r
133 drivers. It will also be NULL for a bus drivers\r
134 that wish to retrieve the name of the bus\r
135 controller. It will not be NULL for a bus\r
136 driver that wishes to retrieve the name of a\r
137 child controller.\r
138\r
139 @param Language[in] A pointer to a Null-terminated ASCII string\r
140 array indicating the language. This is the\r
141 language of the driver name that the caller is\r
142 requesting, and it must match one of the\r
143 languages specified in SupportedLanguages. The\r
144 number of languages supported by a driver is up\r
145 to the driver writer. Language is specified in\r
146 RFC 4646 or ISO 639-2 language code format.\r
147\r
148 @param ControllerName[out] A pointer to the Unicode string to return.\r
149 This Unicode string is the name of the\r
150 controller specified by ControllerHandle and\r
151 ChildHandle in the language specified by\r
152 Language from the point of view of the driver\r
153 specified by This.\r
154\r
155 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
156 the language specified by Language for the\r
157 driver specified by This was returned in\r
158 DriverName.\r
159\r
160 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
161\r
162 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
163 EFI_HANDLE.\r
164\r
165 @retval EFI_INVALID_PARAMETER Language is NULL.\r
166\r
167 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
168\r
169 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
170 managing the controller specified by\r
171 ControllerHandle and ChildHandle.\r
172\r
173 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
174 the language specified by Language.\r
175\r
176**/\r
177EFI_STATUS\r
178EFIAPI\r
179VirtualKeyboardComponentNameGetControllerName (\r
180 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
181 IN EFI_HANDLE ControllerHandle,\r
182 IN EFI_HANDLE ChildHandle OPTIONAL,\r
183 IN CHAR8 *Language,\r
184 OUT CHAR16 **ControllerName\r
185 )\r
186{\r
187 return EFI_UNSUPPORTED;\r
188}\r