mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Adjust anime init sequence
This commit is contained in:
@@ -62,7 +62,7 @@ pub enum AnimeType {
|
||||
GA401,
|
||||
GA402,
|
||||
GU604,
|
||||
Unknown,
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
impl FromStr for AnimeType {
|
||||
@@ -73,7 +73,7 @@ impl FromStr for AnimeType {
|
||||
"ga401" | "GA401" => Self::GA401,
|
||||
"ga402" | "GA402" => Self::GA402,
|
||||
"gu604" | "GU604" => Self::GU604,
|
||||
_ => Self::Unknown,
|
||||
_ => Self::Unsupported,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
|
||||
let mut buffers = match anime.anime {
|
||||
AnimeType::GA401 => vec![[0; 640]; 2],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown => vec![[0; 640]; 3],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported => vec![[0; 640]; 3],
|
||||
};
|
||||
|
||||
for (idx, chunk) in anime.data.as_slice().chunks(PANE_LEN).enumerate() {
|
||||
@@ -176,7 +176,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
|
||||
if matches!(
|
||||
anime.anime,
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported
|
||||
) {
|
||||
buffers[2][..7].copy_from_slice(&USB_PREFIX3);
|
||||
}
|
||||
|
||||
@@ -241,13 +241,13 @@ impl From<AnimShutdown> for i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// `get_anime_type` is very broad, matching on part of the laptop board name
|
||||
/// only. For this reason `find_node()` must be used also to verify if the USB
|
||||
/// device is available.
|
||||
/// `get_maybe_anime_type` is very broad, matching on part of the laptop board
|
||||
/// name only. For this reason `find_node()` must be used also to verify if the
|
||||
/// USB device is available.
|
||||
///
|
||||
/// The currently known USB device is `19b6`.
|
||||
#[inline]
|
||||
pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
pub fn get_maybe_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
let dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error
|
||||
let board_name = dmi.board_name;
|
||||
|
||||
@@ -258,8 +258,8 @@ pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
} else if board_name.contains("GU604V") {
|
||||
return Ok(AnimeType::GU604);
|
||||
}
|
||||
log::warn!("AniMe Matrix device found but not yet supported, will default to a GA402 layout");
|
||||
Ok(AnimeType::Unknown)
|
||||
log::warn!("AniMe Matrix device found but could be a slash");
|
||||
Ok(AnimeType::Unsupported)
|
||||
}
|
||||
|
||||
/// Get the two device initialization packets. These are required for device
|
||||
|
||||
Reference in New Issue
Block a user