woodemi / libusb.dart

Dart wrapper via dart:ffi for https://github.com/libusb/libusb
BSD 3-Clause "New" or "Revised" License
40 stars 23 forks source link

Example missing on how to use the library? #23

Closed jyashi closed 2 years ago

jyashi commented 2 years ago

Thank you for the package.

Sorry but I cannot see a straightforward way to using it.

  1. I cannot see an example section in the packages https://pub.dev/packages/libusb
  2. I can see an example folder in the github page but the use of it causes errors from listDeviceProducts.dart

image

I just want to import the library on windows platform and use its provided functions to access usb device and send data to it. Will there be a step by step guide in getting this done?

Again thank you for your work and apologies if the solution was obvious but i could not pick up on it.

Sunbreak commented 2 years ago

Could you try https://github.com/woodemi/quick_usb?

jyashi commented 2 years ago

Thank you. I tried running.. i got the following error.. i need to take extra measures on my PC ?

image

jyashi commented 2 years ago

Flutter doctor -v

image

jyashi commented 2 years ago

Apparently the structs.g.dart file does not exist.

Does it not come included with the quick_usb package?

Sunbreak commented 2 years ago
  1. I can see an example folder in the github page but the use of it causes errors from listDeviceProducts.dart

Does example/listdevs.list work?

Sunbreak commented 2 years ago

Thank you. I tried running.. i got the following error.. i need to take extra measures on my PC ?

image

Something wrong inside win32 package, which quick_usb depends on

Apparently the structs.g.dart file does not exist.

Does it not come included with the quick_usb package?

structs.g.dart is inside win32: https://github.com/timsneath/win32/blob/main/lib/src/structs.g.dart

jyashi commented 2 years ago

Okay... adding Win32 to dependencies and import 'package:win32/win32.dart'; runs the example fine. I will keep digging for the rest and get back here if any problem comes.

Sunbreak commented 2 years ago

Re-check quick_usb and libusb, neither depends on win32

Maybe it is your project depedency?

Sunbreak commented 2 years ago

Fix by https://github.com/woodemi/libusb.dart/commit/9807b5ce0c635153035039eb6c1600db131359a4