Home | History | Annotate | Download | only in driver
      1 /*
      2  * Copyright (C) 2006 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ANDROID_USB_DEVICE_FILE_OBJECT_H__
     18 #define ANDROID_USB_DEVICE_FILE_OBJECT_H__
     19 /** \file
     20   This file consists of declaration of class AndroidUsbDeviceFileObject that
     21   encapsulates an extension for a KMDF file object that represent opened
     22   device.
     23 */
     24 
     25 #include "android_usb_file_object.h"
     26 
     27 /** AndroidUsbDeviceFileObject class encapsulates an extension for a KMDF
     28   file object that represent opened device. Instances of this class must be
     29   allocated from NonPagedPool.
     30 */
     31 class AndroidUsbDeviceFileObject : public AndroidUsbFileObject  {
     32  public:
     33   /** \brief Constructs the object.
     34 
     35     This method must be called at low IRQL.
     36     @param dev_obj[in] Our device object for which this file has been created
     37     @param wdf_fo[in] KMDF file object this extension wraps
     38   */
     39   AndroidUsbDeviceFileObject(AndroidUsbDeviceObject* dev_obj,
     40                              WDFFILEOBJECT wdf_fo);
     41 
     42   /** \brief Destructs the object.
     43 
     44     This method can be called at any IRQL.
     45   */
     46    virtual ~AndroidUsbDeviceFileObject();
     47 
     48   /** \brief IOCTL event handler
     49 
     50     This method is called when a device control request comes to the file
     51     object this extension wraps. We override this method to handle the
     52     following IOCTL requests:
     53       1. ADB_CTL_GET_USB_DEVICE_DESCRIPTOR
     54       2. ADB_CTL_GET_USB_CONFIGURATION_DESCRIPTOR
     55       3. ADB_CTL_GET_USB_INTERFACE_DESCRIPTOR
     56       4. ADB_CTL_GET_ENDPOINT_INFORMATION
     57     This callback can be called IRQL <= DISPATCH_LEVEL.
     58     @param request[in] A handle to a framework request object.
     59     @param output_buf_len[in] The length, in bytes, of the request's output
     60            buffer, if an output buffer is available.
     61     @param input_buf_len[in] The length, in bytes, of the request's input
     62            buffer, if an input buffer is available.
     63     @param ioctl_code[in] The driver-defined or system-defined I/O control code
     64            that is associated with the request.
     65     @return Successful status or an appropriate error code
     66   */
     67   virtual void OnEvtIoDeviceControl(WDFREQUEST request,
     68                                     size_t output_buf_len,
     69                                     size_t input_buf_len,
     70                                     ULONG ioctl_code);
     71 };
     72 
     73 #endif  // ANDROID_USB_DEVICE_FILE_OBJECT_H__
     74