mightydevices / mightyhid Goto Github PK
View Code? Open in Web Editor NEWSimple library for dealing with HID USB devices in C#
Simple library for dealing with HID USB devices in C#
Hi,
In the windows 7 its possible to list the devices and make the handle but every data that you send to the device, is not passed to him.
when running on desktop pc (windows 7, 8, 8.1, 10 ), problem was not.
when using tablet, system.componentmodel.win32exception was occurred.
i found native.css use 'hid.dll.'
but this tablet have not.
What should I do to fix this problem?
sorry for bad english.
---------tested with --------
Model : lenovo YOGA Tablet 2-1051F
windows 8.1, 10
I notice that my RFID card reader was not listed. The problem was CreateFile
in HIDBrowser.cs
.
Instead of
return Native.CreateFile(path,
Native.GENERIC_READ | Native.GENERIC_WRITE,
Native.FILE_SHARE_READ | Native.FILE_SHARE_WRITE,
IntPtr.Zero, Native.OPEN_EXISTING,
Native.FILE_FLAG_OVERLAPPED,
IntPtr.Zero);
I used
return Native.CreateFile(path,
0,
Native.FILE_SHARE_READ | Native.FILE_SHARE_WRITE,
IntPtr.Zero,
Native.OPEN_EXISTING,
0,
IntPtr.Zero);
Listing works fine now.
We are getting a System.ComponentModel.Win32Exception from MightyHID.HIDBrowse.Browse(), as follows:
HResult=0x80004005
Message = Element not found
Source = MightyHID
Stack trace:
at MightyHID.HIDBrowse.GetVidPid(IntPtr handle, Int16& Vid, Int16& Pid)
at MightyHID.HIDBrowse.Browse()
[...]
So the VID and PID could not be retrieved for some device, and Browse() doesn't catch. I think it should, and then either skip that device altogether or fill in some invalid values (like -1) for the VID and PID. Does that sound reasonable?
Please add a license file/info.
Is there a reason you are using IntPtr instead of SafeFileHandle? It is my understanding that .NET framework SafeFileHandle will take care of properly closing the handles automatically. So SafeFileHandle would free up the native resources in most cases even if the user code doesn't and especially in the case where there is a program crashes which would certainly not close the native resources.
Hi just set everything up but get parameter incorrect. on this line.
_fileStream.Write(data, 0, data.Length);
any ideas?
error:
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll
Additional information: The parameter is incorrect.
This normally is a sharing issue but I don't see what would be using this stream.
Also this is a gamepad device I created with reports I use with HID.dll already (c command line tool)
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.