Changeset e1dbcbc in mainline for uspace/lib/usb/src/hidreq.c


Ignore:
Timestamp:
2011-04-29T13:43:01Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a81a1d09
Parents:
380e0364 (diff), f19f1b7 (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.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/hidreq.c

    r380e0364 re1dbcbc  
    5656 * @retval EOK if successful.
    5757 * @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().
    6159 */
    6260int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
     
    7977         */
    8078       
    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;
    8980       
    9081        uint16_t value = 0;
     
    9788            USB_HIDREQ_SET_REPORT, value, iface_no, buffer, buf_size);
    9889
    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;
    11194        }
    11295       
     
    123106 * @retval EOK if successful.
    124107 * @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().
    128109 */
    129110int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
     
    146127         */
    147128       
    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;
    156130
    157131        usb_log_debug("Sending Set_Protocol request to the device ("
     
    162136            USB_HIDREQ_SET_PROTOCOL, protocol, iface_no, NULL, 0);
    163137
    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;
    176142        }
    177143       
     
    189155 * @retval EOK if successful.
    190156 * @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().
    194158 */
    195159int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)
     
    211175         */
    212176       
    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;
    221178
    222179        usb_log_debug("Sending Set_Idle request to the device ("
     
    229186            USB_HIDREQ_SET_IDLE, value, iface_no, NULL, 0);
    230187
    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;
    243192        }
    244193       
     
    259208 * @retval EOK if successful.
    260209 * @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().
    264211 */
    265212int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,
     
    283230         */
    284231       
    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;
    293233
    294234        uint16_t value = 0;
     
    302242            actual_size);
    303243
    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;
    316248        }
    317249       
     
    328260 * @retval EOK if successful.
    329261 * @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().
    333263 */
    334264int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
     
    351281         */
    352282       
    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;
    361284
    362285        usb_log_debug("Sending Get_Protocol request to the device ("
     
    370293            USB_HIDREQ_GET_PROTOCOL, 0, iface_no, buffer, 1, &actual_size);
    371294
    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;
    384299        }
    385300       
     
    427342         */
    428343       
    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;
    437345
    438346        usb_log_debug("Sending Get_Idle request to the device ("
     
    448356            &actual_size);
    449357
    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;
    462362        }
    463363       
Note: See TracChangeset for help on using the changeset viewer.