mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Create AniMe device only if physical device exists
The call to create the device handler will return with an error if the physical device doesn't exist, the device (if exists) is stored in an option already so just keep that as `None` if errored. Addresses issue #14
This commit is contained in:
@@ -33,7 +33,7 @@ impl AniMeWriter {
|
||||
pub fn new() -> Result<AniMeWriter, Box<dyn Error>> {
|
||||
// We don't expect this ID to ever change
|
||||
let mut dev_handle = AniMeWriter::get_device(0x0b05, 0x193b).map_err(|err| {
|
||||
error!("Could not get device handle: {:?}", err);
|
||||
error!("Could not get AniMe display handle: {:?}", err);
|
||||
err
|
||||
})?;
|
||||
// This config seems to be the required device config for writing
|
||||
|
||||
@@ -69,8 +69,10 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
// Possible Animatrix
|
||||
let mut animatrix_writer = None;
|
||||
if laptop.support_animatrix() {
|
||||
animatrix_writer = Some(AniMeWriter::new()?);
|
||||
info!("Device has an AniMe Matrix display");
|
||||
if let Ok(dev) = AniMeWriter::new() {
|
||||
animatrix_writer = Some(dev);
|
||||
info!("Device has an AniMe Matrix display");
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the mutexes
|
||||
|
||||
Reference in New Issue
Block a user