soldernerd / HID_Utility

This open source (GNU GPLv3) project is aimed at simplifying the development of C# applications that communicate with USB HID (Human Interface Device) devices.
https://soldernerd.com/2017/02/14/c-usb-hid-utility/
40 stars 10 forks source link

Windows forms demo bug #4

Open bostjannagode opened 4 years ago

bostjannagode commented 4 years ago

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

soldernerd commented 4 years ago

Hi Bostjan Thank you for documenting this and for providing a fix. Lukas