Skip to content

Commit d33e583

Browse files
committed
pldm-file: Fix Record Handle use in host example
The requested handle would be expected to be 0 (first of the repository), not the handle itself. Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
1 parent 851360e commit d33e583

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pldm-file/examples/host.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct Host {
1616
}
1717

1818
const FILENAME: &str = "pldm-file-host.bin";
19+
// Arbitrary, 0 is reserved.
1920
const PDR_HANDLE: u32 = 1;
2021

2122
impl Host {
@@ -146,8 +147,8 @@ fn handle_get_pdr(
146147
bail!("Extra Get PDR Request bytes");
147148
}
148149

149-
if pdr_req.record_handle != PDR_HANDLE {
150-
warn!("Wrong PDR handle");
150+
if pdr_req.record_handle != 0 {
151+
warn!("Only support first PDR Handle");
151152
return Ok(plat_codes::INVALID_RECORD_HANDLE);
152153
}
153154
if pdr_req.data_transfer_handle != 0 {
@@ -178,7 +179,7 @@ fn handle_get_pdr(
178179
let file_name = pldm_platform::Vec::from_slice(&file_name).unwrap();
179180

180181
let pdr_resp = GetPDRResp::new_single(
181-
pdr_req.record_handle,
182+
PDR_HANDLE,
182183
PdrRecord::FileDescriptor(FileDescriptorPdr {
183184
terminus_handle: 0,
184185
file_identifier: 0,

0 commit comments

Comments
 (0)