Skip to content

Commit d4153e2

Browse files
committed
Allow building with rusb
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent b79d8fc commit d4153e2

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

framework_lib/Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ build = "build.rs"
99
default = ["linux"]
1010
# Linux/FreeBSD
1111
unix = ["std", "raw_pio", "smbios", "dep:nix", "dep:libc"]
12-
linux = ["unix", "linux_pio", "cros_ec_driver", "hidapi"]
13-
freebsd = ["unix", "freebsd_pio", "hidapi"]
12+
linux = ["unix", "linux_pio", "cros_ec_driver", "hidapi", "rusb"]
13+
freebsd = ["unix", "freebsd_pio", "hidapi", "rusb"]
14+
# hidapi and rusb don't seem to build in the cross container at the moment
1415
cross_freebsd = ["unix", "freebsd_pio"]
1516
# Windows does not have the cros_ec driver nor raw port I/O access to userspace
16-
windows = ["std", "smbios", "dep:windows", "win_driver", "raw_pio", "hidapi"]
17+
windows = ["std", "smbios", "dep:windows", "win_driver", "raw_pio", "hidapi", "rusb"]
1718
smbios = ["dep:smbios-lib"]
18-
std = ["dep:clap", "dep:clap-verbosity-flag", "dep:env_logger", "smbios-lib?/std", "dep:rusb"]
19+
std = ["dep:clap", "dep:clap-verbosity-flag", "dep:env_logger", "smbios-lib?/std"]
20+
rusb = ["dep:rusb"]
1921
hidapi = ["dep:hidapi"]
2022
uefi = [
2123
"dep:plain", "raw_pio", "smbios", "lazy_static/spin_no_std", "dep:uefi", "dep:uefi-services",

framework_lib/src/commandline/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::fs;
1919
#[cfg(all(not(feature = "uefi"), feature = "std"))]
2020
use std::io::prelude::*;
2121

22-
#[cfg(not(feature = "uefi"))]
22+
#[cfg(feature = "rusb")]
2323
use crate::audio_card::check_synaptics_fw_version;
2424
use crate::built_info;
2525
use crate::capsule;
@@ -200,7 +200,7 @@ fn print_pd_details(ec: &CrosEc) {
200200
#[cfg(feature = "hidapi")]
201201
const NOT_SET: &str = "NOT SET";
202202

203-
#[cfg(not(feature = "uefi"))]
203+
#[cfg(feature = "rusb")]
204204
fn print_audio_card_details() {
205205
check_synaptics_fw_version();
206206
}
@@ -624,7 +624,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
624624
#[cfg(not(feature = "hidapi"))]
625625
let _ = pd_bin_path;
626626
} else if args.audio_card_info {
627-
#[cfg(not(feature = "uefi"))]
627+
#[cfg(feature = "rusb")]
628628
print_audio_card_details();
629629
} else if args.privacy {
630630
if let Some((mic, cam)) = print_err(ec.get_privacy_info()) {

framework_lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern crate lazy_static;
1212
#[macro_use]
1313
extern crate log;
1414

15-
#[cfg(not(feature = "uefi"))]
15+
#[cfg(feature = "rusb")]
1616
pub mod audio_card;
1717

1818
#[cfg(feature = "uefi")]

framework_lib/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub unsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] {
9696
}
9797

9898
/// Convert any type to a mut u8 slice (Like a C byte buffer)
99-
#[cfg(not(feature = "uefi"))]
99+
#[cfg(feature = "rusb")]
100100
pub unsafe fn any_as_mut_u8_slice<T: Sized>(p: &mut T) -> &mut [u8] {
101101
let len = ::std::mem::size_of::<T>();
102102
::std::slice::from_raw_parts_mut((p as *mut T) as *mut u8, len)

0 commit comments

Comments
 (0)