tool: Make Access
require Send
and 'static
This allows the Configurator to send a `Ec<Box<dyn Access>>` through a channel to a background thread. This could be done differently, but presumably there's no reason to have an `Access` implementation this doesn't apply to.
This commit is contained in:
committed by
Jeremy Soller
parent
16778e4a41
commit
84d5c6b79d
@ -13,13 +13,13 @@ use crate::{
|
||||
use super::*;
|
||||
|
||||
/// Use direct hardware access. Unsafe due to not having mutual exclusion
|
||||
pub struct AccessLpcDirect<T: Timeout + 'static> {
|
||||
pub struct AccessLpcDirect<T: Timeout + Send + 'static> {
|
||||
cmd: u16,
|
||||
dbg: u16,
|
||||
timeout: T,
|
||||
}
|
||||
|
||||
impl<T: Timeout> AccessLpcDirect<T> {
|
||||
impl<T: Timeout + Send> AccessLpcDirect<T> {
|
||||
/// Checks that Super I/O ID matches and then returns access object
|
||||
pub unsafe fn new(timeout: T) -> Result<Self, Error> {
|
||||
// Make sure EC ID matches
|
||||
@ -71,7 +71,7 @@ impl<T: Timeout> AccessLpcDirect<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Timeout> Access for AccessLpcDirect<T> {
|
||||
impl<T: Timeout + Send> Access for AccessLpcDirect<T> {
|
||||
unsafe fn command(&mut self, cmd: u8, data: &mut [u8]) -> Result<u8, Error> {
|
||||
// Test data length
|
||||
if data.len() > self.data_size() {
|
||||
|
@ -23,7 +23,7 @@ pub use self::lpc::*;
|
||||
mod lpc;
|
||||
|
||||
/// Access method for running an EC command
|
||||
pub trait Access: Downcast {
|
||||
pub trait Access: Downcast + Send + 'static {
|
||||
/// Sends a command using the access method. Only internal use is recommended
|
||||
unsafe fn command(&mut self, cmd: u8, data: &mut [u8]) -> Result<u8, Error>;
|
||||
|
||||
|
Reference in New Issue
Block a user