sgp_read_cmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ sgp_read_cmd(9) β€” Kernel API Manual πŸ’–

okay so this page is from the Kernel API Manual, and it’s giving β€œsensor readback core lore” 🫢. Stay for the lock warning, bestie β€” it’s important.

🌸 NAME 🌸

sgp_read_cmd β€” reads data from the sensor after issuing a command. The caller must hold data->data_lock for the duration of the call. no cap, that lock is not optional πŸ’….

⚠️ bestie, the caller must hold data->data_lock for the duration of the call. like, the whole call. do not let go early πŸ™ˆ.

✨ SYNOPSIS ✨

int sgp_read_cmd (struct sgp_data *data , enum sgp_cmd cmd , union
       sgp_reading *buf , size_t word_count , unsigned long duration_us );

πŸŽ€ ARGUMENTS πŸŽ€

  • data β€” SGP data. the main character struct, periodt πŸ‘‘.
  • cmd β€” SGP Command to issue. like, the command we’re sending before the read happens.
  • buf β€” Raw data buffer to use. this is where the raw data lands πŸ“.
  • word_count β€” Num words to read, excluding CRC bytes. yes, CRC bytes are not included in this count, bestie πŸ’€.
  • duration_us β€” Time taken to sensor to take a reading and data to be ready. the sensor-reading + data-ready time situation 🧚.

πŸ”₯ RETURN πŸ”₯

Returns 0 on success, negative error otherwise. zero = slay ✨, negative = something went sideways 😭.

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/iio/chemical/sgp30.c, plus sgp_verify_buffer(9) and sgp_measure_iaq(9). go read those if you want the full friend-group lore 🌈.


and finally, mwah πŸ’‹: this page’s source/version situation is ./drivers/iio/chemical, and it’s dated October 2026. that’s the sign-off, bestie β€” now go hold that lock 🫢✨

πŸ“¦ where this page comes from