Skip to content

Commit

Permalink
Merge pull request #33 from felfert/auto-detach-kernel-driver
Browse files Browse the repository at this point in the history
Auto-detach kernel driver (Fix #22)
  • Loading branch information
skraus-dev authored Apr 18, 2023
2 parents 48f98b9 + f881124 commit cd36081
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cherryrgb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,11 @@ impl CherryKeyboard {

// Skip kernel driver detachment for non-unix platforms
if cfg!(unix) {
let kernel_driver_active = device_handle
.kernel_driver_active(INTERFACE_NUM)
.map_err(|e| CherryRgbError::UsbError("kernel_driver_active".into(), e))?;

if kernel_driver_active {
device_handle
.detach_kernel_driver(INTERFACE_NUM)
.map_err(|e| {
CherryRgbError::UsbError("Failed to detach active kernel driver".into(), e)
})?;
}
device_handle
.set_auto_detach_kernel_driver(true)
.map_err(|e| {
CherryRgbError::UsbError("Failed to detach active kernel driver".into(), e)
})?;
}

device_handle
Expand Down

0 comments on commit cd36081

Please sign in to comment.