STRUCT USB_KBD(9)
π NAME π
okay so this is the manual page for struct usb_kbd β in the struct usb_kbd(9) Kernel API Manual, bestie β and it's literally just the state of each attached keyboard. that's it. that's the whole vibe. one struct holding everything a HID keyboard needs to keep track of about itself πΉβ¨
β¨ SYNOPSIS β¨
no cap, here's the whole thing, character for character:
struct usb_kbd {
struct input_dev *dev;
struct usb_device *usbdev;
unsigned char old[8];
struct urb *irq, *led;
unsigned char newleds;
char name[128];
char phys[64];
unsigned char *new;
struct usb_ctrlrequest *cr;
unsigned char *leds;
dma_addr_t new_dma;
dma_addr_t leds_dma;
spinlock_t leds_lock;
bool led_urb_submitted;
};
like... she's got range. input dev, usb dev, buffers, DMA addresses, a spinlock, a bool. main character struct energy honestly π
π Members π
okay bestie, member-by-member tour, everybody gets their moment:
devβ the input device associated with this keyboard π«Άusbdevβ the usb device associated with this keyboard πoldβ data received in the past from theirqURB representing which keys were pressed. by comparing it with the current list of keys that are pressed, we're able to see key releases π that's the trick, that's the whole trick β diff the old against the new and boom, you know what got let go.irqβ the URB for receiving a list of keys that are pressed when a new key is pressed or a key that was pressed is released π―ledβ the URB for sending LEDs (e.g.numlock, ...) π‘β¨newledsβ data that will be sent with theledURB, representing which LEDs should be on πnameβ Name of the keyboard.dev'snamefield points to this buffer π·οΈphysβ Physical path of the keyboard.dev'sphysfield points to this buffer π€οΈnewβ Buffer for theirqURB π§Ίcrβ Control request forledURB ποΈledsβ Buffer for theledURB π§Ίπ‘new_dmaβ DMA address forirqURB πleds_dmaβ DMA address forledURB ππ‘leds_lockβ spinlock that protectsleds,newleds, andled_urb_submittedπ like genuinely protects all three, don't be out here touching them unlocked, that's not the moveled_urb_submittedβ indicates whetherledis in progress, i.e. it has been submitted and its completion handler has not returned yet without resubmittingledβ³ (read that one twice, it's doing a lot of work in one sentence, iykyk)
π¦ SEE ALSO π¦
- Kernel file
./drivers/hid/usbhid/usbkbd.cβ go read the source, bestie, it's right there ππ
okay that's the whole page!! literally all of it, nothing skipped, no gatekeeping π the manual name is struct usb_kbd(9), the source/version bits are ./drivers/hid/usbhid and October 2026, and the date-ish stamp is struct usb_kbd(9) again β so bye bestie, go read usbkbd.c, mwah πππ¦
π¦ 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