Changeset 378bf85 in mainline
- Timestamp:
- 2014-05-16T23:32:05Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7d68e5c7
- Parents:
- 2040d5f
- Location:
- uspace/drv/bus/usb/usbhid
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/generic/hiddev.c
r2040d5f r378bf85 49 49 #include "usbhid.h" 50 50 51 52 53 51 const usb_endpoint_description_t usb_hid_generic_poll_endpoint_description = { 54 52 .transfer_type = USB_TRANSFER_INTERRUPT, … … 61 59 62 60 const char *HID_GENERIC_FUN_NAME = "hid"; 63 const char *HID_GENERIC_C LASS_NAME= "hid";61 const char *HID_GENERIC_CATEGORY = "hid"; 64 62 65 63 … … 226 224 return true; 227 225 } 226 228 227 /** 229 228 * @} -
uspace/drv/bus/usb/usbhid/generic/hiddev.h
r2040d5f r378bf85 38 38 39 39 #include <usb/dev/driver.h> 40 41 struct usb_hid_dev; 40 #include "../usbhid.h" 42 41 43 42 extern const usb_endpoint_description_t 44 43 usb_hid_generic_poll_endpoint_description; 45 44 46 const char *HID_GENERIC_FUN_NAME;47 const char *HID_GENERIC_CLASS_NAME;45 extern const char *HID_GENERIC_FUN_NAME; 46 extern const char *HID_GENERIC_CATEGORY; 48 47 49 48 /** The USB HID generic 'hid' function softstate */ 50 49 typedef struct { 51 struct usb_hid_dev*hid_dev;50 usb_hid_dev_t *hid_dev; 52 51 } usb_hid_gen_fun_t; 53 52 54 int usb_generic_hid_init(struct usb_hid_dev *hid_dev, void **data); 55 56 void usb_generic_hid_deinit(struct usb_hid_dev *hid_dev, void *data); 57 58 bool usb_generic_hid_polling_callback(struct usb_hid_dev *hid_dev, void *data); 53 extern int usb_generic_hid_init(usb_hid_dev_t *, void **); 54 extern void usb_generic_hid_deinit(usb_hid_dev_t *, void *); 55 extern bool usb_generic_hid_polling_callback(usb_hid_dev_t *, void *); 59 56 60 57 #endif // USB_HID_HIDDDEV_H_ -
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r2040d5f r378bf85 103 103 104 104 const char *HID_KBD_FUN_NAME = "keyboard"; 105 const char *HID_KBD_CATEGORY _NAME= "keyboard";105 const char *HID_KBD_CATEGORY = "keyboard"; 106 106 107 107 static void usb_kbd_set_led(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev); … … 513 513 514 514 usb_log_debug("Adding DDF function to category %s...\n", 515 HID_KBD_C LASS_NAME);516 rc = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY _NAME);515 HID_KBD_CATEGORY); 516 rc = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY); 517 517 if (rc != EOK) { 518 518 usb_log_error( 519 519 "Could not add DDF function to category %s: %s.\n", 520 HID_KBD_C LASS_NAME, str_error(rc));520 HID_KBD_CATEGORY, str_error(rc)); 521 521 if (ddf_fun_unbind(fun) == EOK) { 522 522 ddf_fun_destroy(fun); -
uspace/drv/bus/usb/usbhid/kbd/kbddev.h
r2040d5f r378bf85 45 45 #include <usb/dev/pipes.h> 46 46 #include <usb/dev/driver.h> 47 47 #include "../usbhid.h" 48 48 #include "kbdrepeat.h" 49 50 struct usb_hid_dev;51 52 49 53 50 /** … … 65 62 typedef struct usb_kbd_t { 66 63 /** Link to HID device structure */ 67 struct usb_hid_dev*hid_dev;68 64 usb_hid_dev_t *hid_dev; 65 69 66 /** Previously pressed keys (not translated to key codes). */ 70 67 int32_t *keys_old; … … 75 72 /** Currently pressed modifiers (bitmap). */ 76 73 uint8_t modifiers; 77 74 78 75 /** Currently active modifiers including locks. Sent to the console. */ 79 unsigned mods;80 76 unsigned int mods; 77 81 78 /** Currently active lock keys. */ 82 unsigned lock_keys;83 79 unsigned int lock_keys; 80 84 81 /** IPC session to client (for sending key events). */ 85 82 async_sess_t *client_sess; 86 83 87 84 /** Information for auto-repeat of keys. */ 88 85 usb_kbd_repeat_t repeat; 89 86 90 87 /** Mutex for accessing the information about auto-repeat. */ 91 88 fibril_mutex_t repeat_mtx; 92 89 93 90 uint8_t *output_buffer; 94 91 95 92 size_t output_size; 96 93 97 94 size_t led_output_size; 98 95 99 96 usb_hid_report_path_t *led_path; 100 97 101 98 int32_t *led_data; 102 99 103 100 /** State of the structure (for checking before use). 104 * 101 * 105 102 * 0 - not initialized 106 103 * 1 - initialized … … 108 105 */ 109 106 int initialized; 110 107 111 108 /** DDF function */ 112 109 ddf_fun_t *fun; 113 110 } usb_kbd_t; 114 111 115 116 117 112 extern const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description; 118 113 119 const char *HID_KBD_FUN_NAME;120 const char *HID_KBD_CLASS_NAME;114 extern const char *HID_KBD_FUN_NAME; 115 extern const char *HID_KBD_CATEGORY; 121 116 122 123 124 int usb_kbd_init(struct usb_hid_dev *hid_dev, void **data); 125 126 bool usb_kbd_polling_callback(struct usb_hid_dev *hid_dev, void *data); 127 128 int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev); 129 130 int usb_kbd_is_ready_to_destroy(const usb_kbd_t *kbd_dev); 131 132 void usb_kbd_destroy(usb_kbd_t *kbd_dev); 133 134 void usb_kbd_push_ev(usb_kbd_t *kbd_dev, 135 int type, unsigned int key); 136 137 void usb_kbd_deinit(struct usb_hid_dev *hid_dev, void *data); 138 139 int usb_kbd_set_boot_protocol(struct usb_hid_dev *hid_dev); 117 extern int usb_kbd_init(usb_hid_dev_t *, void **); 118 extern bool usb_kbd_polling_callback(usb_hid_dev_t *, void *); 119 extern int usb_kbd_is_initialized(const usb_kbd_t *); 120 extern int usb_kbd_is_ready_to_destroy(const usb_kbd_t *); 121 extern void usb_kbd_destroy(usb_kbd_t *); 122 extern void usb_kbd_push_ev(usb_kbd_t *, int, unsigned int); 123 extern void usb_kbd_deinit(usb_hid_dev_t *, void *); 124 extern int usb_kbd_set_boot_protocol(usb_hid_dev_t *); 140 125 141 126 #endif /* USB_HID_KBDDEV_H_ */ -
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r2040d5f r378bf85 344 344 345 345 if (hid_dev == NULL) { 346 usb_log_error("Failed to init keyboardstructure: no structure"346 usb_log_error("Failed to init mouse structure: no structure" 347 347 " given.\n"); 348 348 return EINVAL; -
uspace/drv/bus/usb/usbhid/mouse/mousedev.h
r2040d5f r378bf85 39 39 #include <usb/dev/driver.h> 40 40 #include <async.h> 41 42 struct usb_hid_dev; 43 44 41 #include "../usbhid.h" 45 42 46 43 /** Container for USB mouse device. */ … … 48 45 /** IPC session to consumer. */ 49 46 async_sess_t *mouse_sess; 50 51 /* Mouse buttons statuses. */47 48 /** Mouse buttons statuses. */ 52 49 int32_t *buttons; 53 50 size_t buttons_count; 54 55 /* DDF mouse function */51 52 /** DDF mouse function */ 56 53 ddf_fun_t *mouse_fun; 57 54 } usb_mouse_t; 58 55 59 60 61 56 extern const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description; 62 57 63 const char *HID_MOUSE_FUN_NAME;64 const char *HID_MOUSE_CATEGORY;58 extern const char *HID_MOUSE_FUN_NAME; 59 extern const char *HID_MOUSE_CATEGORY; 65 60 66 67 68 int usb_mouse_init(struct usb_hid_dev *hid_dev, void **data); 69 70 bool usb_mouse_polling_callback(struct usb_hid_dev *hid_dev, void *data); 71 72 void usb_mouse_deinit(struct usb_hid_dev *hid_dev, void *data); 73 74 int usb_mouse_set_boot_protocol(struct usb_hid_dev *hid_dev); 75 76 61 extern int usb_mouse_init(usb_hid_dev_t *, void **); 62 extern bool usb_mouse_polling_callback(usb_hid_dev_t *, void *); 63 extern void usb_mouse_deinit(usb_hid_dev_t *, void *); 64 extern int usb_mouse_set_boot_protocol(usb_hid_dev_t *); 77 65 78 66 #endif // USB_HID_MOUSEDEV_H_ -
uspace/drv/bus/usb/usbhid/multimedia/multimedia.c
r2040d5f r378bf85 1 1 /* 2 * Copyright (c) 2011 Lubos Slovak, Vojtech Horky 2 * Copyright (c) 2011 Lubos Slovak 3 * Copyright (c) 2011 Vojtech Horky 3 4 * All rights reserved. 4 5 * -
uspace/drv/bus/usb/usbhid/multimedia/multimedia.h
r2040d5f r378bf85 38 38 39 39 #include <usb/dev/driver.h> 40 #include "../usbhid.h" 40 41 41 struct usb_hid_dev; 42 43 44 45 int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data); 46 47 void usb_multimedia_deinit(struct usb_hid_dev *hid_dev, void *data); 48 49 bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data); 50 51 42 extern int usb_multimedia_init(usb_hid_dev_t *, void **); 43 extern void usb_multimedia_deinit(usb_hid_dev_t *, void *); 44 extern bool usb_multimedia_polling_callback(usb_hid_dev_t *, void *); 52 45 53 46 #endif // USB_HID_MULTIMEDIA_H_ -
uspace/drv/bus/usb/usbhid/subdrivers.h
r2040d5f r378bf85 40 40 #include "kbd/kbddev.h" 41 41 42 43 44 42 typedef struct usb_hid_subdriver_usage { 45 43 int usage_page; … … 47 45 } usb_hid_subdriver_usage_t; 48 46 49 50 51 /** Structure representing the mapping between device requirements and the 47 /** Structure representing the mapping between device requirements and the 52 48 * subdriver supposed to handle this device. 53 49 * … … 55 51 * a new subdriver mapping will be created and used by the HID driver when it 56 52 * searches for appropriate subdrivers for a device. 53 * 57 54 */ 58 55 typedef struct usb_hid_subdriver_mapping { 59 /** Usage path that the device's Input reports must contain.56 /** Usage path that the device's input reports must contain. 60 57 * 61 58 * It is an array of pairs <usage_page, usage>, terminated by a <0, 0> … … 64 61 */ 65 62 const usb_hid_subdriver_usage_t *usage_path; 66 63 67 64 /** Report ID for which the path should apply. */ 68 65 int report_id; 69 70 /** Compare type for the Usage path. */66 67 /** Compare type for the usage path. */ 71 68 int compare; 72 69 73 70 /** Vendor ID (set to -1 if not specified). */ 74 71 int vendor_id; 75 72 76 73 /** Product ID (set to -1 if not specified). */ 77 74 int product_id; 78 75 79 76 /** Subdriver for controlling this device. */ 80 77 const usb_hid_subdriver_t subdriver; 81 78 } usb_hid_subdriver_mapping_t; 82 79 83 84 85 80 extern const usb_hid_subdriver_mapping_t usb_hid_subdrivers[]; 86 81 extern const size_t USB_HID_MAX_SUBDRIVERS; 87 88 89 82 90 83 #endif /* USB_HID_SUBDRIVERS_H_ */ -
uspace/drv/bus/usb/usbhid/usbhid.ma
r2040d5f r378bf85 1 100 usb&interface&class=HID&subclass=0x01&protocol=0x011 1000 usb&interface&class=HID&subclass=0x01&protocol=0x01 2 2 1000 usb&interface&class=HID&subclass=0x01&protocol=0x02 3 3 100 usb&interface&class=HID
Note:
See TracChangeset
for help on using the changeset viewer.