NAME
Solaris::DeviceTree::Libdevinfo - Perl interface to the Solaris devinfo library
SYNOPSIS
use Solaris::DeviceTree::Libdevinfo;
$node = new Solaris::DeviceTree::Libdevinfo;
@children = $node->child_nodes;
DESCRIPTION
The Solaris::DeviceTree::Libdevinfo
module implements access to the Solaris devinfo library libdevinfo
. The devicetree is presented as a hierarchical collection of nodes.
The implementation closely resembles the API of the C library. However, due to the object interface there a few differences to keep in mind when using this library after reading the manual pages to the original libdevinfo:
The 'di_'-prefix of the function names from the C API has been stripped.
The functions
di_init
anddi_fini
for generation and destruction of devicetrees are now called implicitly in the constructor and destructor.Accessing the nodes by driver via
di_drv_first_node
anddi_drv_next_node
is not implemented in favor of the much more expressivefind_nodes
added in Perl.The function
di_walk_node
is not implemented because treewalking in Perl usingchild_nodes
is much easier than in C and is therefore not needed.Getting child nodes via subsequent calls to
di_child_node
has been simplified to a single call tochild_nodes
returning an array of all child nodes.
di_binding_name di_bus_addr
di_child_node di_compatible_names
di_devfs_path di_devfs_path_free
di_devid di_driver_name
di_driver_ops di_drv_first_node
di_drv_next_node di_fini
di_init di_instance
di_minor_class di_minor_devt
di_minor_name di_minor_next
di_minor_nodetype di_minor_spectype
di_minor_type di_node_name
di_nodeid di_parent_node
di_prom_fini di_prom_init
di_prom_prop_data di_prom_prop_lookup_bytes
di_prom_prop_lookup_ints di_prom_prop_lookup_strings
di_prom_prop_name di_prom_prop_next
di_prop_bytes di_prop_devt
di_prop_ints di_prop_lookup_bytes
di_prop_lookup_ints di_prop_lookup_strings
di_prop_name di_prop_next
di_prop_strings di_prop_type
di_sibling_node di_state
di_walk_minor di_walk_node
METHODS
The following methods are available:
- $node = new Solaris::DeviceTree::Libdevinfo;
-
The constructor returns a reference to the root node object, which is a
Solaris::DeviceTree::Libdevinfo
object. Because the methods are all read-only the object is implemented as singleton and same reference gets returned every time. - @childs = $node->child_nodes;
- @childs = $node->child_nodes( attr1 => val1, ... )
-
This method returns a list with all children matching the given properties. If no properties are specified all children for the node are returned.
- $parent = $node->parent_node;
-
Returns the parent node for this node. If this is the root node, then
undef
is returned. - $node = $node->root_node
-
Returns the root node of the tree.
- @siblings = $node->sibling_nodes
-
Returns the list of siblings for the object. A sibling is a child from our parent, but not ourselves.
- $path = $node->devfs_path
-
Returns the physical path assocatiated with this node.
- $nodename = $node->node_name;
-
Returns the name of the node.
- $bindingname = $node->binding_name;
-
Returns the binding name for this node. The binding name is the name used by the system to select a driver for the device.
- $busaddr = $node->bus_addr;
-
Returns the address on the bus for this node.
undef
is returned if a bus address has not been assigned to the device. A zero-length string may be returned and is considered a valid bus address. - @compatNames = $devtree->compatible_names;
-
Returns the list of names from compatible device for the current node. See the discussion of generic names in "Writing Device Drivers" for a description of how compatible names are used by Solaris to achieve driver binding for the node.
- $devid = $devtree->devid;
-
Returns the device ID for the node, if it is registered. Otherwise,
undef
is returned. - $drivername = $devtree->driver_name;
-
Returns the name of the driver for the node or
undef
if the node is not bound to any driver. - %ops = $devtree->driver_ops;
-
Returns a hash whos keys indicate, which entry points of the device driver entry points are supported by the driver bound to this node. Possible keys are:
BUS CB STREAM
- $inst = $node->instance;
-
Returns the instance number for this node of the bound driver.
undef
is returned if no instance number has been assigned. - %state = $node->state;
-
Returns the driver state attached to this node as hash. The presence of the keys in the hash represent the states of the driver. The following keys in the hash can be present:
DRIVER_DETACHED DEVICE_OFFLINE DEVICE_DOWN BUS_QUIESCED BUS_DOWN
- $id = $node->nodeid;
-
Returns the type of the node. Three different strings identifying the types can be returned or
undef
if the type is unknown:PSEUDO SID PROM
Nodes of the type
PROM
may have additional prom properties that are defined by the PROM. The properties can be accessed with prom_props. - if( $node->is_pseudo_node ) { ... }
-
Returns the string
PSEUDO
as true value if the node is a pseudo node orundef
if not. - if( $node->is_sid_node ) { ... }
-
Returns the string
SID
as true value if the node is a sid node orundef
if not. - if( $node->is_prom_node ) { ... }
-
Returns the string
PROM
as true value if the node is a prom node orundef
if not. - $props = $node->props;
-
Returns a reference to a hash which maps property names to property values. The property values are of class Solaris::DeviceTree::Libdevinfo::Property.
- $promprops = $node->prom_props;
-
Returns a reference to a hash which maps PROM property names to property values. The property values are of class Solaris::DeviceTree::Libdevinfo::PromProperty.
- @minor = $node->minor_nodes;
-
Returns a reference to a list of all minor nodes which are associated with this node. The minor nodes are of class Solaris::DeviceTree::Libdevinfo::MinorNode.
EXAMPLES
AUTHOR
Copyright 1999-2003 Dagobert Michelsen.
SEE ALSO
libdevinfo (3devinfo)
libdevinfo (3lib)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 635:
You forgot a '=back' before '=head1'