Linux::Sysfs::Device - sysfs devices
my $device = Linux::Sysfs::Device->open($bus, $bus_id); my $parent = $device->get_parent; my @attrs = $device->get_attrs; $device->close;
Devices represent everything in sysfs under /sys/devices, which is a hierarchical view of system devices.
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.
$bus
$bus_id
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.
$path
$device->close;
Closes up the $device.
$device
$device->close_tree;
Closes every device under the supplied root $device.
my $parent = $device->get_parent;
Returns the Linux::Sysfs::Device instance for the parent (if present) of the given $device.
$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.
my $attr = $device->get_attr($name);
Searches supplied $device's attributes by $name and returns the corresponding Linux::Sysfs::Attribute instance or undef.
$name
my @attrs = $device->get_attrs;
Returns a list of Linux::Sysfs::Attribute instances for the $device.
my $name = $device->name;
Returns the name of the device.
my $path = $device->path;
Returns the full path of the device in sysfs.
my $bus_id = $device->bus_id;
Returns the $device's bus id.
my $bus = $device->bus;
Returns the Linux::Sysfs::Bus instance this $device is on. You'll need to call get_bus() first.
my $driver_name = $device->driver_name;
Returns the name of the driver responsible for the device.
Florian Ragwitz <rafl@debian.org>
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.
To install Linux::Sysfs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Linux::Sysfs
CPAN shell
perl -MCPAN -e shell install Linux::Sysfs
For more information on module installation, please visit the detailed CPAN module installation guide.