Skip to content

Commit

Permalink
device: gibkey-g68 (wip, testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Dec 22, 2024
1 parent 8a5a545 commit d949453
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/isp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl ISPDevice {
let device = api.open_path(request_device_info.path()).unwrap();

info!("Found regular device. Entering ISP mode...");
if let Err(err) = Self::enter_isp_mode(&device) {
if let Err(err) = Self::enter_isp_mode(part.isp_report_id, &device) {
debug!("Error: {:}", err);
return Err(err);
}
Expand Down Expand Up @@ -270,8 +270,8 @@ impl ISPDevice {
Err(ISPError::NotFound)
}

fn enter_isp_mode(handle: &HidDevice) -> Result<(), ISPError> {
let cmd: [u8; COMMAND_LENGTH] = [REPORT_ID_CMD, CMD_ISP_MODE, 0x00, 0x00, 0x00, 0x00];
fn enter_isp_mode(isp_report_id: u8, handle: &HidDevice) -> Result<(), ISPError> {
let cmd: [u8; COMMAND_LENGTH] = [isp_report_id, CMD_ISP_MODE, 0x00, 0x00, 0x00, 0x00];
handle.send_feature_report(&cmd)?;
Ok(())
}
Expand Down
12 changes: 12 additions & 0 deletions src/part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub struct Part {
/// Index of matching (usage_page && usage) collection at which the ISP report appears in.
pub isp_index: usize,

pub isp_report_id: u8,

pub reboot: bool,
}

Expand All @@ -34,6 +36,7 @@ pub const PART_BASE_DEFAULT: Part = Part {
isp_usage_page: 0xff00,
isp_usage: 0x0001,
isp_index: 0,
isp_report_id: 0x05,

reboot: true,
};
Expand Down Expand Up @@ -259,6 +262,14 @@ pub const PART_REDRAGON_K633_RYZE: Part = Part {
..PART_BASE_SH68F90
};

pub const PART_GIBKEY_G68: Part = Part {
vendor_id: 0x258a,
product_id: 0x0049,
isp_usage: 0x0000,
isp_report_id: 0x02,
..PART_BASE_SH68F90
};

pub static PARTS: Map<&'static str, Part> = phf_map! {
"aula-f87" => PART_AULA_F87,
"deltaco-wk95r" => PART_DELTACO_WK95R,
Expand Down Expand Up @@ -299,6 +310,7 @@ pub static PARTS: Map<&'static str, Part> = phf_map! {
"xinmeng-xm-rf68" => PART_XINMENG_XM_RF68,
"yunzii-al66" => PART_XINMENG_M71, // same as xinmeng-m71
"yunzii-al71" => PART_XINMENG_M71, // same as xinmeng-m71
"gibkey-g68" => PART_GIBKEY_G68,
};

impl Part {
Expand Down

0 comments on commit d949453

Please sign in to comment.