mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Feat: improve anime matrix detection
This commit is contained in:
@@ -64,7 +64,7 @@ pub enum AnimeType {
|
||||
GA402,
|
||||
GU604,
|
||||
G635L,
|
||||
G835LW,
|
||||
G835L,
|
||||
#[default]
|
||||
Unsupported,
|
||||
}
|
||||
@@ -73,14 +73,21 @@ impl FromStr for AnimeType {
|
||||
type Err = AnimeError;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
Ok(match s.to_uppercase().as_str() {
|
||||
"GA401" => Self::GA401,
|
||||
"GA402" => Self::GA402,
|
||||
"GU604" => Self::GU604,
|
||||
"G635L" => Self::G635L,
|
||||
"G835LW" => Self::G835LW,
|
||||
_ => Self::Unsupported,
|
||||
})
|
||||
let dmi = s.to_uppercase();
|
||||
|
||||
if dmi.contains("GA401") {
|
||||
return Ok(Self::GA401);
|
||||
} else if dmi.contains("GA402") {
|
||||
return Ok(Self::GA402);
|
||||
} else if dmi.contains("GU604") {
|
||||
return Ok(Self::GU604);
|
||||
} else if dmi.contains("G635L") {
|
||||
return Ok(Self::G635L);
|
||||
} else if dmi.contains("G835L") {
|
||||
return Ok(Self::G835L);
|
||||
}
|
||||
|
||||
Ok(Self::Unsupported)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +111,7 @@ impl AnimeType {
|
||||
pub fn width(&self) -> usize {
|
||||
match self {
|
||||
AnimeType::GU604 => 70,
|
||||
AnimeType::G835LW => 74,
|
||||
AnimeType::G835L => 74,
|
||||
_ => 74,
|
||||
}
|
||||
}
|
||||
@@ -114,7 +121,7 @@ impl AnimeType {
|
||||
match self {
|
||||
AnimeType::GA401 => 36,
|
||||
AnimeType::GU604 => 43,
|
||||
AnimeType::G835LW => 39,
|
||||
AnimeType::G835L => 39,
|
||||
_ => 39,
|
||||
}
|
||||
}
|
||||
@@ -124,7 +131,7 @@ impl AnimeType {
|
||||
match self {
|
||||
AnimeType::GA401 => PANE_LEN * 2,
|
||||
AnimeType::GU604 => PANE_LEN * 3,
|
||||
AnimeType::G835LW => PANE_LEN * 3,
|
||||
AnimeType::G835L => PANE_LEN * 3,
|
||||
_ => PANE_LEN * 3,
|
||||
}
|
||||
}
|
||||
@@ -192,7 +199,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
AnimeType::GA402
|
||||
| AnimeType::GU604
|
||||
| AnimeType::G635L
|
||||
| AnimeType::G835LW
|
||||
| AnimeType::G835L
|
||||
| AnimeType::Unsupported => {
|
||||
vec![[0; 640]; 3]
|
||||
}
|
||||
@@ -209,7 +216,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
AnimeType::GA402
|
||||
| AnimeType::GU604
|
||||
| AnimeType::G635L
|
||||
| AnimeType::G835LW
|
||||
| AnimeType::G835L
|
||||
| AnimeType::Unsupported
|
||||
) {
|
||||
buffers[2][..7].copy_from_slice(&USB_PREFIX3);
|
||||
|
||||
@@ -43,7 +43,7 @@ impl AniMatrix {
|
||||
vertical: 2,
|
||||
horizontal: 5,
|
||||
},
|
||||
AnimeType::GA402 | AnimeType::G635L | AnimeType::G835LW | AnimeType::Unsupported => {
|
||||
AnimeType::GA402 | AnimeType::G635L | AnimeType::G835L | AnimeType::Unsupported => {
|
||||
LedShape {
|
||||
vertical: 2,
|
||||
horizontal: 5,
|
||||
@@ -58,7 +58,7 @@ impl AniMatrix {
|
||||
// Do a hard mapping of each (derived from wireshardk captures)
|
||||
let rows = match model {
|
||||
AnimeType::GA401 => GA401.to_vec(),
|
||||
AnimeType::GA402 | AnimeType::G635L | AnimeType::G835LW | AnimeType::Unsupported => {
|
||||
AnimeType::GA402 | AnimeType::G635L | AnimeType::G835L | AnimeType::Unsupported => {
|
||||
GA402.to_vec()
|
||||
}
|
||||
AnimeType::GU604 => GU604.to_vec(),
|
||||
|
||||
Reference in New Issue
Block a user