STRUCT ST_PROTO_S(9)
π struct st_proto_s(9) β the Kernel API Manual page, but make it make sense π
okay so bestie, gather round, because this is struct st_proto_s(9) and it's literally the "per protocol" struct that carries your protocol's whole vibe from BT/FM/GPS over to ST β¨. Yes, that ST. The shared-TTY one. She's a middlewoman, she's iconic, she's got a callback for everything.
πΈ SYNOPSIS πΈ
Like, this is the shape of her. Copy it exactly, no cap:
struct st_proto_s {
enum proto_type type;
long (*recv) (void *, struct sk_buff *);
unsigned char (*match_packet) (const unsigned char *data);
void (*reg_complete_cb) (void *, int data);
long (*write) (struct sk_buff *skb);
void *priv_data;
unsigned char chnl_id;
unsigned short max_frame_size;
unsigned char hdr_len;
unsigned char offset_len_in_hdr;
unsigned char len_size;
unsigned char reserve;
};
π¦ Members π¦
okay, member by member, let's go π
typeβ the type of the protocol being registered, picked from the availableproto_type(BT, FM, GPS β the protocols that share the TTY, iykyk).recvβ the receiver callback, pointing at a function inside the protocol drivers, and the ST driver calls it whenever relevant data shows up. it's giving "u got mail" π¬match_packetβ reserved for future use, bestie. it's there to make ST more generic. that's it, that's the whole thing πreg_complete_cbβ callback handler pointing at a function in the protocol handler, called by ST when the pending registrations are complete. and why would registrations be pending? because fw download is in progress, that's why. main character delay energy β³writeβ pointer to a function in ST, handed to the protocol drivers from ST, to be used when protocol drivers have data to send to the TTY. yes, ST gives it AND receives it, she contains multitudes πpriv_dataβ the private data holder for the protocol drivers. sent from the protocol drivers during registration, and sent right back onreg_complete_cbandrecv. (the original page literally spells it "privdate" and honestly? we stan a typo that made it to production π)chnl_idβ the channel id the protocol driver is interested in. and what is a channel id? nothing but the 1st byte of the packet in the UART frame. literally just the first byte. queen of low effort, high impact πmax_frame_sizeβ size of the largest frame the protocol can receive. big frame energy π₯hdr_lenβ length of the header structure of the protocol. πoffset_len_in_hdrβ this one's the lil helper: it gives the offset of the length field inside the protocol's header structure, so ST knows how much to receive when the data is split across UART frames. split-across-frames detective work, slay πβ¨len_sizeβ whether the length field inside the header is2bytes or1byte. that's the whole assignment π«Άreserveβ the number of bytes ST needs to reserve in theskbbeing prepared for the protocol driver. don't forget to save room, bestie π
β SEE ALSO β
go read these next, fr fr π:
Kernel file ./include/linux/ti_wilink_st.h, struct st_data_s(9), st_int_write(9), st_write(9), struct chip_version(9), struct kim_data_s(9), struct bts_header(9), struct bts_action(9), struct hci_command(9), struct ti_st_plat_data(9)
and that's the page!! π sourced straight from ./include/linux, dated October 2026, and lovingly filed under struct st_proto_s(9) β go off, kernel docs, you ate πβ¨
π¦ 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