Lines Matching refs:command

270 	usb_raw_command *command = (usb_raw_command *)buffer;
271 if (length < sizeof(command->version.status))
274 command->version.status = B_USB_RAW_STATUS_ABORTED;
279 command->version.status = B_USB_RAW_PROTOCOL_VERSION;
285 if (length < sizeof(command->device))
293 if (user_memcpy(command->device.descriptor, deviceDescriptor,
298 command->device.status = B_USB_RAW_STATUS_SUCCESS;
304 if (length < sizeof(command->config))
308 usb_raw_get_configuration(device, command->config.config_index,
309 &command->config.status);
313 if (user_memcpy(command->config.descriptor,
319 command->config.status = B_USB_RAW_STATUS_SUCCESS;
326 if (length < sizeof(command->alternate))
331 command->alternate.config_index,
332 &command->alternate.status);
336 if (command->alternate.interface_index
338 command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE;
344 command->alternate.interface_index];
346 command->alternate.alternate_info = interfaceList->alt_count;
350 command->alternate.alternate_info = i;
356 command->alternate.status = B_USB_RAW_STATUS_SUCCESS;
365 if (length < sizeof(command->interface))
369 command->interface.config_index,
370 command->interface.interface_index,
372 &command->interface.status);
374 if (length < sizeof(command->interface_etc))
378 command->interface_etc.config_index,
379 command->interface_etc.interface_index,
380 command->interface_etc.alternate_index,
381 &command->interface_etc.status);
387 if (user_memcpy(command->interface.descriptor, interfaceInfo->descr,
392 command->interface.status = B_USB_RAW_STATUS_SUCCESS;
402 if (length < sizeof(command->endpoint))
406 command->endpoint.config_index,
407 command->endpoint.interface_index,
409 &command->endpoint.status);
410 endpointIndex = command->endpoint.endpoint_index;
412 if (length < sizeof(command->endpoint_etc))
416 command->endpoint_etc.config_index,
417 command->endpoint_etc.interface_index,
418 command->endpoint_etc.alternate_index,
419 &command->endpoint_etc.status);
420 endpointIndex = command->endpoint_etc.endpoint_index;
427 command->endpoint.status = B_USB_RAW_STATUS_INVALID_ENDPOINT;
431 if (user_memcpy(command->endpoint.descriptor,
437 command->endpoint.status = B_USB_RAW_STATUS_SUCCESS;
448 if (length < sizeof(command->generic))
452 command->generic.config_index,
453 command->generic.interface_index,
455 &command->generic.status);
456 genericIndex = command->generic.generic_index;
457 genericLength = command->generic.length;
459 if (length < sizeof(command->generic_etc))
463 command->generic_etc.config_index,
464 command->generic_etc.interface_index,
465 command->generic_etc.alternate_index,
466 &command->generic_etc.status);
467 genericIndex = command->generic_etc.generic_index;
468 genericLength = command->generic_etc.length;
475 command->endpoint.status = B_USB_RAW_STATUS_INVALID_ENDPOINT;
483 if (user_memcpy(command->generic.descriptor, descriptor,
489 command->generic.status = B_USB_RAW_STATUS_NO_MEMORY;
491 command->generic.status = B_USB_RAW_STATUS_SUCCESS;
497 if (length < sizeof(command->string))
504 USB_DESCRIPTOR_STRING, command->string.string_index, 0,
508 command->string.status = B_USB_RAW_STATUS_ABORTED;
509 command->string.length = 0;
513 uint8 stringLength = MIN(firstTwoBytes[0], command->string.length);
516 command->string.status = B_USB_RAW_STATUS_ABORTED;
517 command->string.length = 0;
522 USB_DESCRIPTOR_STRING, command->string.string_index, 0,
525 command->string.status = B_USB_RAW_STATUS_ABORTED;
526 command->string.length = 0;
531 if (user_memcpy(command->string.descriptor, string,
536 command->string.status = B_USB_RAW_STATUS_SUCCESS;
537 command->string.length = stringLength;
544 if (length < sizeof(command->descriptor))
551 command->descriptor.type, command->descriptor.index,
552 command->descriptor.language_id, firstTwoBytes, 2,
555 || firstTwoBytes[1] != command->descriptor.type) {
556 command->descriptor.status = B_USB_RAW_STATUS_ABORTED;
557 command->descriptor.length = 0;
562 command->descriptor.length);
565 command->descriptor.status = B_USB_RAW_STATUS_ABORTED;
566 command->descriptor.length = 0;
571 command->descriptor.type, command->descriptor.index,
572 command->descriptor.language_id, descriptorBuffer,
575 command->descriptor.status = B_USB_RAW_STATUS_ABORTED;
576 command->descriptor.length = 0;
581 if (user_memcpy(command->descriptor.data, descriptorBuffer,
586 command->descriptor.status = B_USB_RAW_STATUS_SUCCESS;
587 command->descriptor.length = descriptorLength;
594 if (length < sizeof(command->config))
598 usb_raw_get_configuration(device, command->config.config_index,
599 &command->config.status);
605 command->config.status = B_USB_RAW_STATUS_FAILED;
609 command->config.status = B_USB_RAW_STATUS_SUCCESS;
615 if (length < sizeof(command->alternate))
620 command->alternate.config_index,
621 &command->alternate.status);
625 if (command->alternate.interface_index
627 command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE;
632 &configurationInfo->interface[command->alternate.interface_index];
633 if (command->alternate.alternate_info >= interfaceList->alt_count) {
634 command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE;
639 &interfaceList->alt[command->alternate.alternate_info]) < B_OK) {
640 command->alternate.status = B_USB_RAW_STATUS_FAILED;
644 command->alternate.status = B_USB_RAW_STATUS_SUCCESS;
650 if (length < sizeof(command->control))
655 command->control.request_type, command->control.request,
656 command->control.value, command->control.index,
657 command->control.length, command->control.data,
659 command->control.status = B_USB_RAW_STATUS_FAILED;
660 command->control.length = 0;
666 command->control.status = device->status;
667 command->control.length = device->actual_length;
676 if (length < sizeof(command->transfer))
682 command->transfer.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION;
686 if (command->transfer.interface >= configurationInfo->interface_count) {
687 command->transfer.status = B_USB_RAW_STATUS_INVALID_INTERFACE;
692 configurationInfo->interface[command->transfer.interface].active;
694 command->transfer.status = B_USB_RAW_STATUS_ABORTED;
698 if (command->transfer.endpoint >= interfaceInfo->endpoint_count) {
699 command->transfer.status = B_USB_RAW_STATUS_INVALID_ENDPOINT;
704 &interfaceInfo->endpoint[command->transfer.endpoint];
706 command->transfer.status = B_USB_RAW_STATUS_INVALID_ENDPOINT;
713 if (length < sizeof(command->isochronous))
717 * command->isochronous.packet_count;
721 command->transfer.status = B_USB_RAW_STATUS_NO_MEMORY;
722 command->transfer.length = 0;
727 command->isochronous.packet_descriptors,
737 command->transfer.data, command->transfer.length,
741 command->transfer.data, command->transfer.length,
745 command->isochronous.data, command->isochronous.length,
746 packetDescriptors, command->isochronous.packet_count, NULL,
751 command->transfer.status = B_USB_RAW_STATUS_FAILED;
752 command->transfer.length = 0;
759 command->transfer.status = device->status;
760 command->transfer.length = device->actual_length;
764 if (user_memcpy(command->isochronous.packet_descriptors,