Changeset cc29622 in mainline for uspace/drv/bus/usb/usbhid/generic/hiddev.c
- Timestamp:
- 2011-10-14T12:40:31Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e5024111
- Parents:
- 3002434
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/generic/hiddev.c
r3002434 rcc29622 92 92 usb_log_debug2("Generic HID: Get event length (fun: %p, " 93 93 "fun->driver_data: %p.\n", fun, fun->driver_data); 94 94 95 95 if (fun == NULL || fun->driver_data == NULL) { 96 96 return 0; … … 98 98 99 99 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 100 100 101 101 usb_log_debug2("hid_dev: %p, Max input report size (%zu).\n", 102 102 hid_dev, hid_dev->max_input_report_size); 103 103 104 104 return hid_dev->max_input_report_size; 105 105 } … … 111 111 { 112 112 usb_log_debug2("Generic HID: Get event.\n"); 113 113 114 114 if (fun == NULL || fun->driver_data == NULL || buffer == NULL 115 115 || act_size == NULL || event_nr == NULL) { … … 119 119 120 120 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 121 121 122 122 if (hid_dev->input_report_size > size) { 123 123 usb_log_debug("input_report_size > size (%zu, %zu)\n", … … 125 125 return EINVAL; // TODO: other error code 126 126 } 127 127 128 128 /*! @todo This should probably be somehow atomic. */ 129 129 memcpy(buffer, hid_dev->input_report, … … 131 131 *act_size = hid_dev->input_report_size; 132 132 *event_nr = usb_hid_report_number(hid_dev); 133 133 134 134 usb_log_debug2("OK\n"); 135 135 136 136 return EOK; 137 137 } … … 142 142 { 143 143 usb_log_debug("Generic HID: Get report descriptor length.\n"); 144 144 145 145 if (fun == NULL || fun->driver_data == NULL) { 146 146 usb_log_debug("No function"); 147 147 return EINVAL; 148 148 } 149 150 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 151 149 150 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 151 152 152 usb_log_debug2("hid_dev->report_desc_size = %zu\n", 153 153 hid_dev->report_desc_size); 154 154 155 155 return hid_dev->report_desc_size; 156 156 } … … 162 162 { 163 163 usb_log_debug2("Generic HID: Get report descriptor.\n"); 164 164 165 165 if (fun == NULL || fun->driver_data == NULL) { 166 166 usb_log_debug("No function"); 167 167 return EINVAL; 168 168 } 169 170 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 171 169 170 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 171 172 172 if (hid_dev->report_desc_size > size) { 173 173 return EINVAL; 174 174 } 175 175 176 176 memcpy(desc, hid_dev->report_desc, hid_dev->report_desc_size); 177 177 *actual_size = hid_dev->report_desc_size; 178 178 179 179 return EOK; 180 180 } … … 201 201 return ENOMEM; 202 202 } 203 203 204 204 fun->ops = &usb_generic_hid_ops; 205 205 fun->driver_data = hid_dev; … … 212 212 return rc; 213 213 } 214 214 215 215 usb_log_debug("HID function created. Handle: %" PRIun "\n", fun->handle); 216 216 217 217 return EOK; 218 218 } … … 225 225 return EINVAL; 226 226 } 227 227 228 228 return usb_generic_hid_create_function(hid_dev); 229 229 }
Note:
See TracChangeset
for help on using the changeset viewer.