Changeset dde8ca4 in mainline
- Timestamp:
- 2011-03-05T11:35:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7ac73a4
- Parents:
- 0e164ed
- Location:
- uspace/drv/usbhid
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/hidreq.c
r0e164ed rdde8ca4 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 in 155 * 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 145 195 /** 146 196 * @} -
uspace/drv/usbhid/hidreq.h
r0e164ed rdde8ca4 50 50 int usbhid_req_set_protocol(usbhid_dev_t *hid_dev, usb_hid_protocol_t protocol); 51 51 52 int usbhid_req_set_idle(usbhid_dev_t *hid_dev, uint8_t duration); 53 52 54 /*----------------------------------------------------------------------------*/ 53 55
Note:
See TracChangeset
for help on using the changeset viewer.