write_scratchpad(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 write_scratchpad(9) β€” Kernel API Manual 🌸

okay so bestie, welcome to write_scratchpad(9) from the Kernel API Manual β€” yes that's the manpage name, we're being ✨official✨ today. This is the little function that writes bytes into the device RAM and honestly? iconic behavior. Let's get into it πŸ’…


✨ NAME ✨

write_scratchpad β€” writes nb_bytes in the device RAM. that's it, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

int write_scratchpad (struct w1_slave *sl , const u8 *data , u8 nb_bytes
);

literally the whole signature, copy it exactly, don't get creative with it 🫢


✨ ARGUMENTS ✨

  • sl β€” pointer to the slave you wanna write in πŸ’– like, the target. the main character of this operation.
  • data β€” pointer to an array of 3 bytes, because 3 bytes MUST be written. no exceptions, no shortcuts, not me being dramatic β€” it's literally in the spec 😭
  • nb_bytes β€” how many bytes get written: 2 for DS18S20, 3 otherwise. so like, DS18S20 is the special one and everyone else gets three πŸ¦‹

✨ RETURN ✨

  • 0 if success ✨ slay
  • -kernel error code otherwise πŸ’€ (it's a kernel error code β€” not your usual errno situation, don't @ me)

✨ SEE ALSO ✨

Kernel file ./drivers/w1/slaves/w1_therm.c struct β€” yes the whole struct, they said what they said πŸŽ€

And the full friend group, no one left out:

like, read read_scratchpad(9) next, it's the sibling, they come as a set πŸ‘‘πŸ’œ


ngl the 3 bytes MUST be written thing is the one rule you cannot fumble. your data array is 3 bytes. periodt. πŸ™ˆ

and that's the page!! source path is ./drivers/w1/slaves, version date is October 2026, and the page itself is write_scratchpad(9) β€” mwah, bye bestie, go write some scratchpad πŸ’–πŸŒˆβ­

πŸ“¦ where this page comes from