i2c_transfer(9)
π« 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 beforeSTOPis issued to terminate the operation; each message begins with aSTART. so every message gets its own littleSTARTmoment, and thenSTOPshuts 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:
i2c_verify_client(9)i2c_adapter_lock_bus(9)i2c_adapter_trylock_bus(9)i2c_adapter_unlock_bus(9)i2c_new_client_device(9)i2c_unregister_device(9)i2c_find_device_by_fwnode(9)i2c_new_dummy_device(9)devm_i2c_new_dummy_device(9)i2c_new_ancillary_device(9)i2c_verify_adapter(9)i2c_handle_smbus_host_notify(9)i2c_add_adapter(9)i2c_add_numbered_adapter(9)i2c_del_adapter(9)devm_i2c_add_adapter(9)i2c_find_adapter_by_fwnode(9)i2c_get_adapter_by_fwnode(9)i2c_parse_fw_timings(9)i2c_del_driver(9)__i2c_transfer(9)i2c_transfer_buffer_flags(9)i2c_get_device_id(9)i2c_client_get_device_id(9)i2c_get_dma_safe_msg_buf(9)i2c_put_dma_safe_msg_buf(9)
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
- 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