Changeset 61257f4 in mainline for uspace/drv/usbhid/usbhid.h
- Timestamp:
- 2011-04-07T20:19:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f8e8738
- Parents:
- fd9ba204
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/usbhid.h
rfd9ba204 r61257f4 42 42 43 43 //#include <usb/classes/hid.h> 44 //#include <usb/classes/hidparser.h>44 #include <usb/classes/hidparser.h> 45 45 #include <ddf/driver.h> 46 46 #include <usb/pipes.h> 47 47 #include <usb/devdrv.h> 48 #include <usb/classes/hid.h> 48 49 49 50 /*----------------------------------------------------------------------------*/ 50 ///** 51 // * USB/HID keyboard device type. 52 // * 53 // * Holds a reference to generic USB/HID device structure and keyboard-specific 54 // * data, such as currently pressed keys, modifiers and lock keys. 55 // * 56 // * Also holds a IPC phone to the console (since there is now no other way to 57 // * communicate with it). 58 // * 59 // * @note Storing active lock keys in this structure results in their setting 60 // * being device-specific. 61 // */ 62 //typedef struct usb_kbd_t { 63 // /** Structure holding generic USB device information. */ 64 // //usbhid_dev_t *hid_dev; 65 // usb_device_t *usb_dev; 51 /** 52 * Structure for holding general HID device data. 53 */ 54 typedef struct usb_hid_dev_t { 55 /** Structure holding generic USB device information. */ 56 usb_device_t *usb_dev; 66 57 67 // /** Currently pressed keys (not translated to key codes). */ 68 // uint8_t *keys; 69 // /** Count of stored keys (i.e. number of keys in the report). */ 70 // size_t key_count; 71 // /** Currently pressed modifiers (bitmap). */ 72 // uint8_t modifiers; 58 /** @todo What is this actually? */ 59 ddf_dev_ops_t ops; 73 60 74 // /** Currently active modifiers including locks. Sent to the console. */75 // unsigned mods;61 /** Index of the polling pipe in usb_hid_endpoints array. */ 62 int poll_pipe_index; 76 63 77 // /** Currently active lock keys. */78 // unsigned lock_keys;64 /** Function to be called when data arrives from the device. */ 65 usb_polling_callback_t poll_callback; 79 66 80 // /** IPC phone to the console device (for sending key events). */ 81 // int console_phone; 67 /** Report descriptor. */ 68 uint8_t *report_desc; 69 70 /** Report descriptor size. */ 71 size_t report_desc_size; 82 72 83 // /** Information for auto-repeat of keys. */84 // usb_kbd_repeat_t repeat;73 /** HID Report parser. */ 74 usb_hid_report_parser_t *parser; 85 75 86 // /** Mutex for accessing the information about auto-repeat. */87 // fibril_mutex_t *repeat_mtx;76 /** Arbitrary data (e.g. a special structure for handling keyboard). */ 77 void *data; 88 78 89 // /** Report descriptor. */ 90 // uint8_t *report_desc; 91 92 // /** Report descriptor size. */ 93 // size_t report_desc_size; 94 95 // uint8_t *output_buffer; 96 97 // size_t output_size; 98 99 // size_t led_output_size; 100 101 // usb_hid_report_path_t *led_path; 102 103 // int32_t *led_data; 104 105 // /** HID Report parser. */ 106 // usb_hid_report_parser_t *parser; 107 108 // /** State of the structure (for checking before use). 109 // * 110 // * 0 - not initialized 111 // * 1 - initialized 112 // * -1 - ready for destroying 113 // */ 114 // int initialized; 115 //} usb_kbd_t; 79 /** Type of the device (keyboard, mouse, generic HID device). */ 80 usb_hid_iface_protocol_t device_type; 81 } usb_hid_dev_t; 116 82 117 83 /*----------------------------------------------------------------------------*/ 118 84 119 85 enum { 120 USB_HID_POLL_EP_NO = 0, 121 USB_HID_POLL_EP_COUNT = 1 86 USB_HID_KBD_POLL_EP_NO = 0, 87 USB_HID_MOUSE_POLL_EP_NO = 1, 88 USB_HID_GENERIC_POLL_EP_NO = 2, 89 USB_HID_POLL_EP_COUNT = 3 122 90 }; 123 91 124 92 usb_endpoint_description_t *usb_hid_endpoints[USB_HID_POLL_EP_COUNT + 1]; 125 93 126 ddf_dev_ops_t hid_ops;127 128 94 /*----------------------------------------------------------------------------*/ 129 95 130 bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer, 131 size_t buffer_size, void *arg); 96 usb_hid_dev_t *usb_hid_new(void); 132 97 133 void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 98 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev); 99 100 void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 134 101 void *arg); 135 102 136 #endif /* USB_KBDDEV_H_ */ 103 const char *usb_hid_get_function_name(usb_hid_iface_protocol_t device_type); 104 105 const char *usb_hid_get_class_name(usb_hid_iface_protocol_t device_type); 106 107 /** @todo Maybe not needed in the API. */ 108 void usb_hid_free(usb_hid_dev_t **hid_dev); 109 110 #endif /* USB_USBHID_H_ */ 137 111 138 112 /**
Note:
See TracChangeset
for help on using the changeset viewer.