Changeset e3b5129 in mainline
- Timestamp:
- 2011-04-12T19:00:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 11d2e96a, c7dd69d
- Parents:
- a6610d4
- Location:
- uspace/drv/usbhid
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/Makefile
ra6610d4 re3b5129 46 46 generic/hiddev.c \ 47 47 mouse/mousedev.c \ 48 lgtch-ultrax/lgtch-ultrax.c \ 48 49 $(STOLEN_LAYOUT_SOURCES) 49 50 -
uspace/drv/usbhid/subdrivers.c
ra6610d4 re3b5129 37 37 #include "usb/classes/hidut.h" 38 38 39 #include "lgtch-ultrax/lgtch-ultrax.h" 40 39 41 static usb_hid_subdriver_usage_t path_kbd[] = { 40 42 {USB_HIDUT_PAGE_KEYBOARD, 0}, 43 {0, 0} 44 }; 45 46 static usb_hid_subdriver_usage_t lgtch_path[] = { 47 {0xc, 0}, 41 48 {0, 0} 42 49 }; … … 45 52 { 46 53 path_kbd, 54 -1, 47 55 USB_HID_PATH_COMPARE_END 48 56 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, … … 57 65 58 66 }, 59 {NULL, 0, 0, 0, {NULL, NULL, NULL, NULL}} 67 { 68 lgtch_path, 69 1, 70 USB_HID_PATH_COMPARE_END 71 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 72 0x046d, 73 0xc30e, 74 { 75 .init = NULL, 76 .deinit = NULL, 77 .poll = usb_lgtch_polling_callback, 78 .poll_end = NULL 79 } 80 }, 81 {NULL, -1, 0, 0, 0, {NULL, NULL, NULL, NULL}} 60 82 }; 61 83 -
uspace/drv/usbhid/subdrivers.h
ra6610d4 re3b5129 54 54 typedef struct usb_hid_subdriver_mapping { 55 55 const usb_hid_subdriver_usage_t *usage_path; 56 int report_id; 56 57 int compare; 57 58 uint16_t vendor_id; -
uspace/drv/usbhid/usbhid.c
ra6610d4 re3b5129 164 164 165 165 static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev, 166 const usb_hid_subdriver_ usage_t *path, int compare)166 const usb_hid_subdriver_mapping_t *mapping) 167 167 { 168 168 assert(hid_dev != NULL); 169 assert( path!= NULL);169 assert(mapping != NULL); 170 170 171 171 usb_hid_report_path_t *usage_path = usb_hid_report_path(); … … 175 175 } 176 176 int i = 0; 177 while (path[i].usage != 0 || path[i].usage_page != 0) { 177 while (mapping->usage_path[i].usage != 0 178 || mapping->usage_path[i].usage_page != 0) { 178 179 if (usb_hid_report_path_append_item(usage_path, 179 path[i].usage_page, path[i].usage) != EOK) { 180 mapping->usage_path[i].usage_page, 181 mapping->usage_path[i].usage) != EOK) { 180 182 usb_log_debug("Failed to append to usage path.\n"); 181 183 usb_hid_report_path_free(usage_path); … … 185 187 } 186 188 189 if (mapping->report_id >= 0) { 190 usb_hid_report_path_set_report_id(usage_path, 191 mapping->report_id); 192 } 193 187 194 assert(hid_dev->parser != NULL); 188 195 189 usb_log_debug("Compare flags: %d\n", compare);196 usb_log_debug("Compare flags: %d\n", mapping->compare); 190 197 size_t size = usb_hid_report_input_length(hid_dev->parser, usage_path, 191 compare);198 mapping->compare); 192 199 usb_log_debug("Size of the input report: %d\n", size); 193 200 … … 273 280 if (mapping->usage_path != NULL) { 274 281 usb_log_debug("Comparing device against usage path.\n"); 275 if (usb_hid_path_matches(hid_dev, 276 mapping->usage_path, mapping->compare)) { 282 if (usb_hid_path_matches(hid_dev, mapping)) { 277 283 // does not matter if IDs were matched 278 284 matched = true;
Note:
See TracChangeset
for help on using the changeset viewer.