ComponentName.c 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /** @file
  2. Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
  3. Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "VirtualKeyboard.h"
  7. //
  8. // EFI Component Name Protocol
  9. //
  10. GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gVirtualKeyboardComponentName = {
  11. VirtualKeyboardComponentNameGetDriverName,
  12. VirtualKeyboardComponentNameGetControllerName,
  13. "eng"
  14. };
  15. //
  16. // EFI Component Name 2 Protocol
  17. //
  18. GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVirtualKeyboardComponentName2 = {
  19. (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)VirtualKeyboardComponentNameGetDriverName,
  20. (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)VirtualKeyboardComponentNameGetControllerName,
  21. "en"
  22. };
  23. GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVirtualKeyboardDriverNameTable[] = {
  24. {
  25. "eng;en",
  26. L"Virtual Keyboard Driver"
  27. },
  28. {
  29. "zh-CHS",
  30. L"虚拟键盘驱动程序"
  31. },
  32. {
  33. NULL,
  34. NULL
  35. }
  36. };
  37. /**
  38. Retrieves a Unicode string that is the user readable name of the driver.
  39. This function retrieves the user readable name of a driver in the form of a
  40. Unicode string. If the driver specified by This has a user readable name in
  41. the language specified by Language, then a pointer to the driver name is
  42. returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
  43. by This does not support the language specified by Language,
  44. then EFI_UNSUPPORTED is returned.
  45. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  46. EFI_COMPONENT_NAME_PROTOCOL instance.
  47. @param Language[in] A pointer to a Null-terminated ASCII string
  48. array indicating the language. This is the
  49. language of the driver name that the caller is
  50. requesting, and it must match one of the
  51. languages specified in SupportedLanguages. The
  52. number of languages supported by a driver is up
  53. to the driver writer. Language is specified
  54. in RFC 4646 or ISO 639-2 language code format.
  55. @param DriverName[out] A pointer to the Unicode string to return.
  56. This Unicode string is the name of the
  57. driver specified by This in the language
  58. specified by Language.
  59. @retval EFI_SUCCESS The Unicode string for the Driver specified by
  60. This and the language specified by Language was
  61. returned in DriverName.
  62. @retval EFI_INVALID_PARAMETER Language is NULL.
  63. @retval EFI_INVALID_PARAMETER DriverName is NULL.
  64. @retval EFI_UNSUPPORTED The driver specified by This does not support
  65. the language specified by Language.
  66. **/
  67. EFI_STATUS
  68. EFIAPI
  69. VirtualKeyboardComponentNameGetDriverName (
  70. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  71. IN CHAR8 *Language,
  72. OUT CHAR16 **DriverName
  73. )
  74. {
  75. return LookupUnicodeString2 (
  76. Language,
  77. This->SupportedLanguages,
  78. mVirtualKeyboardDriverNameTable,
  79. DriverName,
  80. (BOOLEAN)(This == &gVirtualKeyboardComponentName)
  81. );
  82. }
  83. /**
  84. Retrieves a Unicode string that is the user readable name of the controller
  85. that is being managed by a driver.
  86. This function retrieves the user readable name of the controller specified by
  87. ControllerHandle and ChildHandle in the form of a Unicode string. If the
  88. driver specified by This has a user readable name in the language specified by
  89. Language, then a pointer to the controller name is returned in ControllerName,
  90. and EFI_SUCCESS is returned. If the driver specified by This is not currently
  91. managing the controller specified by ControllerHandle and ChildHandle,
  92. then EFI_UNSUPPORTED is returned. If the driver specified by This does not
  93. support the language specified by Language, then EFI_UNSUPPORTED is returned.
  94. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  95. EFI_COMPONENT_NAME_PROTOCOL instance.
  96. @param ControllerHandle[in] The handle of a controller that the driver
  97. specified by This is managing. This handle
  98. specifies the controller whose name is to be
  99. returned.
  100. @param ChildHandle[in] The handle of the child controller to retrieve
  101. the name of. This is an optional parameter that
  102. may be NULL. It will be NULL for device
  103. drivers. It will also be NULL for a bus drivers
  104. that wish to retrieve the name of the bus
  105. controller. It will not be NULL for a bus
  106. driver that wishes to retrieve the name of a
  107. child controller.
  108. @param Language[in] A pointer to a Null-terminated ASCII string
  109. array indicating the language. This is the
  110. language of the driver name that the caller is
  111. requesting, and it must match one of the
  112. languages specified in SupportedLanguages. The
  113. number of languages supported by a driver is up
  114. to the driver writer. Language is specified in
  115. RFC 4646 or ISO 639-2 language code format.
  116. @param ControllerName[out] A pointer to the Unicode string to return.
  117. This Unicode string is the name of the
  118. controller specified by ControllerHandle and
  119. ChildHandle in the language specified by
  120. Language from the point of view of the driver
  121. specified by This.
  122. @retval EFI_SUCCESS The Unicode string for the user readable name in
  123. the language specified by Language for the
  124. driver specified by This was returned in
  125. DriverName.
  126. @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
  127. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
  128. EFI_HANDLE.
  129. @retval EFI_INVALID_PARAMETER Language is NULL.
  130. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
  131. @retval EFI_UNSUPPORTED The driver specified by This is not currently
  132. managing the controller specified by
  133. ControllerHandle and ChildHandle.
  134. @retval EFI_UNSUPPORTED The driver specified by This does not support
  135. the language specified by Language.
  136. **/
  137. EFI_STATUS
  138. EFIAPI
  139. VirtualKeyboardComponentNameGetControllerName (
  140. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  141. IN EFI_HANDLE ControllerHandle,
  142. IN EFI_HANDLE ChildHandle OPTIONAL,
  143. IN CHAR8 *Language,
  144. OUT CHAR16 **ControllerName
  145. )
  146. {
  147. return EFI_UNSUPPORTED;
  148. }