hidapi-d 1.0.0

D bindings for HIDAPI


To use this package, run the following command in your project's root directory:

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.

Usage

This is a simple example usng my Steelseries Rival 310.

Code
auto dev = new Device(0x1038, 0x1720);

writeln("Manufacturer: ", dev.getManufacturer());
writeln("Product: ", dev.getProduct());
writeln("Serial Number: ", dev.getSerialNumber());
writeln("Feature Report: ", dev.getFeatureReport(255));
writeln("Indexed String #4:", dev.getIndexedString(4));
writeln("Indexed String #5:", dev.getIndexedString(5));

const uint size = 64;
ubyte[] buf = new ubyte[size];
buf[0] = 0x90;
writeln("", dev.command(buf, size));

Device.find(0x1038, 0x1720,
    function (hid_device_info* devv, uint n)
    {
        writefln("Serial #%d: %s", n, (*devv).serial_number);
    }
);

// Allows to pass a bool: callback(device, uint, bool)
Device.find(0x1038, 0x1720,
    function (hid_device_info* devv, uint n, ref bool stop)
    {
        if(stop)
            return;
        
        writefln("Serial #%d: %s", n, (*devv).serial_number);
        if(n >= 2)
            stop = true;
    }
);
Output
Manufacturer: SteelSeries
Product: SteelSeries Rival 310 eSports Mouse
Serial Number: 000000000000
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]
Indexed String #4:SteelSeries Config
Indexed String #5:SteelSeries Consumer
[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 #1: 55DA********
Serial #2: 55DA********
Serial #3: 55DA********
Serial #1: 55DA********
Serial #2: 55DA********
I removed some of the characters from the serial numbers. They were all diferent.
Authors:
  • Filipe Laíns
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
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 49 downloads total

Score:
0.7
Short URL:
hidapi-d.dub.pm