STRUCT ST_PROTO_S(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 available proto_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 on reg_complete_cb and recv. (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 is 2 bytes or 1 byte. that's the whole assignment 🫢
  • reserve β€” the number of bytes ST needs to reserve in the skb being 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