Changeset c69209d in mainline
- Timestamp:
- 2011-03-14T10:49:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 15d3b54, 9370884
- Parents:
- 189cd4e (diff), 206f71a (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. - Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/info.c
r189cd4e rc69209d 65 65 goto leave; 66 66 } 67 rc = usb_endpoint_pipe_probe_default_control(&ctrl_pipe); 68 if (rc != EOK) { 69 fprintf(stderr, 70 NAME ": probing default control pipe failed: %s.\n", 71 str_error(rc)); 72 goto leave; 73 } 67 74 rc = usb_endpoint_pipe_start_session(&ctrl_pipe); 68 75 if (rc != EOK) { -
uspace/app/usbinfo/main.c
r189cd4e rc69209d 82 82 83 83 if (str_cmp(path, "uhci") == 0) { 84 path = "/hw/pci0/00:01.2/uhci ";84 path = "/hw/pci0/00:01.2/uhci-hc"; 85 85 } 86 86 -
uspace/drv/usbhid/hiddev.c
r189cd4e rc69209d 391 391 return rc; 392 392 } 393 rc = usb_endpoint_pipe_probe_default_control(&hid_dev->ctrl_pipe); 394 if (rc != EOK) { 395 usb_log_error("Probing default control pipe failed: %s.\n", 396 str_error(rc)); 397 return rc; 398 } 393 399 394 400 /* -
uspace/drv/usbhub/usbhub.c
r189cd4e rc69209d 118 118 dprintf(USB_LOG_LEVEL_ERROR, 119 119 "could not initialize connection to device endpoint, errno %d",opResult); 120 } 121 return opResult; 120 return opResult; 121 } 122 123 opResult = usb_endpoint_pipe_probe_default_control(&hub->endpoints.control); 124 if (opResult != EOK) { 125 dprintf(USB_LOG_LEVEL_ERROR, "failed probing endpoint 0, %d", opResult); 126 return opResult; 127 } 128 129 return EOK; 122 130 } 123 131 … … 430 438 &new_device_pipe, 431 439 &new_device_connection); 440 usb_endpoint_pipe_probe_default_control(&new_device_pipe); 432 441 /// \TODO get highspeed info 433 442 usb_speed_t speed = isLowSpeed?USB_SPEED_LOW:USB_SPEED_FULL; -
uspace/drv/usbmid/usbmid.c
r189cd4e rc69209d 116 116 return NULL; 117 117 } 118 rc = usb_endpoint_pipe_probe_default_control(&mid->ctrl_pipe); 119 if (rc != EOK) { 120 usb_log_error("Probing default control pipe failed: %s.\n", 121 str_error(rc)); 122 free(mid); 123 return NULL; 124 } 118 125 119 126 mid->dev = dev; -
uspace/lib/usb/include/usb/pipes.h
r189cd4e rc69209d 129 129 int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *, 130 130 usb_device_connection_t *); 131 int usb_endpoint_pipe_probe_default_control(usb_endpoint_pipe_t *); 131 132 int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 132 133 size_t, uint8_t *, size_t, usb_device_connection_t *); -
uspace/lib/usb/src/devdrv.c
r189cd4e rc69209d 228 228 } 229 229 230 rc = usb_endpoint_pipe_probe_default_control(&dev->ctrl_pipe); 231 if (rc != EOK) { 232 usb_log_error( 233 "Probing default control pipe on device `%s' failed: %s.\n", 234 dev->ddf_dev->name, str_error(rc)); 235 return rc; 236 } 237 230 238 /* 231 239 * Initialization of other pipes requires open session on -
uspace/lib/usb/src/hub.c
r189cd4e rc69209d 235 235 goto leave_release_default_address; 236 236 } 237 rc = usb_endpoint_pipe_probe_default_control(&ctrl_pipe); 238 if (rc != EOK) { 239 rc = ENOTCONN; 240 goto leave_release_default_address; 241 } 237 242 238 243 rc = usb_endpoint_pipe_start_session(&ctrl_pipe); -
uspace/lib/usb/src/pipesinit.c
r189cd4e rc69209d 41 41 #include <errno.h> 42 42 #include <assert.h> 43 44 #define CTRL_PIPE_MIN_PACKET_SIZE 8 45 #define DEV_DESCR_MAX_PACKET_SIZE_OFFSET 7 43 46 44 47 … … 371 374 372 375 int rc = usb_endpoint_pipe_initialize(pipe, connection, 373 0, USB_TRANSFER_CONTROL, 8, USB_DIRECTION_BOTH); 376 0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE, 377 USB_DIRECTION_BOTH); 378 379 return rc; 380 } 381 382 /** Probe default control pipe for max packet size. 383 * 384 * The function tries to get the correct value of max packet size several 385 * time before giving up. 386 * 387 * The session on the pipe shall not be started. 388 * 389 * @param pipe Default control pipe. 390 * @return Error code. 391 */ 392 int usb_endpoint_pipe_probe_default_control(usb_endpoint_pipe_t *pipe) 393 { 394 assert(pipe); 395 assert(DEV_DESCR_MAX_PACKET_SIZE_OFFSET < CTRL_PIPE_MIN_PACKET_SIZE); 396 397 if ((pipe->direction != USB_DIRECTION_BOTH) || 398 (pipe->transfer_type != USB_TRANSFER_CONTROL) || 399 (pipe->endpoint_no != 0)) { 400 return EINVAL; 401 } 402 403 #define TRY_LOOP(attempt_var) \ 404 for (attempt_var = 0; attempt_var < 3; attempt_var++) 405 406 size_t failed_attempts; 407 int rc; 408 409 TRY_LOOP(failed_attempts) { 410 rc = usb_endpoint_pipe_start_session(pipe); 411 if (rc == EOK) { 412 break; 413 } 414 } 374 415 if (rc != EOK) { 375 416 return rc; 376 417 } 377 rc = usb_endpoint_pipe_start_session(pipe); 418 419 420 uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE]; 421 size_t transferred_size; 422 TRY_LOOP(failed_attempts) { 423 rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD, 424 USB_REQUEST_RECIPIENT_DEVICE, USB_DESCTYPE_DEVICE, 425 0, 0, dev_descr_start, CTRL_PIPE_MIN_PACKET_SIZE, 426 &transferred_size); 427 if (rc == EOK) { 428 if (transferred_size != CTRL_PIPE_MIN_PACKET_SIZE) { 429 rc = ELIMIT; 430 continue; 431 } 432 break; 433 } 434 } 435 usb_endpoint_pipe_end_session(pipe); 378 436 if (rc != EOK) { 379 437 return rc; 380 438 } 381 439 382 uint8_t first[8]; 383 size_t size = 0; 384 rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD, 385 USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR, 1 << 8, 386 0, first, 8, &size); 387 usb_endpoint_pipe_end_session(pipe); 388 if (rc != EOK || size != 8) { 389 return rc; 390 } 391 392 pipe->max_packet_size = first[7]; 393 return rc; 440 pipe->max_packet_size 441 = dev_descr_start[DEV_DESCR_MAX_PACKET_SIZE_OFFSET]; 442 443 return EOK; 394 444 } 395 445 -
uspace/lib/usb/src/recognise.c
r189cd4e rc69209d 369 369 goto failure; 370 370 } 371 rc = usb_endpoint_pipe_probe_default_control(&ctrl_pipe); 372 if (rc != EOK) { 373 goto failure; 374 } 371 375 372 376 /*
Note:
See TracChangeset
for help on using the changeset viewer.