i2c_smbus_write_byte_data(9)
π i2c_smbus_write_byte_data β bestie, it's in the Kernel API Manual β¨
Okay so picture this: you're deep in the kernel, you've got a tiny little sensor on an I2C bus, and you justΡΠ°ΠΊΠΈ need to yeet one single byte at it. That's literally this function's whole personality. Welcome to the SMBus "write byte" protocol, no cap. π
β¨ SYNOPSIS β¨
s32 i2c_smbus_write_byte_data (const struct i2c_client *client , u8
command , u8 value );
Yep, that's the whole signature β s32 going in, three args going out, and it's giving "small but mighty" energy. π₯
πΈ ARGUMENTS πΈ
clientβ your handle to the slave device, like the contact in your phone you're about to text. It's aconst struct i2c_client *, so hands off, don't go mutating it. π«Άcommandβ a byte that the slave gets to interpret. You don't decide what it means, bestie β that's between the device and its datasheet. πvalueβ the actual byte you're writing. The star of the show. The moment. π
π DESCRIPTION π
This right here executes the SMBus "write byte" protocol. It returns a negative errno if things go sideways, or zero on success. That's it. That's the whole vibe check: < 0 means sad girl hours π, 0 means slay. β¨
Lowkey important: success is 0, not a count of bytes or anything cute like that. Negative errno = problem. Don't overthink it. π
π¦ SEE ALSO π¦
Kernel file ./drivers/i2c/i2c-core-smbus.c β that's where the actual implementation lives, go read it, it's iconic. And the whole friend group:
i2c_smbus_pec(9)i2c_smbus_read_byte(9)i2c_smbus_write_byte(9)i2c_smbus_read_byte_data(9)i2c_smbus_read_word_data(9)i2c_smbus_write_word_data(9)i2c_smbus_read_block_data(9)i2c_smbus_write_block_data(9)i2c_smbus_xfer(9)i2c_smbus_read_i2c_block_data_or_emulated(9)i2c_new_smbus_alert_device(9)
Every single one of them, accounted for, not a single bestie left behind. π
And that's the whole page, babes! πΈ This little gem lives under ./drivers/i2c in the Kernel API Manual, dated October 2026. Go forth and write your bytes. Mwah. ππ§β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms