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