i2c_transfer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« i2c_transfer(9) πŸ’«

okay so bestie, you found the kernel API manual page for i2c_transfer β€” she's the one who actually sends your I2C messages. no cap. let's get into it πŸŽ€


✨ NAME ✨

i2c_transfer β€” execute a single or combined I2C message. that's it, that's the whole vibe. one message, or a whole little combo platter πŸ“


🌸 SYNOPSIS 🌸

int i2c_transfer (struct i2c_adapter *adap , struct i2c_msg *msgs , int num );

like literally that's the signature, don't @ me πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • adap β€” handle to the I2C bus. this is your main character pointer, the bus you're about to talk on πŸ”₯
  • msgs β€” one or more messages to execute before STOP is issued to terminate the operation; each message begins with a START. so every message gets its own little START moment, and then STOP shuts the whole thing down πŸ›‘
  • num β€” number of messages to be executed. yes bestie, you gotta tell her how many πŸ™ˆ

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so what does she actually return? it's giving two possible moods:

  • returns a negative errno if things went sideways 😭
  • otherwise, returns the number of messages executed ✨

and here's the fun part β€” lowkey iconic tbh β€” there is no requirement that each message be sent to the same slave address, although that is the most common model. so you can mix it up, even if most people don't. do with that what you will 🧚


🌈 SEE ALSO 🌈

kernel file ./drivers/i2c/i2c-core-base.c β€” go read it, iykyk πŸ’–

and the whole friend group:


friendly reminder bestie: this one's from the Kernel API Manual, lives under ./drivers/i2c, and the page is dated October 2026. screenshot it, cite it, slay. πŸ’…

so yeah β€” go transfer those messages, you got this, periodt πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from