Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEVICE_INFO_IDEAPAD_2022 #96

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ The best way to add a new effect is to directly edit the source code, as it allo
- **2022 Models:**

```sh
# Regular legions
SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c975", MODE="0666"

# Ideapad models
SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c973", MODE="0666"
```

- **2021 Models:**
Expand Down
6 changes: 5 additions & 1 deletion src/keyboard_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const DEVICE_INFO_2021: (u16, u16, u16, u16) = (0x048d, 0xc965, 0, 0);
const DEVICE_INFO_2020: (u16, u16, u16, u16) = (0x048d, 0xc955, 0, 0);
#[cfg(target_os = "linux")]
const DEVICE_INFO_IDEAPAD_2021: (u16, u16, u16, u16) = (0x048d, 0xc963, 0, 0);
#[cfg(target_os = "linux")]
const DEVICE_INFO_IDEAPAD_2022: (u16, u16, u16, u16) = (0x048d, 0xc973, 0, 0);
#[cfg(target_os = "windows")]
const DEVICE_INFO_2022: (u16, u16, u16, u16) = (0x048d, 0xc975, 0xff89, 0x00cc);
#[cfg(target_os = "windows")]
Expand All @@ -26,6 +28,8 @@ const DEVICE_INFO_2021: (u16, u16, u16, u16) = (0x048d, 0xc965, 0xff89, 0x00cc);
const DEVICE_INFO_2020: (u16, u16, u16, u16) = (0x048d, 0xc955, 0xff89, 0x00cc);
#[cfg(target_os = "windows")]
const DEVICE_INFO_IDEAPAD_2021: (u16, u16, u16, u16) = (0x048d, 0xc963, 0xff89, 0x00cc);
#[cfg(target_os = "windows")]
const DEVICE_INFO_IDEAPAD_2022: (u16, u16, u16, u16) = (0x048d, 0xc973, 0xff89, 0x00cc);

const SPEED_RANGE: std::ops::Range<u8> = 1..5;
const BRIGHTNESS_RANGE: std::ops::Range<u8> = 1..3;
Expand Down Expand Up @@ -207,7 +211,7 @@ pub fn get_keyboard(stop_signal: Arc<AtomicBool>) -> Result<Keyboard, error::Err
.device_list()
.find(|d| {
let info_tuple = (d.vendor_id(), d.product_id(), d.usage_page(), d.usage());
info_tuple == DEVICE_INFO_2021 || info_tuple == DEVICE_INFO_2020 || info_tuple == DEVICE_INFO_IDEAPAD_2021 || info_tuple == DEVICE_INFO_2022
info_tuple == DEVICE_INFO_2021 || info_tuple == DEVICE_INFO_2020 || info_tuple == DEVICE_INFO_IDEAPAD_2021 || info_tuple == DEVICE_INFO_2022 || info_tuple == DEVICE_INFO_IDEAPAD_2022
})
.ok_or(error::Error::DeviceNotFound)?;

Expand Down