]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Bus/Usb/UsbMouse/Dxe/ComponentName.c
Fix capitalization.
[mirror_edk2.git] / EdkModulePkg / Bus / Usb / UsbMouse / Dxe / ComponentName.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
20#include "usbmouse.h"\r
21\r
22//\r
23// EFI Component Name Functions\r
24//\r
25EFI_STATUS\r
26EFIAPI\r
27UsbMouseComponentNameGetDriverName (\r
28 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
29 IN CHAR8 *Language,\r
30 OUT CHAR16 **DriverName\r
31 );\r
32\r
33EFI_STATUS\r
34EFIAPI\r
35UsbMouseComponentNameGetControllerName (\r
36 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
37 IN EFI_HANDLE ControllerHandle,\r
38 IN EFI_HANDLE ChildHandle OPTIONAL,\r
39 IN CHAR8 *Language,\r
40 OUT CHAR16 **ControllerName\r
41 );\r
42\r
43//\r
44// EFI Component Name Protocol\r
45//\r
46EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName = {\r
47 UsbMouseComponentNameGetDriverName,\r
48 UsbMouseComponentNameGetControllerName,\r
49 "eng"\r
50};\r
51\r
52STATIC EFI_UNICODE_STRING_TABLE mUsbMouseDriverNameTable[] = {\r
53 { "eng", (CHAR16 *) L"Usb Mouse Driver" },\r
54 { NULL , NULL }\r
55};\r
56\r
57\r
58EFI_STATUS\r
59EFIAPI\r
60UsbMouseComponentNameGetDriverName (\r
61 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
62 IN CHAR8 *Language,\r
63 OUT CHAR16 **DriverName\r
64 )\r
65/*++\r
66\r
67 Routine Description:\r
68 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
69\r
70 Arguments:\r
71 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
72 Language - A pointer to a three character ISO 639-2 language identifier.\r
73 This is the language of the driver name that that the caller \r
74 is requesting, and it must match one of the languages specified\r
75 in SupportedLanguages. The number of languages supported by a \r
76 driver is up to the driver writer.\r
77 DriverName - A pointer to the Unicode string to return. This Unicode string\r
78 is the name of the driver specified by This in the language \r
79 specified by Language.\r
80\r
81 Returns:\r
82 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
83 and the language specified by Language was returned \r
84 in DriverName.\r
85 EFI_INVALID_PARAMETER - Language is NULL.\r
86 EFI_INVALID_PARAMETER - DriverName is NULL.\r
87 EFI_UNSUPPORTED - The driver specified by This does not support the \r
88 language specified by Language.\r
89\r
90--*/\r
91{\r
92 return LookupUnicodeString (\r
93 Language,\r
94 gUsbMouseComponentName.SupportedLanguages,\r
95 mUsbMouseDriverNameTable,\r
96 DriverName\r
97 );\r
98}\r
99\r
100EFI_STATUS\r
101EFIAPI\r
102UsbMouseComponentNameGetControllerName (\r
103 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
104 IN EFI_HANDLE ControllerHandle,\r
105 IN EFI_HANDLE ChildHandle OPTIONAL,\r
106 IN CHAR8 *Language,\r
107 OUT CHAR16 **ControllerName\r
108 )\r
109/*++\r
110\r
111 Routine Description:\r
112 Retrieves a Unicode string that is the user readable name of the controller\r
113 that is being managed by an EFI Driver.\r
114\r
115 Arguments:\r
116 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
117 ControllerHandle - The handle of a controller that the driver specified by \r
118 This is managing. This handle specifies the controller \r
119 whose name is to be returned.\r
120 ChildHandle - The handle of the child controller to retrieve the name \r
121 of. This is an optional parameter that may be NULL. It \r
122 will be NULL for device drivers. It will also be NULL \r
123 for a bus drivers that wish to retrieve the name of the \r
124 bus controller. It will not be NULL for a bus driver \r
125 that wishes to retrieve the name of a child controller.\r
126 Language - A pointer to a three character ISO 639-2 language \r
127 identifier. This is the language of the controller name \r
128 that that the caller is requesting, and it must match one\r
129 of the languages specified in SupportedLanguages. The \r
130 number of languages supported by a driver is up to the \r
131 driver writer.\r
132 ControllerName - A pointer to the Unicode string to return. This Unicode\r
133 string is the name of the controller specified by \r
134 ControllerHandle and ChildHandle in the language specified\r
135 by Language from the point of view of the driver specified\r
136 by This. \r
137\r
138 Returns:\r
139 EFI_SUCCESS - The Unicode string for the user readable name in the \r
140 language specified by Language for the driver \r
141 specified by This was returned in DriverName.\r
142 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
143 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
144 EFI_INVALID_PARAMETER - Language is NULL.\r
145 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
146 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
147 the controller specified by ControllerHandle and \r
148 ChildHandle.\r
149 EFI_UNSUPPORTED - The driver specified by This does not support the \r
150 language specified by Language.\r
151\r
152--*/\r
153{\r
154 EFI_STATUS Status;\r
155 USB_MOUSE_DEV *UsbMouseDev;\r
156 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;\r
157 EFI_USB_IO_PROTOCOL *UsbIoProtocol;\r
158\r
159 //\r
160 // This is a device driver, so ChildHandle must be NULL.\r
161 //\r
162 if (ChildHandle != NULL) {\r
163 return EFI_UNSUPPORTED;\r
164 }\r
165 \r
166 //\r
167 // Check Controller's handle\r
168 //\r
169 Status = gBS->OpenProtocol (\r
170 ControllerHandle,\r
171 &gEfiUsbIoProtocolGuid,\r
172 (VOID **) &UsbIoProtocol,\r
173 gUsbMouseDriverBinding.DriverBindingHandle,\r
174 ControllerHandle,\r
175 EFI_OPEN_PROTOCOL_BY_DRIVER\r
176 );\r
177 if (!EFI_ERROR (Status)) {\r
178 gBS->CloseProtocol (\r
179 ControllerHandle,\r
180 &gEfiUsbIoProtocolGuid,\r
181 gUsbMouseDriverBinding.DriverBindingHandle,\r
182 ControllerHandle\r
183 );\r
184\r
185 return EFI_UNSUPPORTED;\r
186 }\r
187\r
188 if (Status != EFI_ALREADY_STARTED) {\r
189 return EFI_UNSUPPORTED;\r
190 }\r
191 //\r
192 // Get the device context\r
193 //\r
194 Status = gBS->OpenProtocol (\r
195 ControllerHandle,\r
196 &gEfiSimplePointerProtocolGuid,\r
197 (VOID **) &SimplePointerProtocol,\r
198 gUsbMouseDriverBinding.DriverBindingHandle,\r
199 ControllerHandle,\r
200 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
201 );\r
202\r
203 if (EFI_ERROR (Status)) {\r
204 return Status;\r
205 }\r
206\r
207 UsbMouseDev = USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL (SimplePointerProtocol);\r
208\r
209 return LookupUnicodeString (\r
210 Language,\r
211 gUsbMouseComponentName.SupportedLanguages,\r
212 UsbMouseDev->ControllerNameTable,\r
213 ControllerName\r
214 );\r
215\r
216}\r