STRUCT SERIAL_RS485(9)
π NAME π
ok so this is the manual page for struct serial_rs485 β the serial interface for controlling RS485 settings, and honestly it's giving "small struct, big responsibilities." the manual name is struct serial_rs485(9) and it lives in the Kernel API Manual, and yes bestie we're reading the whole thing together π«Ά
β¨ SYNOPSIS β¨
no cap, here's the whole struct exactly as it is, do not come for me about the semicolons, they're canon:
struct serial_rs485 {
__u32 flags;
#define SER_RS485_ENABLED _BITUL(0);
#define SER_RS485_RTS_ON_SEND _BITUL(1);
#define SER_RS485_RTS_AFTER_SEND _BITUL(2);
#define SER_RS485_RX_DURING_TX _BITUL(4);
#define SER_RS485_TERMINATE_BUS _BITUL(5);
#define SER_RS485_ADDRB _BITUL(6);
#define SER_RS485_ADDR_RECV _BITUL(7);
#define SER_RS485_ADDR_DEST _BITUL(8);
#define SER_RS485_MODE_RS422 _BITUL(9);
__u32 delay_rts_before_send;
__u32 delay_rts_after_send;
union {
__u32 padding[5];
struct {
__u8 addr_recv;
__u8 addr_dest;
__u8 padding0[2];
__u32 padding1[4];
};
};
};
likeβ¦ look at it. it ate. π₯
π Members π
every field, one by one, no skipping, we're being thorough bestie:
flagsβ the RS485 feature flags. this is the main character of the struct ngl.delay_rts_before_sendβ delay before send, in milliseconds. that's ms, not vibes.delay_rts_after_sendβ delay after send, in milliseconds.{unnamed_union}β anonymous. it has no name. it simply is. π¦paddingβ lowkey deprecated π usepadding0andpadding1instead. and do not use it withaddr_recvandaddr_dest(due to overlap). read that again, seriously.{unnamed_struct}β anonymous too. matching anonymous energy, iconic.addr_recvβ receive filter for RS485 addressing mode (used only whenSER_RS485_ADDR_RECVis set).addr_destβ destination address for RS485 addressing mode (used only whenSER_RS485_ADDR_DESTis set).padding0β padding (set to zero). zero. okay?0xoxo.padding1β padding (set to zero). same rule, no exceptions.
πΈ Description πΈ
so basically: this is the serial interface for controlling RS485 settings on chips that actually have suitable support. you set it with TIOCSRS485 and get it with TIOCGRS485 β if your platform supports it, which, respectfully, check first.
the set function returns the new state, with any unsupported bits reverted appropriately. so if you asked for something the hardware can't do, it justβ¦ un-asks for it. it's fine. it's handled. π
and now the flag bits, all nine of them, in order because we're not monsters:
SER_RS485_ENABLEDβ RS485 enabled.SER_RS485_RTS_ON_SENDβ logical level for RTS pin when sending.SER_RS485_RTS_AFTER_SENDβ logical level for RTS pin after sent.SER_RS485_RX_DURING_TXβ full-duplex RS485 line.SER_RS485_TERMINATE_BUSβ enable bus termination (if supported).SER_RS485_ADDRBβ enable RS485 addressing mode.SER_RS485_ADDR_RECVβ receive address filter (enablesaddr_recv). requiresSER_RS485_ADDRB.SER_RS485_ADDR_DESTβ destination address (enablesaddr_dest). requiresSER_RS485_ADDRB.SER_RS485_MODE_RS422β enable RS422. requiresSER_RS485_ENABLED.
ok real talk π«Ά the "requires" ones are not suggestions, they're requirements. skip the prerequisite and the flag does nothing for you. iykyk.
β SEE ALSO β
- Kernel file
./include/uapi/linux/serial.h
go read it, it's right there, it's basically the source material and it's lowkey obsessed with itself (as it should be).
mwah π that's the whole page! this little gem came out of ./include/uapi/linux and it's dated October 2026 β so go forth, configure your RS485, set your paddings to zero, and remember: <rainbow>the flags are reverted appropriately and so are you</rainbow> β¨ππ
π¦ 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