dartusbhid 0.1.2 copy "dartusbhid: ^0.1.2" to clipboard
dartusbhid: ^0.1.2 copied to clipboard

A dart wrapper for libusbhid, to interface with USB human input devices. Supports device properties like product and vendorID and the ability to read and write reports.

dartusbhid #

A dart wrapper for libusbhid, to interface with human input devices. It runs in its own isolate. Supports

  • Enumerating USB HID devices
    • Supports vendorId, productId, serialNumber, releaseNumber, manufacturerString, productString, usagePage, usage, interfaceNumber
  • Reading and writing device reports with or without report ID

Planned:

  • Read and write feature reports

Installation #

flutter pub add dartusbhid

Usage #

import 'package:dartusbhid/enumerate.dart';

void printDeviceList() async {
  final devices = await enumerateDevices(0, 0);
  print(devices.length);
  for (final device in devices) {
    // Print device information like product name, vendor, etc.
    print(device);
  }

  final openDevice = await devices[0].open();
  // Read data without timeout (timeout: null)
  print("Waiting for first hid report");
  final receivedData = await openDevice.readReport(null);
  print(receivedData);
  await openDevice.close();
}

printDeviceList();

Development #

To try out the example

git clone https://github.com/TobiasJacob/dartusbhid.git
cd dartusbhid/example
flutter run

from there on you can start to develop the library. Publish the library by increasing the version, adjusting the changelog and using

cd dartusbhid
flutter analyze
flutter pub publish
4
likes
0
pub points
65%
popularity

Publisher

unverified uploader

A dart wrapper for libusbhid, to interface with USB human input devices. Supports device properties like product and vendorID and the ability to read and write reports.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ffi, flutter, plugin_platform_interface

More

Packages that depend on dartusbhid