Skip to content

BusType

Defined in: src/drivers/base/bus.ts:13

Unlike Linux, we don’t use ksets, ktypes, or attribute groups.

TDevice extends Device = Device

TDriver extends DeviceDriver<TDevice> = DeviceDriver<TDevice>

new BusType<TDevice, TDriver>(name): BusType<TDevice, TDriver>

Defined in: src/drivers/base/bus.ts:46

string

BusType<TDevice, TDriver>

KObject.constructor

attributes: Map<string, Attribute>

Defined in: src/kobject.ts:21

These attributes use the kobject’s show and store.

KObject.attributes


readonly bus_attrs: Record<string, BusAttribute> = {}

Defined in: src/drivers/base/bus.ts:42


children: Map<string, KEntry>

Defined in: src/kobject.ts:16

KObject.children


readonly dev_attrs: Record<string, DeviceAttribute> = {}

Defined in: src/drivers/base/bus.ts:43


optional dev_name?: string

Defined in: src/drivers/base/bus.ts:14


optional dev_root?: Device<unknown>

Defined in: src/drivers/base/bus.ts:31

The device this bus’ devices go under when they have no parent, for example /sys/devices/system/cpu.

subsys_system_register


readonly devices: Set<Device<unknown>>

Defined in: src/drivers/base/bus.ts:22


readonly devices_kobj: KObject

Defined in: src/drivers/base/bus.ts:17

/sys/bus/<name>/devices, which has a link for every device on the bus


readonly drivers: Set<DeviceDriver<Device<unknown>>>

Defined in: src/drivers/base/bus.ts:24


readonly drivers_kobj: KObject

Defined in: src/drivers/base/bus.ts:20

/sys/bus/<name>/drivers


readonly drv_attrs: Record<string, DriverAttribute> = {}

Defined in: src/drivers/base/bus.ts:44


name: string

Defined in: src/kobject.ts:24

KObject.name


optional parent?: KObject | null

Defined in: src/kobject.ts:25

KObject.parent

get path(): string

Defined in: src/kobject.ts:34

The path of this kobject, relative to the root of sysfs.

string

KObject.path

[dispose](): void

Defined in: src/kobject.ts:72

void

KObject.[dispose]


add_uevent_attr(): void

Defined in: src/kobject.ts:115

void

KObject.add_uevent_attr


create_attribute(name, show?, store?, mode?): Attribute

Defined in: src/kobject.ts:132

string

((kobj) => string) | null

((kobj, value) => void) | null

number = ...

Defaults based on which of show and store were passed.

Attribute

KObject.create_attribute


dispose(): void

Defined in: src/kobject.ts:64

void

KObject.dispose


find_device(name): Device<unknown> | null

Defined in: src/drivers/base/bus.ts:52

Find a device on this bus by name

string

Device<unknown> | null


find_driver(name): DeviceDriver<Device<unknown>> | null

Defined in: src/drivers/base/bus.ts:58

Find a driver registered on this bus by name

string

DeviceDriver<Device<unknown>> | null


keys(): Iterable<string>

Defined in: src/kobject.ts:60

The names of everything in this kobject.

Iterable<string>

KObject.keys


lookup(name): KEntry | undefined

Defined in: src/kobject.ts:44

Resolve a single entry by name. Attributes that use this kobject’s show and store are bound before being returned.

string

KEntry | undefined

KObject.lookup


optional match(device, driver): boolean

Defined in: src/drivers/base/bus.ts:67

TDevice

Readonly<TDriver>

boolean

whether a device or driver can be handled by this bus.

When it can’t be determined that the driver supports the device.


notify_uevent(action, env?): void

Defined in: src/kobject.ts:82

Notify listeners that something happened to kobj.

"add" | "remove" | "change" | "move" | "online" | "offline" | "bind" | "unbind"

UEventEnv = {}

void

KObject.notify_uevent


optional offline(device): void

Defined in: src/drivers/base/bus.ts:77

Called to put a device offline

TDevice

void


optional online(device): void

Defined in: src/drivers/base/bus.ts:74

Called to put a device back online

TDevice

void


optional remove(device): void

Defined in: src/drivers/base/bus.ts:69

TDevice

void


optional resume(device): void

Defined in: src/drivers/base/bus.ts:83

Called when a device wants to resume from sleep

TDevice

void


send_uevent(text): void

Defined in: src/kobject.ts:100

Send a uevent described by text, an action optionally followed by KEY=VALUE pairs. This is what writing to a uevent attribute does.

string

void

KObject.send_uevent


optional show(attr): string

Defined in: src/kobject.ts:76

Attribute

string

KObject.show


optional shutdown(device): void

Defined in: src/drivers/base/bus.ts:71

TDevice

void


optional store(attr, value): void

Defined in: src/kobject.ts:77

Attribute

string

void

KObject.store


subsys_system_register(): Device

Defined in: src/drivers/base/bus.ts:36

Register a bus as a system subsystem, which gives it a root device at /sys/devices/system/<name> that its devices go under.

Device


optional suspend(device): void

Defined in: src/drivers/base/bus.ts:80

Called when a device wants to go to sleep

TDevice

void


optional uevent(env): void

Defined in: src/kobject.ts:127

Add variables to the environment of uevents sent for this kobject and its descendants.

UEventEnv

void

notify_uevent

KObject.uevent