hidapi-d 1.0.3
D bindings for HIDAPI
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
hidapi-d
D bindings for HIDAPI
Info
The bindings were automatically generated by dstep and they are available in the module hidapi.bindings
.
Apart from the bindings there is also a simple wrapper available in the module hidapi.device
.
Example
This is a simple example using hidapi-d
to interface with my Steelseries Rival 310.
Code
// Open the first matching device
auto dev = new Device(0x1038, 0x1720); // vendor_id, product_id
// Print info
writeln("Manufacturer: ", dev.getManufacturer());
writeln("Product: ", dev.getProduct());
writeln("Serial Number: ", dev.getSerialNumber());
writeln("Indexed String #4: ", dev.getIndexedString(4));
writeln("Indexed String #5: ", dev.getIndexedString(5));
writeln("Feature Report: ", dev.getFeatureReport(255));
// Execute a command
// Sends a buffer to the device and reads the response
const uint size = 64;
ubyte[] buf = new ubyte[size];
buf[0] = 0x90;
writeln("Command 0x90: ", dev.command(buf, size));
// Iterates over the devices found
foreach(devv; new DeviceList(0x1038, 0x1720))
{
writeln("Serial: ", devv.serial_number);
}
Output
Manufacturer: SteelSeries
Product: SteelSeries Rival 310 eSports Mouse
Serial Number: 000000000000
Indexed String #4: SteelSeries Config
Indexed String #5: SteelSeries Consumer
Feature Report: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Command 0x90: [33, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Serial: 55820C7AF180
Serial: 55820C7AEDC0
Serial: 55820C7AEC60
- Registered by Filipe Laíns
- 1.0.3 released 6 years ago
- FFY00/hidapi-d
- MIT
- Copyright © 2018, Filipe Laíns
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.3 2018-Jul-05 1.0.2 2018-Jun-16 1.0.1 2018-Jun-15 1.0.0 2018-Jun-15 ~master 2019-Jun-10 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
68 downloads total
-
- Score:
- 0.6
- Short URL:
- hidapi-d.dub.pm