Changes in uspace/drv/usbhid/usbhid.h [62bd8d3:dd10e07] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/usbhid.h
r62bd8d3 rdd10e07 34 34 */ 35 35 36 #ifndef USB_ HID_USBHID_H_37 #define USB_ HID_USBHID_H_36 #ifndef USB_USBHID_H_ 37 #define USB_USBHID_H_ 38 38 39 39 #include <stdint.h> … … 45 45 #include <usb/classes/hid.h> 46 46 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 66 47 /*----------------------------------------------------------------------------*/ 67 48 /** 68 49 * Structure for holding general HID device data. 69 50 */ 70 typedef struct usb_hid_dev {51 typedef struct usb_hid_dev_t { 71 52 /** Structure holding generic USB device information. */ 72 53 usb_device_t *usb_dev; … … 78 59 int poll_pipe_index; 79 60 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; 85 63 86 64 /** Report descriptor. */ … … 95 73 /** Arbitrary data (e.g. a special structure for handling keyboard). */ 96 74 void *data; 75 76 /** Type of the device (keyboard, mouse, generic HID device). */ 77 usb_hid_iface_protocol_t device_type; 97 78 } usb_hid_dev_t; 98 79 … … 114 95 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev); 115 96 116 bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer,117 size_t buffer_size, void *arg);118 119 97 void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 120 98 void *arg); 121 99 122 const char *usb_hid_get_function_name( const usb_hid_dev_t *hid_dev);100 const char *usb_hid_get_function_name(usb_hid_iface_protocol_t device_type); 123 101 124 const char *usb_hid_get_class_name( const usb_hid_dev_t *hid_dev);102 const char *usb_hid_get_class_name(usb_hid_iface_protocol_t device_type); 125 103 126 104 void usb_hid_free(usb_hid_dev_t **hid_dev); 127 105 128 #endif /* USB_ HID_USBHID_H_ */106 #endif /* USB_USBHID_H_ */ 129 107 130 108 /**
Note:
See TracChangeset
for help on using the changeset viewer.