Giter Site home page Giter Site logo

soldernerd / hid_utility Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 10.0 282 KB

This open source (GNU GPLv3) project is aimed at simplifying the development of C# applications that communicate with USB HID (Human Interface Device) devices.

Home Page: https://soldernerd.com/2017/02/14/c-usb-hid-utility/

C# 100.00%

hid_utility's People

Contributors

soldernerd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hid_utility's Issues

Error getting Device Details

Hi, I loaded your demo project, change the VID and PID to a known device, When trying to connect here:

if (SetupDiEnumDeviceInterfaces(DeviceInfoTable, IntPtr.Zero, ref InterfaceClassGuid, InterfaceIndex, ref InterfaceDataStructure)) { ErrorStatus = (uint)Marshal.GetLastWin32Error(); if (ErrorStatus == ERROR_NO_MORE_ITEMS) //Did we reach the end of the list of matching devices in the DeviceInfoTable? { //Cound not find the device. Must not have been attached. SetupDiDestroyDeviceInfoList(DeviceInfoTable); //Clean up the old structure we no longer need. return null; } } else //Else some other kind of unknown error ocurred... { ErrorStatus = (uint)Marshal.GetLastWin32Error(); SetupDiDestroyDeviceInfoList(DeviceInfoTable); //Clean up the old structure we no longer need. return null; // error here }

SetupDiEnumDeviceInterfaces returns error 1784

Raw Input messages not received when app loses focus

Hi. Thank you for creating this intriguing program.

I have had some success getting your demo application to read XBox One gamepads. Unfortunately - I only receive Input buffer data when running HidDemoWindowsForms, and even then the form MUST be in focus for button presses to be registered.

I am trying to run HID Utility as a service in the background - something to quietly log buffer data changes while other applications run over the top of it.

To reproduce the loss of focus issue, simply:

  1. Run the Windows Demo application.
  2. Press some buttons on the controller to verify packets are being received in the form.
  3. Open a windowed application (such as Paint, or Notepad), and bring said application to the foreground / into focus. Ensure you can still see the form packet data stats in the Windows Demo Form behind it.
  4. Press some more buttons.

Actual Outcome:
No packets are received while Windows Demo app is out of focus.

Desired Outcome:
Packets continue to be received if the Windows Demo app is out of focus, or even minimised. The 'packets received' stats in the form would show this in real-time.

I would greatly appreciate your thoughts on how I can make this work.

Ideally - I would like to achieve this outcome with a console-only version of your Windows Demo app, but I don't believe a device can be registered to the console window handler. (At any rate - I imagine I would have the same issues when the console loses focus).

Thanks!

Windows forms demo bug

Dear, i have used Hid_Utility as it was really good working software and reliable. Suddenly, it have stucked at one point, it stucked at point that Vid & Pid selected device is connected and working, if you unplug it and replug, program hangs. First it was seen as some error in dll, i na usb searcher.. But it is not. It is just found to be writing to textbox of devices found. Im not c expert, but workaround works,, That is how it was:

           string txt = "";
            foreach (Device dev in HidUtil.DeviceList)
            {
                string devString = string.Format("VID=0x{0:X4} PID=0x{1:X4}: {2} ({3})", dev.Vid, dev.Pid, dev.Caption, dev.Manufacturer);
                txt += devString + Environment.NewLine;
            }
            DevicesTextBox.Text = txt.TrimEnd('\n');

Changed to this:

          DevicesTextBox.Text = "";
            foreach (Device dev in HidUtil.DeviceList)
            {
                string devString = string.Format("VID=0x{0:X4} PID=0x{1:X4}: {2} ({3})", dev.Vid, dev.Pid, dev.Caption, dev.Manufacturer);
                DevicesTextBox.Text = DevicesTextBox.Text + Environment.NewLine + devString;
            }

I hope it helps to anyone! And thanks for that DLL,

Bostjan

Non-blocking reading

Hello and thank you for making this utility!
Is there any way to have an event-based receiption of reports? I mean now if I try to read a report from a device, but device haven't sent it yet, the code stalls at WinAPI ReadFile function. So I unable neither read any reports nor write them to the device untill device send me something.
I'm not sure, but can write/read report operations execute asynchronously?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.