MODBUS_GET_SLAVE(3)
β¨ MODBUS_GET_SLAVE β¨
okay bestie, welcome to the libmodbus Manual page for MODBUS_GET_SLAVE(3) π yes we're doing a whole deep dive on one tiny little getter function and honestly? iconic of us.
πΈ NAME πΈ
modbus_get_slave β get slave number in the context π
π SYNOPSIS π
int modbus_get_slave(modbus_t *ctx);
π¦ DESCRIPTION π¦
so like, the modbus_get_slave() function shall get the slave number in the libmodbus context. that's it. that's the whole job. it reads ctx, it tells you who the slave is. no cap, it's giving "one line of code, zero drama" energy β¨
π RETURN VALUE π
bestie, if everything goes right, the function shall return the slave number. slay π
but if it doesn't? it shall return -1 and set errno to one of the values defined below. so yeah, check that errno, she's trying to tell you something π
π₯ ERRORS π₯
EINVALβ the libmodbus context is undefined. like, the context doesn't exist. there's nothing to get a slave number from, bestie π
π SEE ALSO π
modbus_set_slave(3)β the other half of the duo, go read her too π«Ά
π AUTHORS π
the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β thank you for your service, legend π
and that's the whole page, bestie!! this was libmodbus v3.1.6, dated 11/17/2025 π go forth and get those slave numbers, ily, mwah π β¨
π¦ where this page comes from
- debian bookworm: libmodbus-dev 3.1.6-2.1+deb12u1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms