Changeset b3433a2 in mainline
- Timestamp:
- 2011-09-23T10:17:25Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bba0f1fc
- Parents:
- 8d3cd30
- Location:
- uspace/drv/bus/usb/usbhub
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port_status.h
r8d3cd30 rb3433a2 69 69 70 70 /** 71 * set values in request to be it a port status request72 * @param request73 * @param port74 */75 static inline void usb_hub_set_port_status_request(76 usb_device_request_setup_packet_t *request, uint16_t port)77 {78 request->index = port;79 request->request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS;80 request->request = USB_HUB_REQUEST_GET_STATUS;81 request->value = 0;82 request->length = 4;83 }84 85 /**86 * create request for usb hub port status87 * @param port88 * @return89 */90 static inline usb_device_request_setup_packet_t *91 usb_hub_create_port_status_request(uint16_t port)92 {93 usb_device_request_setup_packet_t *result =94 malloc(sizeof(usb_device_request_setup_packet_t));95 usb_hub_set_port_status_request(result, port);96 return result;97 }98 99 /**100 71 * set the device request to be a port feature enable request 101 72 * @param request -
uspace/drv/bus/usb/usbhub/ports.c
r8d3cd30 rb3433a2 98 98 { 99 99 usb_log_debug("Interrupt at port %zu\n", (size_t) port); 100 //determine type of change101 //usb_pipe_t *pipe = hub->control_pipe;102 103 int opResult;104 100 105 101 usb_port_status_t status; 106 opResult = get_port_status(&hub->usb_device->ctrl_pipe, port, &status); 102 const int opResult = 103 get_port_status(&hub->usb_device->ctrl_pipe, port, &status); 107 104 if (opResult != EOK) { 108 105 usb_log_error("Failed to get port %zu status: %s.\n", … … 119 116 120 117 if (device_connected) { 121 opResult = create_add_device_fibril(hub, port,118 const int opResult = create_add_device_fibril(hub, port, 122 119 usb_port_speed(status)); 123 120 if (opResult != EOK) { … … 300 297 */ 301 298 static int get_port_status(usb_pipe_t *ctrl_pipe, size_t port, 302 usb_port_status_t *status) { 299 usb_port_status_t *status) 300 { 303 301 size_t recv_size; 304 usb_device_request_setup_packet_t request;305 302 usb_port_status_t status_tmp; 306 307 usb_hub_set_port_status_request(&request, port); 308 int rc = usb_pipe_control_read(ctrl_pipe, 309 &request, sizeof (usb_device_request_setup_packet_t), 310 &status_tmp, sizeof (status_tmp), &recv_size); 303 /* USB hub specific GET_PORT_STATUS request. See USB Spec 11.16.2.6 */ 304 const usb_device_request_setup_packet_t request = { 305 .request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS, 306 .request = USB_HUB_REQUEST_GET_STATUS, 307 .value = 0, 308 .index = port, 309 .length = sizeof(usb_port_status_t), 310 }; 311 312 const int rc = usb_pipe_control_read(ctrl_pipe, 313 &request, sizeof(usb_device_request_setup_packet_t), 314 &status_tmp, sizeof(status_tmp), &recv_size); 311 315 if (rc != EOK) { 312 316 return rc; -
uspace/drv/bus/usb/usbhub/usbhub.c
r8d3cd30 rb3433a2 234 234 * @return error code 235 235 */ 236 int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info)236 static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info) 237 237 { 238 238 assert(hub_info); -
uspace/drv/bus/usb/usbhub/utils.h
r8d3cd30 rb3433a2 55 55 // 56 56 //************ 57 58 59 usb_hub_info_t * usb_create_hub_info(ddf_dev_t * device);60 57 61 58 /**
Note:
See TracChangeset
for help on using the changeset viewer.