STRUCT HID_BATTERY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct hid_battery(9) ✨

okay so bestie, welcome to the <pink>Kernel API Manual</pink> πŸ’… this whole page is about struct hid_battery β€” and it literally represents a single battery power supply πŸ”‹ like, one (1) battery, living its main character life inside HID land πŸŽ€


🌸 SYNOPSIS 🌸

struct hid_battery {
    struct hid_device *dev;
    struct power_supply *ps;
    __s32 min;
    __s32 max;
    __s32 report_type;
    __s32 report_id;
    __s32 report_offset;
    __s32 charge_status;
    enum hid_battery_status status;
    __s32 capacity;
    bool avoid_query;
    bool present;
    ktime_t ratelimit_time;
    struct list_head list;
 };

no cap, that's the whole vibe right there πŸ‘‘ now let's do a member-by-member vibe check πŸ•΅οΈβ€β™€οΈ


πŸ¦‹ Members πŸ¦‹

  • dev β€” pointer to the parent hid_device πŸ’– like, who's your parent bestie, that's who this is
  • ps β€” the power supply instance ⚑ that's the actual power-supply object doing the work
  • min β€” minimum battery value from HID descriptor πŸ“ the floor, the bare minimum, we've all been there
  • max β€” maximum battery value from HID descriptor 🌈 the ceiling, the full-glow moment
  • report_type β€” HID report type (input/feature) πŸŽ€ like, which flavor of report is this
  • report_id β€” HID report ID for this battery 🏷️ gotta know which report belongs to this battery specifically
  • report_offset β€” bit offset of the capacity field within its report 🧚 that's where in the report the capacity field is chillin'
  • charge_status β€” current charging status πŸ”Œ like, are we charging or not, bestie
  • status β€” battery reporting status πŸ’€ the status of the battery's reporting, yep that's the whole bit
  • capacity β€” current battery capacity (0-100) πŸ’― literally a percentage, iconic range, no notes
  • avoid_query β€” if true, avoid querying battery (e.g., for stylus) πŸ™ˆ so like if it's true, don't go querying the battery β€” think stylus situations
  • present β€” if true, battery is present (may be dynamic) ✨ key word: may be dynamic, so it can change on you, don't get too attached
  • ratelimit_time β€” rate limiting for battery reports ⏳ yes queen, throttle those reports
  • list β€” list node for linking into hid_device's battery list πŸ”— that's the link-up energy, adding this battery into the hid_device's battery list

πŸ’œ SEE ALSO πŸ’œ


bestie heads up: every one of those is written (9) which means kernel API section 9 β€” that's the section, not part of the name 🫢

okay that's the whole page, mwah πŸ’‹ this came from ./include/linux, dated October 2026, and it's filed under struct hid_battery(9) β€” slay, go read the kernel source, ily, bye πŸ§šβœ¨πŸ‘‘

πŸ“¦ where this page comes from