i2c_smbus_r..._or_emulated(9)
π NAME π
okay so this is i2c_smbus_read_i2c_block_data_or_emulated β literally the "read block or emulate" girlie, from the Kernel API Manual (i2c_smbus_r..._or_emulated(9) if you're being formal β¨). she reads a block, or she fakes it. no cap.
π¦ SYNOPSIS π¦
s32 i2c_smbus_read_i2c_block_data_or_emulated (const struct i2c_client
*client , u8 command , u8 length , u8 *values );
π ARGUMENTS π
clientβ the handle to the slave device, aka who we're talking to πcommandβ the byte that the slave interprets, iykyklengthβ the size of the data block; bestie, SMBus allows at mostI2C_SMBUS_BLOCK_MAXbytes, that's the ceiling, periodtvaluesβ the byte array the data gets read into; it has to be big enough to hold whatever the slave sends back. and yeah, same rule as before: SMBus allows at mostI2C_SMBUS_BLOCK_MAXbytes πΈ
β¨ DESCRIPTION β¨
so here's the vibe: this function runs the SMBus "block read" protocol if the adapter supports it. iconic, love that for us.
but if block read is not supported? she doesn't panic, she emulates it β using either word read or byte read protocols, depending on what's actually available. adaptable queen π
now the serious part, don't skip this π β the addresses of the I2C slave device that get accessed with this function must be mapped to a linear region, so that a block read will have exactly the same effect as a byte read.
β οΈ and before you use this function at all, you must double-check that the I2C slave actually supports exchanging a block transfer with a byte transfer. like, fr fr go check. don't just assume π
π SEE ALSO π
- Kernel file
./drivers/i2c/i2c-core-smbus.c i2c_smbus_pec(9)i2c_smbus_read_byte(9)i2c_smbus_write_byte(9)i2c_smbus_read_byte_data(9)i2c_smbus_write_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_new_smbus_alert_device(9)
that's the whole page bestie, go read the source at ./drivers/i2c π β this one's dated October 2026, mwah, mwah, hope this slayed for you π«Άππ¦
π¦ 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