sshp_parse_command(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sshp_parse_command(9) β€” a Kernel API Manual moment 🫢

okay so bestie, you're in the Kernel API Manual section and the star of the show is sshp_parse_command. she parses SSH command frame payloads and she does it iconically. no cap.


✨ SYNOPSIS ✨

int sshp_parse_command (const struct device *dev , const struct
       ssam_span *source , struct ssh_command **command , struct ssam_span
       *command_data );

like, look at her go πŸ’… four params, one int return, zero notes.


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device used for logging. she's just here for the vibes and the log lines πŸͺ΅
  • source β€” the source to parse from. the raw material, the moment, the material ✨
  • command β€” the parsed command, and yes it's an output (struct ssh_command **), she writes back to you 🫢
  • command_data β€” the parsed command data / payload, also an output (struct ssam_span *) πŸ’–

🌸 DESCRIPTION 🌸

so what she actually does: parses and validates a SSH command frame payload. she sets the command pointer to the command header, and sets the command_data span to the command data β€” i.e. the payload of the command. and if the command doesn't have any associated data/payload? you get a zero-length span, which is giving "nothing but make it valid" πŸ’€

highkey important: this function does not check the frame-payload-type field. that check is on you, bestie β€” the caller has to do it before calling this function. no cap, don't skip it.

the source parameter should be the complete frame payload, like the one returned by the sshp_parse_frame command. literally just hand her the whole thing.

and the way she's efficient?? this function does not copy any data. she only validates the frame payload data and sets pointers (and length values) to indicate the respective parts. zero copying, all pointing, main character energy πŸ‘‘


πŸ”₯ RETURN πŸ”₯

returns zero on success β€” slay πŸ’–

or -ENOMSG if source doesn't represent a valid command-type frame payload, i.e. it's too short. too short = not the vibe, sorry 😭


πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group fr fr 🫢 go read them, iykyk


ngl, the whole "validate then point at stuff" thing is lowkey elegant. obsessed. but pls remember the frame-payload-type check is your job, not hers. πŸ™ˆ

sign-off time 🧚 this page lives at ./drivers/platform/surface/agg... and it's dated October 2026. catch you in the next section, bestie β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from