Changeset e50cd7f in mainline for uspace/lib/usb/src/hidreq.c
- Timestamp:
- 2011-04-17T19:17:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidreq.c
ref354b6 re50cd7f 56 56 * @retval EOK if successful. 57 57 * @retval EINVAL if no HID device is given. 58 * @return Other value inherited from one of functions 59 * usb_pipe_start_session(), usb_pipe_end_session(), 60 * usb_control_request_set(). 58 * @return Other value inherited from function usb_control_request_set(). 61 59 */ 62 60 int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no, … … 79 77 */ 80 78 81 int rc, sess_rc; 82 83 sess_rc = usb_pipe_start_session(ctrl_pipe); 84 if (sess_rc != EOK) { 85 usb_log_warning("Failed to start a session: %s.\n", 86 str_error(sess_rc)); 87 return sess_rc; 88 } 79 int rc; 89 80 90 81 uint16_t value = 0; … … 97 88 USB_HIDREQ_SET_REPORT, value, iface_no, buffer, buf_size); 98 89 99 sess_rc = usb_pipe_end_session(ctrl_pipe); 100 101 if (rc != EOK) { 102 usb_log_warning("Error sending output report to the keyboard: " 103 "%s.\n", str_error(rc)); 104 return rc; 105 } 106 107 if (sess_rc != EOK) { 108 usb_log_warning("Error closing session: %s.\n", 109 str_error(sess_rc)); 110 return sess_rc; 90 if (rc != EOK) { 91 usb_log_warning("Error sending output report to the keyboard: " 92 "%s.\n", str_error(rc)); 93 return rc; 111 94 } 112 95 … … 123 106 * @retval EOK if successful. 124 107 * @retval EINVAL if no HID device is given. 125 * @return Other value inherited from one of functions 126 * usb_pipe_start_session(), usb_pipe_end_session(), 127 * usb_control_request_set(). 108 * @return Other value inherited from function usb_control_request_set(). 128 109 */ 129 110 int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no, … … 146 127 */ 147 128 148 int rc, sess_rc; 149 150 sess_rc = usb_pipe_start_session(ctrl_pipe); 151 if (sess_rc != EOK) { 152 usb_log_warning("Failed to start a session: %s.\n", 153 str_error(sess_rc)); 154 return sess_rc; 155 } 129 int rc; 156 130 157 131 usb_log_debug("Sending Set_Protocol request to the device (" … … 162 136 USB_HIDREQ_SET_PROTOCOL, protocol, iface_no, NULL, 0); 163 137 164 sess_rc = usb_pipe_end_session(ctrl_pipe); 165 166 if (rc != EOK) { 167 usb_log_warning("Error sending output report to the keyboard: " 168 "%s.\n", str_error(rc)); 169 return rc; 170 } 171 172 if (sess_rc != EOK) { 173 usb_log_warning("Error closing session: %s.\n", 174 str_error(sess_rc)); 175 return sess_rc; 138 if (rc != EOK) { 139 usb_log_warning("Error sending output report to the keyboard: " 140 "%s.\n", str_error(rc)); 141 return rc; 176 142 } 177 143 … … 189 155 * @retval EOK if successful. 190 156 * @retval EINVAL if no HID device is given. 191 * @return Other value inherited from one of functions 192 * usb_pipe_start_session(), usb_pipe_end_session(), 193 * usb_control_request_set(). 157 * @return Other value inherited from function usb_control_request_set(). 194 158 */ 195 159 int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration) … … 211 175 */ 212 176 213 int rc, sess_rc; 214 215 sess_rc = usb_pipe_start_session(ctrl_pipe); 216 if (sess_rc != EOK) { 217 usb_log_warning("Failed to start a session: %s.\n", 218 str_error(sess_rc)); 219 return sess_rc; 220 } 177 int rc; 221 178 222 179 usb_log_debug("Sending Set_Idle request to the device (" … … 229 186 USB_HIDREQ_SET_IDLE, value, iface_no, NULL, 0); 230 187 231 sess_rc = usb_pipe_end_session(ctrl_pipe); 232 233 if (rc != EOK) { 234 usb_log_warning("Error sending output report to the keyboard: " 235 "%s.\n", str_error(rc)); 236 return rc; 237 } 238 239 if (sess_rc != EOK) { 240 usb_log_warning("Error closing session: %s.\n", 241 str_error(sess_rc)); 242 return sess_rc; 188 if (rc != EOK) { 189 usb_log_warning("Error sending output report to the keyboard: " 190 "%s.\n", str_error(rc)); 191 return rc; 243 192 } 244 193 … … 259 208 * @retval EOK if successful. 260 209 * @retval EINVAL if no HID device is given. 261 * @return Other value inherited from one of functions 262 * usb_pipe_start_session(), usb_pipe_end_session(), 263 * usb_control_request_set(). 210 * @return Other value inherited from function usb_control_request_set(). 264 211 */ 265 212 int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, … … 283 230 */ 284 231 285 int rc, sess_rc; 286 287 sess_rc = usb_pipe_start_session(ctrl_pipe); 288 if (sess_rc != EOK) { 289 usb_log_warning("Failed to start a session: %s.\n", 290 str_error(sess_rc)); 291 return sess_rc; 292 } 232 int rc; 293 233 294 234 uint16_t value = 0; … … 302 242 actual_size); 303 243 304 sess_rc = usb_pipe_end_session(ctrl_pipe); 305 306 if (rc != EOK) { 307 usb_log_warning("Error sending output report to the keyboard: " 308 "%s.\n", str_error(rc)); 309 return rc; 310 } 311 312 if (sess_rc != EOK) { 313 usb_log_warning("Error closing session: %s.\n", 314 str_error(sess_rc)); 315 return sess_rc; 244 if (rc != EOK) { 245 usb_log_warning("Error sending output report to the keyboard: " 246 "%s.\n", str_error(rc)); 247 return rc; 316 248 } 317 249 … … 328 260 * @retval EOK if successful. 329 261 * @retval EINVAL if no HID device is given. 330 * @return Other value inherited from one of functions 331 * usb_pipe_start_session(), usb_pipe_end_session(), 332 * usb_control_request_set(). 262 * @return Other value inherited from function usb_control_request_set(). 333 263 */ 334 264 int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, … … 351 281 */ 352 282 353 int rc, sess_rc; 354 355 sess_rc = usb_pipe_start_session(ctrl_pipe); 356 if (sess_rc != EOK) { 357 usb_log_warning("Failed to start a session: %s.\n", 358 str_error(sess_rc)); 359 return sess_rc; 360 } 283 int rc; 361 284 362 285 usb_log_debug("Sending Get_Protocol request to the device (" … … 370 293 USB_HIDREQ_GET_PROTOCOL, 0, iface_no, buffer, 1, &actual_size); 371 294 372 sess_rc = usb_pipe_end_session(ctrl_pipe); 373 374 if (rc != EOK) { 375 usb_log_warning("Error sending output report to the keyboard: " 376 "%s.\n", str_error(rc)); 377 return rc; 378 } 379 380 if (sess_rc != EOK) { 381 usb_log_warning("Error closing session: %s.\n", 382 str_error(sess_rc)); 383 return sess_rc; 295 if (rc != EOK) { 296 usb_log_warning("Error sending output report to the keyboard: " 297 "%s.\n", str_error(rc)); 298 return rc; 384 299 } 385 300 … … 427 342 */ 428 343 429 int rc, sess_rc; 430 431 sess_rc = usb_pipe_start_session(ctrl_pipe); 432 if (sess_rc != EOK) { 433 usb_log_warning("Failed to start a session: %s.\n", 434 str_error(sess_rc)); 435 return sess_rc; 436 } 344 int rc; 437 345 438 346 usb_log_debug("Sending Get_Idle request to the device (" … … 448 356 &actual_size); 449 357 450 sess_rc = usb_pipe_end_session(ctrl_pipe); 451 452 if (rc != EOK) { 453 usb_log_warning("Error sending output report to the keyboard: " 454 "%s.\n", str_error(rc)); 455 return rc; 456 } 457 458 if (sess_rc != EOK) { 459 usb_log_warning("Error closing session: %s.\n", 460 str_error(sess_rc)); 461 return sess_rc; 358 if (rc != EOK) { 359 usb_log_warning("Error sending output report to the keyboard: " 360 "%s.\n", str_error(rc)); 361 return rc; 462 362 } 463 363
Note:
See TracChangeset
for help on using the changeset viewer.