Changes in uspace/drv/usbhid/hidreq.c [dde8ca4:2391aaf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/hidreq.c
rdde8ca4 r2391aaf 143 143 /*----------------------------------------------------------------------------*/ 144 144 145 int usbhid_req_set_idle(usbhid_dev_t *hid_dev, uint8_t duration)146 {147 if (hid_dev == NULL) {148 usb_log_error("usbhid_req_set_idle(): no HID device "149 "structure given.\n");150 return EINVAL;151 }152 153 /*154 * No need for checking other parameters, as they are checked in155 * the called function (usb_control_request_set()).156 */157 158 int rc, sess_rc;159 160 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe);161 if (sess_rc != EOK) {162 usb_log_warning("Failed to start a session: %s.\n",163 str_error(sess_rc));164 return sess_rc;165 }166 167 usb_log_debug("Sending Set_Idle request to the device ("168 "duration: %u, iface: %d).\n", duration, hid_dev->iface);169 170 uint16_t value = duration << 8;171 172 rc = usb_control_request_set(&hid_dev->ctrl_pipe,173 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,174 USB_HIDREQ_SET_IDLE, value, hid_dev->iface, NULL, 0);175 176 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe);177 178 if (rc != EOK) {179 usb_log_warning("Error sending output report to the keyboard: "180 "%s.\n", str_error(rc));181 return rc;182 }183 184 if (sess_rc != EOK) {185 usb_log_warning("Error closing session: %s.\n",186 str_error(sess_rc));187 return sess_rc;188 }189 190 return EOK;191 }192 193 /*----------------------------------------------------------------------------*/194 195 145 /** 196 146 * @}
Note:
See TracChangeset
for help on using the changeset viewer.