3 Helper routine and corresponding data struct used by USB Mouse Driver.
5 Copyright (c) 2004 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _EFI_USB_MOUSE_H_
17 #define _EFI_USB_MOUSE_H_
22 #include <Protocol/SimplePointer.h>
23 #include <Protocol/UsbIo.h>
24 #include <Protocol/DevicePath.h>
26 #include <Library/ReportStatusCodeLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/UefiUsbLib.h>
35 #include <IndustryStandard/Usb.h>
38 #define SUBCLASS_BOOT 1
39 #define PROTOCOL_MOUSE 2
41 #define BOOT_PROTOCOL 0
42 #define REPORT_PROTOCOL 1
44 #define USB_MOUSE_DEV_SIGNATURE SIGNATURE_32 ('u', 'm', 'o', 'u')
47 BOOLEAN ButtonDetected
;
55 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
56 EFI_EVENT DelayedRecoveryEvent
;
57 EFI_USB_IO_PROTOCOL
*UsbIo
;
58 EFI_USB_INTERFACE_DESCRIPTOR
*InterfaceDescriptor
;
59 EFI_USB_ENDPOINT_DESCRIPTOR
*IntEndpointDescriptor
;
60 UINT8 NumberOfButtons
;
65 EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol
;
66 EFI_SIMPLE_POINTER_STATE State
;
67 EFI_SIMPLE_POINTER_MODE Mode
;
69 PRIVATE_DATA PrivateData
;
70 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
73 #define USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL(a) \
74 CR(a, USB_MOUSE_DEV, SimplePointerProtocol, USB_MOUSE_DEV_SIGNATURE)
78 Timer handler for Delayed Recovery timer.
80 @param Event The Delayed Recovery event.
81 @param Context Points to the USB_KB_DEV instance.
87 USBMouseRecoveryHandler (
95 extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding
;
96 extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName
;
97 extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseComponentName2
;
98 extern EFI_GUID gEfiUsbMouseDriverGuid
;
102 Report Status Code in Usb Bot Driver.
104 @param DevicePath Use this to get Device Path
105 @param CodeType Status Code Type
106 @param CodeValue Status Code Value
112 MouseReportStatusCode (
113 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
114 IN EFI_STATUS_CODE_TYPE CodeType
,
115 IN EFI_STATUS_CODE_VALUE Value
119 The USB Mouse driver entry pointer.
121 @param ImageHandle The driver image handle.
122 @param SystemTable The system table.
124 @return EFI_SUCCESS The component name protocol is installed.
125 @return Others Failed to init the usb driver.
130 USBMouseDriverBindingEntryPoint (
131 IN EFI_HANDLE ImageHandle
,
132 IN EFI_SYSTEM_TABLE
*SystemTable
136 Test to see if this driver supports ControllerHandle. Any ControllerHandle
137 that has UsbIoProtocol installed will be supported.
139 @param This Protocol instance pointer.
140 @param Controller Handle of device to test.
141 @param RemainingDevicePath Not used.
143 @retval EFI_SUCCESS This driver supports this device.
144 @retval EFI_UNSUPPORTED This driver does not support this device.
149 USBMouseDriverBindingSupported (
150 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
151 IN EFI_HANDLE Controller
,
152 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
156 Starting the Usb Mouse Driver.
158 @param This Protocol instance pointer.
159 @param Controller Handle of device to test
160 @param RemainingDevicePath Not used
162 @retval EFI_SUCCESS This driver supports this device.
163 @retval EFI_UNSUPPORTED This driver does not support this device.
164 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
165 @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
166 @retval EFI_ALREADY_STARTED Thios driver has been started.
171 USBMouseDriverBindingStart (
172 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
173 IN EFI_HANDLE Controller
,
174 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
178 Stop this driver on ControllerHandle. Support stoping any child handles
179 created by this driver.
181 @param This Protocol instance pointer.
182 @param Controller Handle of device to stop driver on.
183 @param NumberOfChildren Number of Children in the ChildHandleBuffer.
184 @param ChildHandleBuffer List of handles for the children we need to stop.
186 @retval EFI_SUCCESS The controller or children are stopped.
187 @retval Other Failed to stop the driver.
192 USBMouseDriverBindingStop (
193 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
194 IN EFI_HANDLE Controller
,
195 IN UINTN NumberOfChildren
,
196 IN EFI_HANDLE
*ChildHandleBuffer