snd_jack_set_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is snd_jack_set_key(9) from the Kernel API Manual, and it’s literally the function that does set a key mapping on a jack πŸ’…. It’s giving tiny matchmaker between jack buttons and input-layer keys, fr fr.

✨ SYNOPSIS ✨

copy-paste-safe, bestie:

int snd_jack_set_key (struct snd_jack *jack , enum snd_jack_types type ,
int keytype );

πŸŽ€ ARGUMENTS πŸŽ€

  • jack β€” the jack you’re configuring. yes, that one 🫢
  • type β€” the jack report type for this key. it’s the SND_JACK_BTN_* of it all.
  • keytype β€” the input layer key type to be reported.

πŸ¦‹ DESCRIPTION πŸ¦‹

This maps a SND_JACK_BTN_* button type to an input layer key, so keys on accessories can be reported through the jack abstraction. If no mapping is provided but keys are enabled in the jack type, then the numeric BTN_n buttons will be reported. slay.

If jacks are not reporting via the input API, this call will have no effect β€” literally nothing. πŸ’€

note that this is intended to be used by simple devices with small numbers of keys that can be reported. It’s also possible to access the input device directly β€” devices with complex input capabilities on accessories should consider doing that rather than using this abstraction. iykyk.
⚠️ important caveat: this function may only be called prior to registration of the jack. like, before it’s registered. no cap.

🌸 RETURN 🌸

Zero if successful, or a negative error code on failure. 😭

πŸ’… SEE ALSO πŸ’…

πŸ’– okay bye bestie β€” this page is from the Kernel API Manual, source/version: ./sound/core, date: October 2026. periodt. 🫢

πŸ“¦ where this page comes from