STRUCT PS2DEV(9)
β¨ struct ps2dev(9) β¨
okay bestie, welcome to the struct ps2dev(9) glow-up π
β this is the page from the Kernel API Manual and it's literally all about one little struct that represents a device speaking the PS/2 protocol. yes, that PS/2. keyboards, mice, the whole legacy icon lineup πβ¨οΈ. she's vintage, she's still in your kernel, and she ate.
π NAME π
struct ps2dev β represents a device using PS/2 protocol. that's it, that's the vibe. a whole struct whose entire main character energy is "i am a PS/2 device" π«Ά
β¨ SYNOPSIS β¨
struct ps2dev {
struct serio *serio;
struct mutex cmd_mutex;
wait_queue_head_t wait;
unsigned long flags;
u8 cmdbuf[8];
u8 cmdcnt;
u8 nak;
ps2_pre_receive_handler_t pre_receive_handler;
ps2_receive_handler_t receive_handler;
};
look at her. nine fields. flawless. no notes π₯
πΈ Members πΈ
okay so here's the field-by-field breakdown, iykyk:
serioβ a serio port used by the PS/2 device. this is her home address, her little landing pad πcmd_mutexβ a mutex ensuring that only one command is executing at a time. one at a time, bestie!! no cutting the line, no chaos, we take turns βwaitβ a waitqueue used to signal completion from the serio interrupt handler. this is how the interrupt handler goes "hey girl, it's done π" from the depths of interrupt context.flagsβ various internal flags indicating stages of PS/2 command execution. the vibes tracker π β internal, mysterious, doing her thing.cmdbufβ buffer holding command response. eight bytes ofu8pure potential πcmdcntβ outstanding number of bytes of the command response. like a countdown but make it protocol π how many bytes are still out there? she knows.nakβ a byte transmitted by the device when it refuses command. that's the NAK, the device's "no <3" β it literally refuses and sends this byte back πpre_receive_handlerβ checks communication errors and returns disposition (enumps2_disposition) of the received data byte. the bouncer at the door πͺ she checks for comms errors first and then says what she thinks of the byte (that's theenum ps2_dispositionverdict, no cap).receive_handlerβ main handler of particular PS/2 protocol, such as keyboard or mouse protocol. the main character of the whole operation π β the protocol-specific handler that actually deals with the data.
π SEE ALSO π
- Kernel file
./include/linux/libps2.h - enum
ps2_disposition(9)
fr fr: if you're poking at a PS/2 device in the kernel, this struct is your bestie β the port, the mutex, the buffer, the handlers, all of it. respect her π
and that's a wrap, bestie!! this page lives in ./include/linux, dated October 2026, and its whole title is struct ps2dev(9) β go off and read the source, slay π§β¨π
π¦ 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