DEVICE(9)

πŸ’– DEVICE(9) πŸ’–

ok so bestie, this is the kernel developer's manual page for device, and we're about to make device objects make sense. no cap. πŸ¦‹


✨ NAME ✨

device β€” an abstract representation of a device


🌸 SYNOPSIS 🌸

typedef struct device *device_t;

like, that's it. that's the whole synopsis. iconic.


πŸŽ€ DESCRIPTION πŸŽ€

okay so, the device object is literally the kernel's little avatar for a piece of hardware attached to the system. we're talking expansion cards, the bus that card is plugged into, disk drives hanging off that expansion card, etc. etc. the whole family tree basically. 🫢

the system defines one device all by itself β€” root_bus β€” and every other device gets created dynamically during autoconfiguration. normally the devices representing top-level buses in the system (ISA, PCI etc.) get attached directly to root_bus, and everything else gets added as children of their relevant bus. it's giving... tree structure, lowkey. 🌳

and speaking of trees: the devices in a system form a tree. every device except root_bus has a parent (peep device_get_parent(9)). plus, any device can have children attached to it β€” see device_add_child(9), device_add_child_ordered(9), device_find_child(9), device_get_children(9), and device_delete_child(9). the way that a whole bus can just have children... main character energy fr fr. πŸ‘‘

a device that's been successfully probed and attached to the system will also have a driver (see device_get_driver(9) and driver(9)) and a devclass (see device_get_devclass(9) and devclass(9)). and there's a whole lil' pile of other attributes too:

ngl that's a lot of getters. slay. ✨


πŸ’… the states, bestie πŸ’…

devices can be in one of several states:

  • DS_NOTPRESENT β€” the device has not been probed for existence, or the probe failed πŸ™ˆ
  • DS_ALIVE β€” the device probe succeeded but it's not yet attached
  • DS_ATTACHED β€” the device has been successfully attached πŸŽ‰
  • DS_BUSY β€” the device is currently open πŸ’€

you can figure out which state a device is in by calling device_get_state(9). vibe check, but for hardware. 🧚


🌈 SEE ALSO 🌈

devclass(9), driver(9)


πŸ’œ AUTHORS πŸ’œ

this manual page was written by Doug Rabson. thank you king. πŸ‘‘


and that's the whole page bestie, no notes. πŸ’–

Debian Β· January 15, 2017 β€” that's the source, the version, and the date, mwah. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from