Device
Defined in: src/device.ts:121
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TData = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Device<
TData>(init):Device<TData>
Defined in: src/device.ts:157
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Device<TData>
Properties
Section titled “Properties”attrs:
Record<string,DeviceAttribute> ={}
Defined in: src/device.ts:151
optionalbus?:BusType<Device<unknown>,DeviceDriver<Device<unknown>>>
Defined in: src/device.ts:128
class?
Section titled “class?”
optionalclass?:Class
Defined in: src/device.ts:131
dev_t?
Section titled “dev_t?”
optionaldev_t?:DevT
Defined in: src/device.ts:134
The device number. Devices with one get a dev attribute and a link in /sys/dev.
driver?
Section titled “driver?”
optionaldriver?:DeviceDriver<Device<unknown>>
Defined in: src/device.ts:129
driver_data?
Section titled “driver_data?”
optionaldriver_data?:TData
Defined in: src/device.ts:140
Whatever the bound driver wants to keep with the device, i.e. dev->driver_data
optionalid?:number
Defined in: src/device.ts:126
kobj_parent?
Section titled “kobj_parent?”
optionalkobj_parent?:KObject
Defined in: src/device.ts:146
Forces where the device goes in sysfs, like setting dev->kobj.parent before register.
This is how a bus’ root device ends up somewhere like /sys/devices/system.
kobject?
Section titled “kobject?”
optionalkobject?:DeviceKObject
Defined in: src/device.ts:149
/sys/devices/.../<name>. Only set while the device is registered.
name:
string
Defined in: src/device.ts:122
of_node?
Section titled “of_node?”
optionalof_node?:object&object
Defined in: src/device.ts:137
The device tree node this device was created from, i.e. dev->of_node
Type Declaration
Section titled “Type Declaration”
optionalid?:string
What the device is called under /sys/devices/platform. One is made up when there isn’t one.
kind:
"xterm"
Type Declaration
Section titled “Type Declaration”options?
Section titled “options?”
optionaloptions?:AttachXTermOptions
terminal
Section titled “terminal”terminal:
XTermLike
parent?
Section titled “parent?”
optionalparent?:Device<unknown> |null
Defined in: src/device.ts:124
power:
Partial<DevicePowerInfo> ={}
Defined in: src/device.ts:153
removable?
Section titled “removable?”
optionalremovable?:"unknown"|"removable"|"fixed"
Defined in: src/device.ts:155
optionaltype?:DeviceType
Defined in: src/device.ts:130
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get path():
string|undefined
Defined in: src/device.ts:171
The device’s path relative to the root of sysfs, if it is registered
Returns
Section titled “Returns”string | undefined
registered
Section titled “registered”Get Signature
Section titled “Get Signature”get registered():
boolean
Defined in: src/device.ts:166
Whether the device is currently in sysfs
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”attach()
Section titled “attach()”attach():
boolean
Defined in: src/device.ts:212
Look for a driver on the device’s bus that can handle it.
Returns
Section titled “Returns”boolean
whether the device ended up bound
bind_driver()
Section titled “bind_driver()”bind_driver(
drv):void
Defined in: src/device.ts:255
Bind a device to a driver without probing it.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Throws
Section titled “Throws”EBUSY if the device is already bound
dev_node()
Section titled “dev_node()”dev_node():
object
Defined in: src/device.ts:356
Internal
Work out the name and mode a device’s node under /dev should have.
Returns
Section titled “Returns”object
a mode of 0 when nothing set one
mode:
number
name:
string
link_driver()
Section titled “link_driver()”
protectedlink_driver():void
Defined in: src/device.ts:197
Link the device up with the driver it just bound to.
Returns
Section titled “Returns”void
register()
Section titled “register()”register():
void
Defined in: src/device.ts:284
Add a device to sysfs, link it up with its bus and class, then try to find it a driver.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”EEXIST if the device is already registered, or something else has its name
release_driver()
Section titled “release_driver()”release_driver():
void
Defined in: src/device.ts:265
Unbind a device from its driver. Does nothing if it isn’t bound.
Returns
Section titled “Returns”void
sysfs_parent()
Section titled “sysfs_parent()”
protectedsysfs_parent():KObject
Defined in: src/device.ts:178
Work out where a device goes in sysfs.
Returns
Section titled “Returns”try_bind()
Section titled “try_bind()”try_bind(
drv):boolean
Defined in: src/device.ts:234
Offer the device to a driver, binding the two if the driver’s probe accepts it.
A driver without a probe takes every device the bus matched for it.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
whether the device was bound
unregister()
Section titled “unregister()”unregister():
void
Defined in: src/device.ts:327
Remove a device from sysfs, unbinding it from its driver first. Does nothing if the device isn’t registered.
Returns
Section titled “Returns”void