The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Udev::FFI::Enumerate

SYNOPSIS

use Udev::FFI;

my $udev = Udev::FFI->new() or
    die("Can't create Udev::FFI object: $@");

my $enumerate = $udev->new_enumerate() or
    die("Can't create enumerate context: $@");

$enumerate->add_match_subsystem('usb');
$enumerate->add_match_sysattr('idVendor'); # devices with VID

$enumerate->scan_devices();

my @devices = $enumerate->get_list_entries();
for (@devices) {
    my $device = $udev->new_device_from_syspath($_);

    if (defined $device) {
        print("DEVICE: ".$device->get_sysname()."\n");
        print("VID: ".$device->get_sysattr_value('idVendor')."\n");
        print("PID: ".$device->get_sysattr_value('idProduct')."\n\n");
    }
}

METHODS

add_match_subsystem( SUBSYSTEM )

add_nomatch_subsystem( SUBSYSTEM )

add_match_sysattr( SYSATTR [, VALUE] )

add_nomatch_sysattr( SYSATTR [, VALUE] )

add_match_property( PROPERTY [, VALUE] )

add_match_sysname( SYSNAME )

add_match_tag( TAG )

add_match_parent( PARENT )

add_match_is_initialized()

add_syspath( SYSPATH )

scan_devices()

scan_subsystems()

get_list_entries()

get_udev()

SEE ALSO

Udev::FFI main Udev::FFI documentation