Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/usbhid.h

    r62bd8d3 rdd10e07  
    3434 */
    3535
    36 #ifndef USB_HID_USBHID_H_
    37 #define USB_HID_USBHID_H_
     36#ifndef USB_USBHID_H_
     37#define USB_USBHID_H_
    3838
    3939#include <stdint.h>
     
    4545#include <usb/classes/hid.h>
    4646
    47 struct usb_hid_dev;
    48 
    49 typedef int (*usb_hid_driver_init_t)(struct usb_hid_dev *);
    50 typedef void (*usb_hid_driver_deinit_t)(struct usb_hid_dev *);
    51 typedef bool (*usb_hid_driver_poll)(struct usb_hid_dev *, uint8_t *, size_t);
    52 typedef int (*usb_hid_driver_poll_ended)(struct usb_hid_dev *, bool reason);
    53 
    54 // TODO: add function and class name??
    55 typedef struct usb_hid_subdriver {     
    56         /** Function to be called when initializing HID device. */
    57         usb_hid_driver_init_t init;
    58         /** Function to be called when destroying the HID device structure. */
    59         usb_hid_driver_deinit_t deinit;
    60         /** Function to be called when data arrives from the device. */
    61         usb_hid_driver_poll poll;
    62         /** Function to be called when polling ends. */
    63         usb_hid_driver_poll_ended poll_end;
    64 } usb_hid_subdriver_t;
    65 
    6647/*----------------------------------------------------------------------------*/
    6748/**
    6849 * Structure for holding general HID device data.
    6950 */
    70 typedef struct usb_hid_dev {
     51typedef struct usb_hid_dev_t {
    7152        /** Structure holding generic USB device information. */
    7253        usb_device_t *usb_dev;
     
    7859        int poll_pipe_index;
    7960       
    80         /** Subdrivers. */
    81         usb_hid_subdriver_t *subdrivers;
    82        
    83         /** Number of subdrivers. */
    84         int subdriver_count;
     61        /** Function to be called when data arrives from the device. */
     62        usb_polling_callback_t poll_callback;
    8563       
    8664        /** Report descriptor. */
     
    9573        /** Arbitrary data (e.g. a special structure for handling keyboard). */
    9674        void *data;
     75       
     76        /** Type of the device (keyboard, mouse, generic HID device). */
     77        usb_hid_iface_protocol_t device_type;
    9778} usb_hid_dev_t;
    9879
     
    11495int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
    11596
    116 bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer,
    117     size_t buffer_size, void *arg);
    118 
    11997void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason,
    12098     void *arg);
    12199
    122 const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev);
     100const char *usb_hid_get_function_name(usb_hid_iface_protocol_t device_type);
    123101
    124 const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev);
     102const char *usb_hid_get_class_name(usb_hid_iface_protocol_t device_type);
    125103
    126104void usb_hid_free(usb_hid_dev_t **hid_dev);
    127105
    128 #endif /* USB_HID_USBHID_H_ */
     106#endif /* USB_USBHID_H_ */
    129107
    130108/**
Note: See TracChangeset for help on using the changeset viewer.