STRUCT SPI_PACKET(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct spi_packet(9) β€” the kernel API manual, but make it cute πŸ¦‹

Okay so bestie, let me tell you about struct spi_packet β€” it's a complete spi packet and it is always 256 bytes. No cap. It carries the (parts of the) message in the data, but lowkey note that this does not necessarily contain a complete message, because in some cases (e.g. many fingers pressed πŸ‘†πŸ‘†πŸ‘†) the message is split over multiple packets β€” see the @offset, @remaining, and @length fields, iykyk. In general the data parts in spi_packet's are concatenated until @remaining is 0, and the result is an message. Periodt. ✨


🌸 SYNOPSIS 🌸

struct spi_packet {
    u8 flags;
    u8 device;
    __le16 offset;
    __le16 remaining;
    __le16 length;
    u8 data[246];
    __le16 crc16;
 };

πŸŽ€ Members πŸŽ€

  • flags β€” 0x40 = write (to device), 0x20 = read (from device); note that the response to a write still has 0x40. It's giving "read receipt energy" ngl πŸ’Œ
  • device β€” 1 = keyboard, 2 = touchpad. Two icons, two vibes πŸŽΉπŸ–±οΈ
  • offset β€” specifies the offset of this packet's data in the complete message; i.e. > 0 indicates this is a continuation packet (in the second packet for a message split over multiple packets this would then be the same as the length in the first packet). So it's like the "part 2" timestamp of your fave show, fr fr πŸ“Ί
  • remaining β€” number of message bytes remaining in subsequents packets (in the first packet of a message split over two packets this would then be the same as the length in the second packet). Basically the "how much more tea is there to spill" counter πŸ«–
  • length β€” length of the valid data in the data in this packet. The main character's screen time in this episode πŸ‘‘
  • data β€” all or part of a message. The actual content, the lore, the moment πŸ’–
  • crc16 β€” crc over this whole structure minus this crc16 field. This covers just this packet, even on multi-packet messages (in contrast to the crc in the message). So it's the packet's own personal vibe check, not the whole thread's πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./drivers/input/keyboard/applespi.c struct keyboard_protocol(9), struct tp_finger(9), struct touchpad_protocol(9), struct command_protocol_tp_info(9), struct touchpad_info_protocol(9), struct command_protocol_mt_init(9), struct command_protocol_capsl(9), struct command_protocol_bl(9), struct message(9)

And that's the tea, bestie πŸ“ The source lives in ./drivers/input/keyboard, dated October 2026 β€” stay iconic, stay hydrated, and may your packets always have remaining = 0 πŸ’œβœ¨

πŸ“¦ where this page comes from