MODBUS_GET_SLAVE(3)

πŸ“¦
version 3.1.6 Β· 3 versions
, in debian bookworm

✨ 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 🌈


πŸ‘‘ 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