Skip to content

Commit

Permalink
Return Uac2 from Uac2::new
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Dec 6, 2024
1 parent d69bbda commit 9d90410
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/function/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ impl Uac2 {
}

/// Creates a new USB Audio Class 2 (UAC2) function with the specified capture and playback channels.
pub fn new(capture: Channel, playback: Channel) -> Uac2Builder {
pub fn new(capture: Channel, playback: Channel) -> (Uac2, Handle) {
let mut builder = Uac2Builder::default();
builder.capture.channel = capture;
builder.playback.channel = playback;
builder
builder.build()
}

/// Access to registration status.
Expand Down
3 changes: 1 addition & 2 deletions tests/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use usb_gadget::function::audio::{Channel, Uac2};
fn audio() {
init();

let (audio, func) =
Uac2::new(Channel::new(0b1111_1111, 48000, 24 / 8), Channel::new(0b11, 48000, 16 / 8)).build();
let (audio, func) = Uac2::new(Channel::new(0b1111_1111, 48000, 24 / 8), Channel::new(0b11, 48000, 16 / 8));
let reg = reg(func);

println!("UAC2 audio device at {}", audio.status().path().unwrap().display());
Expand Down

0 comments on commit 9d90410

Please sign in to comment.