Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c14bef89 authored by Whale Chang's avatar Whale Chang Committed by Gerrit Code Review
Browse files

Merge "Floss: Implement Ring Central reject call functionality via Drop HID event" into main

parents e7c904cf f320fa20
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -22,9 +22,9 @@ use bt_topshim::profiles::ProfileConnectionState;
use bt_topshim::{metrics, topstack};
use bt_utils::at_command_parser::{calculate_battery_percent, parse_at_command_data};
use bt_utils::uhid_hfp::{
    OutputEvent, UHidHfp, BLUETOOTH_TELEPHONY_UHID_REPORT_ID, UHID_INPUT_HOOK_SWITCH,
    UHID_INPUT_NONE, UHID_INPUT_PHONE_MUTE, UHID_OUTPUT_MUTE, UHID_OUTPUT_NONE,
    UHID_OUTPUT_OFF_HOOK, UHID_OUTPUT_RING,
    OutputEvent, UHidHfp, BLUETOOTH_TELEPHONY_UHID_REPORT_ID, UHID_INPUT_DROP,
    UHID_INPUT_HOOK_SWITCH, UHID_INPUT_NONE, UHID_INPUT_PHONE_MUTE, UHID_OUTPUT_MUTE,
    UHID_OUTPUT_NONE, UHID_OUTPUT_OFF_HOOK, UHID_OUTPUT_RING,
};
use bt_utils::uinput::UInput;

@@ -1216,6 +1216,8 @@ impl BluetoothMedia {
            let mut data = UHID_INPUT_NONE;
            if hook {
                data |= UHID_INPUT_HOOK_SWITCH;
            } else if self.phone_state.state == CallState::Incoming {
                data |= UHID_INPUT_DROP;
            }
            // Preserve the muted state when sending the hook switch event.
            if uhid.muted {
+6 −3
Original line number Diff line number Diff line
@@ -14,12 +14,13 @@ pub const BLUETOOTH_TELEPHONY_UHID_REPORT_ID: u8 = 1;
pub const UHID_INPUT_NONE: u8 = 0;
pub const UHID_INPUT_HOOK_SWITCH: u8 = 1 << 0;
pub const UHID_INPUT_PHONE_MUTE: u8 = 1 << 1;
pub const UHID_INPUT_DROP: u8 = 1 << 2;
pub const UHID_OUTPUT_NONE: u8 = 0;
pub const UHID_OUTPUT_RING: u8 = 1 << 0;
pub const UHID_OUTPUT_OFF_HOOK: u8 = 1 << 1;
pub const UHID_OUTPUT_MUTE: u8 = 1 << 2;

const RDESC: [u8; 55] = [
const RDESC: [u8; 57] = [
    0x05,
    0x0B, // Usage Page (Telephony)
    0x09,
@@ -38,16 +39,18 @@ const RDESC: [u8; 55] = [
    0x20, //   Usage (Hook Switch)
    0x09,
    0x2f, //   Usage (Phone Mute)
    0x09,
    0x26, //   Usage (Drop)
    0x75,
    0x01, //   Report Size (1)
    0x95,
    0x02, //   Report Count (2)
    0x03, //   Report Count (3)
    0x81,
    0x23, //   Input
    0x75,
    0x01, //   Report Size (1)
    0x95,
    0x06, //   Report Count (6)
    0x05, //   Report Count (5)
    0x81,
    0x01, //   Input
    0x05,