Help language development. Donate to The Perl Foundation
LibUSB - OO binding to libusb
constant VID = <vid> constant PID = <pid> use LibUSB; my LibUSB $dev .= new; $dev.init; $dev.get-device(VID, PID); $dev.open() # Will require elevated privileges # Do things with the device $dev.close(); $dev.exit()
LibUSB is an OO Raku binding to the libusb library, allowing for access to USB devices from Raku.
This interface is experimental and incomplete.
Initialize the libusb library for this device object.
Find the first device that matches the parameters and select it.
The VID of the device.
The PID of the device.
Find the first device with a user-defined check.
Find the first device for which &check returns true. $desc is a libusb_device_descriptor as found in the libusb documentation.
Open the selected device.
Close the device.
Close down the libusb library for this device object.
Returns the VID of the device.
Returns the PID of the device.
Returns the bus number of the device.
Returns the address of the device.
Returns the speed of the device.
Perform a control transfer to the device. It supports named parameters in any order, or positional parameters in the order below.
The USB control transfer request type.
The USB control transfer request.
The USB control transfer value.
The USB control transfer index.
A buffer containing data to send, or containing space to receive data.
The number of elems in $data.
How long to wait before timing out. Defaults to 0 (never time out).
Travis Gibson [email protected]
Copyright 2020 Travis Gibson
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.