Haskell FFI bindings to the HIDAPI library
hidapi bundles C source from the libusb project. The current
version of the HIDAPI library bundled with this library is libusb/hidapi@f8a47b5
.
Haskell HIDAPI bindings
License: MIT License
Haskell FFI bindings to the HIDAPI library
hidapi bundles C source from the libusb project. The current
version of the HIDAPI library bundled with this library is libusb/hidapi@f8a47b5
.
Shouldn't enumerate :: ... -> ... [DeviceInfo]
be OK, empty list for no devices?
Could you ever have Just []
?
I just compared with node-hid
, and the output of enumerateAll
is just wrong. I think I’m going to patch it. :)
I'm having some difficulty building on OS X as I don't have libudev
installed. Looking at the source, it seems the package has only been prepared for windows and Linux. Is this correct?
Thanks for making this library ! I have used it to control a robot (MBot) from within Haskell. Unfortunately the library as is wouldn't compile on my mac nor on windows 10. I had to make two tiny adjustments.
System/HIDAPI.hsc => import Control.DeepSeq
hidapi.cabal => deepseq >= 0.1 (in the build-depends)
It would be great if you could either make these changes or explain me how the library could be installed without having to make these changes. Otherwise I will have to re-distributed your code with the super tiny patch.
Just to be complete here is the error I get without the changes:
$ cabal install
...
Configuring hidapi-0.1.3...
Building hidapi-0.1.3...
Preprocessing library hidapi-0.1.3...
[1 of 1] Compiling System.HIDAPI ( dist/build/System/HIDAPI.hs, dist/build/System/HIDAPI.o )System/HIDAPI.hsc:95:10:
Not in scope: type constructor or class ‘NFData’
Perhaps you meant ‘Data’ (imported from Data.Data)System/HIDAPI.hsc:126:10:
Not in scope: type constructor or class ‘NFData’
Perhaps you meant ‘Data’ (imported from Data.Data)
Failed to install hidapi-0.1.3
cabal: Error: some packages failed to install:
hidapi-0.1.3 failed during the building phase. The exception was:
ExitFailure 1
Building on a fresh Haskell install of ghc 7.6.3 we get deepseq-generics-0.2.0.0 (due to lax constraint of hidapi). This results in missing NFData (see below). Simply commenting out the two offending lines works fine (albeit without NFData instances). Another suggestion: Linux needs libudev-dev installed as well as just udev. Perhaps libudev-dev should be added as a requirement. Not everyone will know to install libudev-dev when install fails with error missing udev.
cabal install hidapi
Resolving dependencies...
Configuring hidapi-0.1.3...
Building hidapi-0.1.3...
Failed to install hidapi-0.1.3
Build log ( /home/pi/.cabal/logs/hidapi-0.1.3.log ):
Configuring hidapi-0.1.3...
Building hidapi-0.1.3...
Preprocessing library hidapi-0.1.3...
[1 of 1] Compiling System.HIDAPI ( dist/build/System/HIDAPI.hs, dist/build/System/HIDAPI.o )
System/HIDAPI.hsc:94:10:
Not in scope: type constructor or class NFData' Perhaps you meant
Data' (imported from Data.Data)
System/HIDAPI.hsc:125:10:
Not in scope: type constructor or class NFData' Perhaps you meant
Data' (imported from Data.Data)
cabal: Error: some packages failed to install:
hidapi-0.1.3 failed during the building phase. The exception was:
ExitFailure 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.