Skip to content

Commit

Permalink
Repo File Sync: .sync/rust_config/rustfmt.toml: Use Rust default of 4…
Browse files Browse the repository at this point in the history
… space indentation (#526)

## Description

Format only. `rustfmt.toml` now defaults to tab_spaces to 4 (earlier 2).
No functional changes.

- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

## How This Was Tested

No functional change.

## Integration Instructions

N/A

---

synced local file(s) with
[microsoft/mu_devops](https://github.com/microsoft/mu_devops).

🤖: View the [Repo File Sync Configuration
File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml)
to see how files are synced.

---

This PR was created automatically by the
[repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action)
workflow run
[#10037882152](https://github.com/microsoft/mu_devops/actions/runs/10037882152)

---------

Signed-off-by: Project Mu UEFI Bot <[email protected]>
Signed-off-by: Vineel Kovvuri <[email protected]>
Co-authored-by: Vineel Kovvuri <[email protected]>
  • Loading branch information
uefibot and vineelko authored Jul 22, 2024
1 parent 03a5ef7 commit 9467126
Show file tree
Hide file tree
Showing 24 changed files with 8,575 additions and 8,493 deletions.
382 changes: 191 additions & 191 deletions AdvLoggerPkg/Crates/RustAdvancedLoggerDxe/src/lib.rs

Large diffs are not rendered by default.

266 changes: 133 additions & 133 deletions HidPkg/Crates/HidIo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,147 +8,147 @@
#![no_std]

pub mod protocol {
use core::ffi::c_void;
use core::ffi::c_void;

use r_efi::efi::{Guid, Status};
use r_efi::efi::{Guid, Status};

/// HidIo interface GUID: 3EA93936-6BF4-49D6-AA50-D9F5B9AD8CFF
pub const GUID: Guid =
Guid::from_fields(0x3ea93936, 0x6bf4, 0x49d6, 0xaa, 0x50, &[0xd9, 0xf5, 0xb9, 0xad, 0x8c, 0xff]);
/// HidIo interface GUID: 3EA93936-6BF4-49D6-AA50-D9F5B9AD8CFF
pub const GUID: Guid =
Guid::from_fields(0x3ea93936, 0x6bf4, 0x49d6, 0xaa, 0x50, &[0xd9, 0xf5, 0xb9, 0xad, 0x8c, 0xff]);

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[repr(C)]
pub enum HidReportType {
InputReport = 1,
OutputReport = 2,
Feature = 3,
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[repr(C)]
pub enum HidReportType {
InputReport = 1,
OutputReport = 2,
Feature = 3,
}

/// Retrieve the HID Report Descriptor from the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_descriptor_size` - On input, the size of the buffer allocated to hold the descriptor. On output, the
/// actual size of the descriptor. May be set to zero to query the required size for the
/// descriptor.
/// * `report_descriptor_buffer` - A pointer to the buffer to hold the descriptor. May be NULL if ReportDescriptorSize
/// is zero.
/// # Return values
/// * `Status::SUCCESS` - Report descriptor successfully returned.
/// * `Status::BUFFER_TOO_SMALL` - The provided buffer is not large enough to hold the descriptor.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::NOT_FOUND` - The device does not have a report descriptor.
/// * Other - Unexpected error reading descriptor.
///
pub type HidIoGetReportDescriptor = extern "efiapi" fn(
this: *const Protocol,
report_descriptor_size: *mut usize,
report_descriptor_buffer: *mut c_void,
) -> Status;
/// Retrieve the HID Report Descriptor from the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_descriptor_size` - On input, the size of the buffer allocated to hold the descriptor. On output, the
/// actual size of the descriptor. May be set to zero to query the required size for the
/// descriptor.
/// * `report_descriptor_buffer` - A pointer to the buffer to hold the descriptor. May be NULL if ReportDescriptorSize
/// is zero.
/// # Return values
/// * `Status::SUCCESS` - Report descriptor successfully returned.
/// * `Status::BUFFER_TOO_SMALL` - The provided buffer is not large enough to hold the descriptor.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::NOT_FOUND` - The device does not have a report descriptor.
/// * Other - Unexpected error reading descriptor.
///
pub type HidIoGetReportDescriptor = extern "efiapi" fn(
this: *const Protocol,
report_descriptor_size: *mut usize,
report_descriptor_buffer: *mut c_void,
) -> Status;

/// Retrieves a single report from the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_id` - Specifies which report to return if the device supports multiple input reports. Set to zero if
/// ReportId is not present.
/// * `report_type` - Indicates the type of report type to retrieve. 1-Input, 3-Feature.
/// * `report_buffer_size` - Indicates the size of the provided buffer to receive the report.
/// * `report_buffer` - Pointer to the buffer to receive the report.
///
/// # Return values
/// * `Status::SUCCESS` - Report successfully returned.
/// * `Status::OUT_OF_RESOURCES` - The provided buffer is not large enough to hold the report.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * Other - Unexpected error reading report.
///
pub type HidIoGetReport = extern "efiapi" fn(
this: *const Protocol,
report_id: u8,
report_type: HidReportType,
report_buffer_size: usize,
report_buffer: *mut c_void,
) -> Status;
/// Retrieves a single report from the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_id` - Specifies which report to return if the device supports multiple input reports. Set to zero if
/// ReportId is not present.
/// * `report_type` - Indicates the type of report type to retrieve. 1-Input, 3-Feature.
/// * `report_buffer_size` - Indicates the size of the provided buffer to receive the report.
/// * `report_buffer` - Pointer to the buffer to receive the report.
///
/// # Return values
/// * `Status::SUCCESS` - Report successfully returned.
/// * `Status::OUT_OF_RESOURCES` - The provided buffer is not large enough to hold the report.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * Other - Unexpected error reading report.
///
pub type HidIoGetReport = extern "efiapi" fn(
this: *const Protocol,
report_id: u8,
report_type: HidReportType,
report_buffer_size: usize,
report_buffer: *mut c_void,
) -> Status;

/// Sends a single report to the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_id` - Specifies which report to send if the device supports multiple input reports. Set to zero if
/// ReportId is not present.
/// * `report_type` - Indicates the type of report type to retrieve. 2-Output, 3-Feature.
/// * `report_buffer_size` - Indicates the size of the provided buffer holding the report to send.
/// * `report_buffer` - Pointer to the buffer holding the report to send.
///
/// # Return values
/// * `Status::SUCCESS` - Report successfully transmitted.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * Other - Unexpected error transmitting report.
///
pub type HidIoSetReport = extern "efiapi" fn(
this: *const Protocol,
report_id: u8,
report_type: HidReportType,
report_buffer_size: usize,
report_buffer: *mut c_void,
) -> Status;
/// Sends a single report to the device.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `report_id` - Specifies which report to send if the device supports multiple input reports. Set to zero if
/// ReportId is not present.
/// * `report_type` - Indicates the type of report type to retrieve. 2-Output, 3-Feature.
/// * `report_buffer_size` - Indicates the size of the provided buffer holding the report to send.
/// * `report_buffer` - Pointer to the buffer holding the report to send.
///
/// # Return values
/// * `Status::SUCCESS` - Report successfully transmitted.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * Other - Unexpected error transmitting report.
///
pub type HidIoSetReport = extern "efiapi" fn(
this: *const Protocol,
report_id: u8,
report_type: HidReportType,
report_buffer_size: usize,
report_buffer: *mut c_void,
) -> Status;

/// Report received callback function.
///
/// # Arguments
///
/// * `report_buffer_size` - Indicates the size of the provided buffer holding the received report.
/// * `report_buffer` - Pointer to the buffer holding the report.
/// * `context` - Context provided when the callback was registered.
///
pub type HidIoReportCallback =
extern "efiapi" fn(report_buffer_size: u16, report_buffer: *mut c_void, context: *mut c_void);
/// Report received callback function.
///
/// # Arguments
///
/// * `report_buffer_size` - Indicates the size of the provided buffer holding the received report.
/// * `report_buffer` - Pointer to the buffer holding the report.
/// * `context` - Context provided when the callback was registered.
///
pub type HidIoReportCallback =
extern "efiapi" fn(report_buffer_size: u16, report_buffer: *mut c_void, context: *mut c_void);

/// Registers a callback function to receive asynchronous input reports from the device. The device driver will do any
/// necessary initialization to configure the device to send reports.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `callback` - Callback function to handle reports as they are received.
/// * `context` - Context that will be provided to the callback function.
///
/// # Return values
/// * `Status::SUCCESS` - Callback successfully registered.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::ALREADY_STARTED` - Callback function is already registered.
/// * Other - Unexpected error registering callback or initiating report generation from device.
///
pub type HidIoRegisterReportCallback =
extern "efiapi" fn(this: *const Protocol, callback: HidIoReportCallback, context: *mut c_void) -> Status;
/// Registers a callback function to receive asynchronous input reports from the device. The device driver will do any
/// necessary initialization to configure the device to send reports.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `callback` - Callback function to handle reports as they are received.
/// * `context` - Context that will be provided to the callback function.
///
/// # Return values
/// * `Status::SUCCESS` - Callback successfully registered.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::ALREADY_STARTED` - Callback function is already registered.
/// * Other - Unexpected error registering callback or initiating report generation from device.
///
pub type HidIoRegisterReportCallback =
extern "efiapi" fn(this: *const Protocol, callback: HidIoReportCallback, context: *mut c_void) -> Status;

/// Unregisters a previously registered callback function. The device driver will do any necessary initialization to
/// configure the device to stop sending reports.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `callback` - Callback function to unregister.
///
/// # Return values
/// * `Status::SUCCESS` - Callback successfully unregistered.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::NOT_STARTED` - Callback function was not previously registered.
/// * Other - Unexpected error unregistering report or disabling report generation from device.
///
pub type HidIoUnregisterReportCallback =
extern "efiapi" fn(this: *const Protocol, callback: HidIoReportCallback) -> Status;
/// Unregisters a previously registered callback function. The device driver will do any necessary initialization to
/// configure the device to stop sending reports.
///
/// # Arguments
///
/// * `this` - A pointer to the HidIo Instance
/// * `callback` - Callback function to unregister.
///
/// # Return values
/// * `Status::SUCCESS` - Callback successfully unregistered.
/// * `Status::INVALID_PARAMETER` - Invalid input parameters.
/// * `Status::NOT_STARTED` - Callback function was not previously registered.
/// * Other - Unexpected error unregistering report or disabling report generation from device.
///
pub type HidIoUnregisterReportCallback =
extern "efiapi" fn(this: *const Protocol, callback: HidIoReportCallback) -> Status;

/// The HID_IO protocol provides a set of services for interacting with a HID device.
#[repr(C)]
pub struct Protocol {
pub get_report_descriptor: HidIoGetReportDescriptor,
pub get_report: HidIoGetReport,
pub set_report: HidIoSetReport,
pub register_report_callback: HidIoRegisterReportCallback,
pub unregister_report_callback: HidIoUnregisterReportCallback,
}
/// The HID_IO protocol provides a set of services for interacting with a HID device.
#[repr(C)]
pub struct Protocol {
pub get_report_descriptor: HidIoGetReportDescriptor,
pub get_report: HidIoGetReport,
pub set_report: HidIoSetReport,
pub register_report_callback: HidIoRegisterReportCallback,
pub unregister_report_callback: HidIoUnregisterReportCallback,
}
}
Loading

0 comments on commit 9467126

Please sign in to comment.