NAME
Linux::Sysfs::Device - sysfs devices
SYNOPSIS
my
$device
= Linux::Sysfs::Device->
open
(
$bus
,
$bus_id
);
my
$parent
=
$device
->get_parent;
my
@attrs
=
$device
->get_attrs;
$device
->
close
;
DESCRIPTION
Devices represent everything in sysfs under /sys/devices, which is a hierarchical view of system devices.
METHODS
- open
-
my
$device
= Linux::Sysfs::Device->
open
(
$bus
,
$bus_id
);
Given the name of the
$bus
, this method locates a given device and returns a Linux::Sysfs::Device instance corresponding to the requested$bus_id
. - open_path
-
my
$device
= Linux::Sysfs::Device->open_path(
$path
);
Opens up a device at a specific
$path
. It opens the device's directory, reads the directory, and returns a Linux::Sysfs::Device instance on success or undef on failure. - close
-
$device
->
close
;
Closes up the
$device
. - close_tree
-
$device
->close_tree;
Closes every device under the supplied root
$device
. - get_parent
-
my
$parent
=
$device
->get_parent;
Returns the Linux::Sysfs::Device instance for the parent (if present) of the given
$device
. - get_bus
-
$device
->get_bus or
die
'get_bus failed'
;
Fills in the bus this
$device
is on. The Linux::Sysfs::Bus instance can be retrieved using the bus() method later on. Returns something true on success or something false on failure. - get_attr
- get_attribute
-
my
$attr
=
$device
->get_attr(
$name
);
Searches supplied
$device
's attributes by$name
and returns the corresponding Linux::Sysfs::Attribute instance or undef. - get_attrs
- get_attributes
-
my
@attrs
=
$device
->get_attrs;
Returns a list of Linux::Sysfs::Attribute instances for the
$device
. - name
-
my
$name
=
$device
->name;
Returns the name of the device.
- path
-
my
$path
=
$device
->path;
Returns the full path of the device in sysfs.
- bus_id
-
my
$bus_id
=
$device
->bus_id;
Returns the
$device
's bus id. - bus
-
my
$bus
=
$device
->bus;
Returns the Linux::Sysfs::Bus instance this
$device
is on. You'll need to call get_bus() first. - driver_name
-
my
$driver_name
=
$device
->driver_name;
Returns the name of the driver responsible for the device.
AUTHOR
Florian Ragwitz <rafl@debian.org>
COPYRIGHT & LICENSE
Copyright 2006 Florian Ragwitz, all rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.