OpenLogi
功能(Features)

0x8310 · equalizer

HID++ 耳机的逐频段音频均衡器与麦克风降噪——查询频段数量和增益范围、按可配置的持久化策略读写各频段增益,并切换降噪开关。

HID++ 耳机的逐频段音频均衡器与麦克风降噪功能。getEqInfo(function 0)返回均衡器表的维度信息——band_count(频段数)、增益范围(dB)以及 EqCapabilities 标志位(指示数值以增益还是 DSP 系数形式存储)。getFrequencies(function 1)分页读取每个频段的固定中心频率(Hz),每次响应最多返回七个。getFrequencyGains / setFrequencyGains(function 2–3)读写各频段的有符号增益(dB);setFrequencyGains 接受 GainPersistence 参数,控制新值写入 RAM、EEPROM 或两者。另有两个独立函数(4–5)以单个布尔值读写硬件麦克风降噪开关。

  • EqInfo —— band_count(最多 15 个频段)、db_range / db_min / db_max(增益限制,dB;effective_range() 会将"两者均为零则隐含 ±db_range"的简写解析为具体范围)、capabilities
  • GainLocation —— Eeprom(持久化的自定义均衡器)或 Ram(当前生效的均衡器)。
  • GainPersistence —— Volatile(仅写 RAM)、VolatileAndNonVolatile(同时写 RAM 与 EEPROM)或 NonVolatileOnly(仅写 EEPROM)。

规格: Logitech HID++ 2.0 —— x8310 equalizer用于: openlogi-hidpp 中的类型化封装。

Function reference

The EqualizerFeature wrapper (0x8310) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_eq_info0()EqInfo
get_frequencies1(band_count: u8)Vec<u16>
get_frequency_gains2(location: GainLocation, band_count: u8)Vec<i8>
set_frequency_gains3(persistence: GainPersistence, gains: &[i8])Vec<i8>
get_mic_noise_reduction4()bool
set_mic_noise_reduction5(enabled: bool)()

All methods are async and return Result<…, Hidpp20Error>.

Types

EqInfo

EQ table information returned by get_eq_info.

FieldTypeDescription
band_countu8Number of frequency bands.
db_rangeu8Gain range in dB; used as ±db_range when db_min/db_max are both 0.
capabilitiesEqCapabilitiesHow EQ values are stored.
db_mini8Minimum gain in dB, or 0 to imply -db_range.
db_maxi8Maximum gain in dB, or 0 to imply +db_range.

Method: effective_range(&self) -> (i8, i8) — resolves the "both-zero implies ±db_range" shorthand into concrete (min, max) bounds.

EqCapabilities

Bitflags indicating how a device stores its EQ values, from get_eq_info.

FlagBit/ValueDescription
STORED_AS_GAINS0x01EQ values are stored as gains.
STORED_AS_COEFFICIENTS0x02EQ values are stored as coefficients.

GainLocation

Selects which copy of the EQ gains get_frequency_gains reads from.

VariantValueDescription
Eeprom0The custom EQ stored in EEPROM (the version-0 default).
Ram1The active EQ in RAM.

GainPersistence

Controls how set_frequency_gains persists the new gains.

VariantValueDescription
Volatile0Applied to RAM only.
VolatileAndNonVolatile1Applied to RAM and stored in EEPROM.
NonVolatileOnly2Stored in EEPROM only.

Wire format

Simple getters carry a 3-byte request payload (all zeroes except where noted); set_frequency_gains uses a 16-byte long request. All responses are read from the 16-byte extended payload.

get_eq_info (fn 0)

Request: [0x00, 0x00, 0x00]

Response (byte → field):

ByteFieldNotes
0band_countNumber of frequency bands.
1db_rangeSymmetric gain range in dB when db_min/db_max are both 0.
2capabilitiesEqCapabilities bitflags: bit 0 = STORED_AS_GAINS, bit 1 = STORED_AS_COEFFICIENTS.
3db_minMinimum gain (signed i8), or 0 to imply -db_range.
4db_maxMaximum gain (signed i8), or 0 to imply +db_range.

get_frequencies (fn 1)

Paged: the wrapper issues one request per page of up to 7 bands until all band_count frequencies are collected.

Request: [start_index, 0x00, 0x00]

ByteFieldNotes
0start_indexIndex of the first band on this page.

Response (byte → field):

ByteFieldNotes
0echoed start_indexValidated by the wrapper; returns UnsupportedResponse on mismatch.
1–2frequency[0]Big-endian u16, Hz.
3–4frequency[1]Big-endian u16, Hz.
Up to 7 frequencies per page (bytes 1–14).

get_frequency_gains (fn 2)

Request: [location, 0x00, 0x00]

ByteFieldNotes
0locationGainLocation as u8: 0 = Eeprom, 1 = Ram.

Response (byte → field):

ByteFieldNotes
0–NgainsOne signed i8 per band (cast from raw byte), up to band_count bytes.

set_frequency_gains (fn 3)

Uses call_long — a 16-byte request payload.

Request: [persistence, gain[0], gain[1], …, gain[14]]

ByteFieldNotes
0persistenceGainPersistence as u8: 0=Volatile, 1=VolatileAndNonVolatile, 2=NonVolatileOnly.
1–15gainsEach gain cast from i8 to u8; up to 15 bands.

Response (byte → field):

ByteFieldNotes
0echoed persistenceSkipped by the wrapper.
1–Nechoed gainsParsed as signed i8; returned as Vec<i8>.

get_mic_noise_reduction (fn 4)

Request: [0x00, 0x00, 0x00]

Response (byte → field):

ByteFieldNotes
0enabledNon-zero = enabled; zero = disabled. Returned as bool.

set_mic_noise_reduction (fn 5)

Request: [enabled, 0x00, 0x00]

ByteFieldNotes
0enabled1 = enable, 0 = disable.

Response is ignored.

Usage (Rust)

use hidpp::{device::Device, feature::equalizer::{EqualizerFeature, GainLocation, GainPersistence}};

// device: &mut Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<EqualizerFeature>() {
    // Query EQ table dimensions.
    let info = feat.get_eq_info().await?;
    let (min_db, max_db) = info.effective_range();

    // Read centre frequencies of all bands.
    let freqs = feat.get_frequencies(info.band_count).await?;

    // Read the currently active gains from RAM.
    let gains = feat.get_frequency_gains(GainLocation::Ram, info.band_count).await?;

    // Apply a flat EQ to RAM (volatile, no EEPROM write).
    let flat: Vec<i8> = vec![0i8; usize::from(info.band_count)];
    let echoed = feat.set_frequency_gains(GainPersistence::Volatile, &flat).await?;

    // Toggle microphone noise reduction.
    let nr_on = feat.get_mic_noise_reduction().await?;
    feat.set_mic_noise_reduction(!nr_on).await?;
}

本页目录