input_mt_assign_slots(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ input_mt_assign_slots(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– this one's a <9>-section page, aka kernel-internals territory, aka the part of town where the multitouch magic happens 🫢 we're talking input_mt_assign_slots today and honestly? she's the matchmaker of the input subsystem πŸ’…


🌸 NAME 🌸

input_mt_assign_slots β€” perform a best-match assignment ✨

like, she looks at your contacts and your slots and goes "okay you two, you're a couple now" πŸŽ€ no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

int input_mt_assign_slots (struct input_dev *dev , int *slots , const
       struct input_mt_pos *pos , int num_pos , int dmax );

yes the line break is real, that's just how the manpage renders it, don't come for her 😭 copy it exactly, fr fr.


πŸ’œ ARGUMENTS πŸ’œ

  • dev β€” the input device that already has its MT slots allocated ✨. if you haven't allocated slots yet, bestie, go do that first, this function is not gonna do it for you πŸ™ˆ
  • slots β€” the slot assignment array that's gonna get filled in 🫢 this is the output, the finished product, the glow-up πŸ’…
  • pos β€” the position array you want to match against 🌸 these are the vibes we're trying to place
  • num_pos β€” how many positions are in that array, i.e. the headcount πŸ‘‘
  • dmax β€” the maximum ABS_MT_POSITION displacement allowed, and heads up: zero means infinite ⭐ so don't be passing 0 thinking it means "no movement allowed", it's literally the opposite, iykyk πŸ’€

πŸ”₯ DESCRIPTION πŸ”₯

so what she does is: she runs a best match against the current contacts and hands you back the slot assignment list πŸ“‹βœ¨. New contacts get assigned to unused slots β€” the way that a group chat adds a new member to the empty seat, very main character energy πŸ‘‘

the assignments are balanced so that every single coordinate displacement stays below the euclidian distance dmax πŸŽ€ that's the whole vibe check of the function. BUT β€” and this is important bestie β€” if no such assignment can be found, some contacts get assigned to unused slots anyway πŸ™ˆ she does her best, she doesn't just give up.

returns zero on success πŸ₯³ or a negative error in case of failure 😭 that's it, that's the contract.


🧚 SEE ALSO 🧚

the kernel file lives at ./drivers/input/input-mt.c β€” go read it, she's iconic πŸ“–πŸ’– and then check out her whole friend group:


πŸ’– ok that's the whole page bestie, you've got this. match those slots, respect the dmax, and remember: 0 means infinite, not zero 🫢✨

huge slay to the kernel devs over at ./drivers/input β€” this one's dated October 2026 and it's input_mt_assign_slots(9) forever and always πŸŽ€πŸ’œ

πŸ“¦ where this page comes from