Skip to content

Commit 50d3f1a

Browse files
committed
uefi: Implement USB getters and sync transfers
1 parent 0df29bb commit 50d3f1a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

uefi/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Added `proto::scsi::pass_thru::ExtScsiPassThru`.
1212
- Added `proto::nvme::pass_thru::NvmePassThru`.
1313
- Added `proto::ata::pass_thru::AtaPassThru`.
14+
- Added `proto::usb::io::UsbIo`.
1415
- Added `boot::ScopedProtocol::open_params()`.
1516
- Added `boot::TplGuard::old_tpl()`.
1617

@@ -39,7 +40,7 @@
3940
- The `Display` impl for `CStr8` now excludes the trailing null character.
4041
- `VariableKeys` initializes with a larger name buffer to work around firmware
4142
bugs on some devices.
42-
- The UEFI `allocator::Allocator` has been optimized for page-aligned
43+
- The UEFI `allocator::Allocator` has been optimized for page-aligned
4344
allocations.
4445

4546

uefi/src/proto/usb/io.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
use core::ffi;
66

77
use uefi_macros::unsafe_protocol;
8-
use uefi_raw::protocol::usb::io::{DataDirection, DeviceRequest, UsbIoProtocol, UsbTransferStatus};
8+
use uefi_raw::protocol::usb::io::UsbIoProtocol;
9+
use uefi_raw::protocol::usb::{
10+
ConfigDescriptor, DataDirection, DeviceDescriptor, DeviceRequest, EndpointDescriptor,
11+
InterfaceDescriptor, UsbTransferStatus,
12+
};
913

1014
use crate::data_types::PoolString;
1115
use crate::{Char16, Result, StatusExt};
1216

13-
pub use uefi_raw::protocol::usb::io::{
14-
ConfigDescriptor, DeviceDescriptor, EndpointDescriptor, InterfaceDescriptor,
15-
};
16-
1717
/// USB I/O protocol.
1818
#[derive(Debug)]
1919
#[repr(transparent)]
@@ -45,6 +45,14 @@ impl UsbIo {
4545
),
4646
};
4747

48+
let request_type = if direction == DataDirection::DATA_IN {
49+
request_type | 0x80
50+
} else if direction == DataDirection::DATA_OUT {
51+
request_type & !0x80
52+
} else {
53+
request_type
54+
};
55+
4856
let mut device_request = DeviceRequest {
4957
request_type,
5058
request,

0 commit comments

Comments
 (0)