NAME

Linux::Sysfs::Driver - sysfs drivers

SYNOPSIS

    my $driver = Linux::Sysfs::Driver->open('pci', 'tg3');

    my @attrs   = $driver->get_attrs;
    my @devices = $driver->get_devices;

    $driver->close;

DESCRIPTION

Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being the bus type, such as "pci", "usb, and so on).

METHODS

open
    my $driver = Linux::Sysfs::Driver->open($bus_name, $name);

Given the name of the bus, $bus_name, on which to look for, this method locates a given driver and returns a Linux::Sysfs::Driver instance corresponding to the requested device or undef, if no matching driver was found.

open_path
    my $driver = Linux::Sysfs::Driver->open_path($path);

Opens driver at specific $path. Returns a Linux::Sysfs::Driver instance on success or undef on failure.

close
    $driver->close;

Closes and cleans up $driver.

get_attr
get_attribute
    my $attr = $driver->get_attribute($name);

Searches supplied $driver's attributes by $name and returns the corresponding Linux::Sysfs::Attribute instance or undef, of no matching attribute was found.

get_attrs
get_attributes
    my @attrs = $driver->get_attributes;

Takes a $driver and returns a list of Linux::Sysfs::Attribute instances for the driver.

get_devices
    my @devices = $driver->get_devices;

Returns a list of Linux::Sysfs::Device instances that use this $driver.

get_module
    my $module = $driver->get_module;

Returns the module that the $driver is using.

name
    my $name = $driver->name;

Returns the $driver's name.

path
    my $path = $driver->path;

Returns the $driver's full path in sysfs.

bus
    my $bus_name = $driver->bus;

Returns the name of the bus on which the $device is registered.

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.